unified some comments, some cleanup.

2003-02-03  Michael Natterer  <mitch@gimp.org>

	* app/undo.c: unified some comments, some cleanup.

	* app/pdb/procedural_db.c: some cleanup & comments to clarify
	what GIMP_PDB_PASS_THROUGH does.
This commit is contained in:
Michael Natterer 2003-02-03 13:45:40 +00:00 committed by Michael Natterer
parent f7a911173f
commit c5b1f98add
7 changed files with 109 additions and 86 deletions

View file

@ -1,3 +1,10 @@
2003-02-03 Michael Natterer <mitch@gimp.org>
* app/undo.c: unified some comments, some cleanup.
* app/pdb/procedural_db.c: some cleanup & comments to clarify
what GIMP_PDB_PASS_THROUGH does.
2003-02-03 Michael Natterer <mitch@gimp.org>
* app/display/Makefile.am: removed the "truly ugly hack"...

View file

@ -1689,10 +1689,8 @@ undo_pop_layer (GimpImage *gimage,
/* record the current position */
lu->prev_position = gimp_image_get_layer_index (gimage, lu->layer);
/* if exists, set the previous layer */
/* (counterexample: result layer added after a merge op has no previous layer.) */
if(GIMP_IS_LAYER (lu->prev_layer))
/* if exists, set the previous layer */
if (lu->prev_layer)
gimp_image_set_active_layer (gimage, lu->prev_layer);
/* remove the layer */
@ -1868,7 +1866,7 @@ undo_pop_layer_mod (GimpImage *gimage,
GIMP_DRAWABLE (layer)->offset_x = offset_x;
GIMP_DRAWABLE (layer)->offset_y = offset_y;
if (layer->mask)
if (layer->mask)
{
GIMP_DRAWABLE (layer->mask)->offset_x = offset_x;
GIMP_DRAWABLE (layer->mask)->offset_y = offset_y;
@ -2309,11 +2307,9 @@ undo_pop_channel (GimpImage *gimage,
/* remove the channel */
gimp_container_remove (gimage->channels, GIMP_OBJECT (cu->channel));
/* if exists, set the previous channel */
if (cu->prev_channel)
{
/* set the previous channel */
gimp_image_set_active_channel (gimage, cu->prev_channel);
}
gimp_image_set_active_channel (gimage, cu->prev_channel);
/* update the area */
gimp_drawable_update (GIMP_DRAWABLE (cu->channel),
@ -2637,11 +2633,9 @@ undo_pop_vectors (GimpImage *gimage,
/* remove the vectors */
gimp_container_remove (gimage->vectors, GIMP_OBJECT (vu->vectors));
/* if exists, set the previous vectors */
if (vu->prev_vectors)
{
/* set the previous vectors */
gimp_image_set_active_vectors (gimage, vu->prev_vectors);
}
gimp_image_set_active_vectors (gimage, vu->prev_vectors);
}
else
{
@ -2982,8 +2976,8 @@ undo_push_fs_rigor (GimpImage *gimage,
return TRUE;
}
else
return FALSE;
return FALSE;
}
static gboolean
@ -3065,8 +3059,8 @@ undo_push_fs_relax (GimpImage *gimage,
return TRUE;
}
else
return FALSE;
return FALSE;
}
static gboolean
@ -3224,7 +3218,7 @@ undo_pop_transform (GimpImage *gimage,
/* If we're re-implementing the first transform, reactivate tool */
if (state == REDO && tt->original)
{
gimp_tool_control_activate(active_tool->control);
gimp_tool_control_activate (active_tool->control);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tt));
}
@ -3516,7 +3510,7 @@ undo_pop_parasite (GimpImage *gimage,
else
gimp_parasite_detach (gimage->gimp, data->name);
}
if (tmp)
gimp_parasite_free (tmp);

View file

@ -179,7 +179,7 @@ procedural_db_execute (Gimp *gimp,
if (list == NULL)
{
g_message (_("PDB calling error %s not found"), name);
return_args = g_new (Argument, 1);
return_args->arg_type = GIMP_PDB_STATUS;
return_args->value.pdb_int = GIMP_PDB_CALLING_ERROR;
@ -187,7 +187,7 @@ procedural_db_execute (Gimp *gimp,
return return_args;
}
while (list)
for (; list; list = g_list_next (list))
{
if ((procedure = (ProcRecord *) list->data) == NULL)
{
@ -199,7 +199,6 @@ procedural_db_execute (Gimp *gimp,
return return_args;
}
list = list->next;
/* check the arguments */
for (i = 0; i < procedure->num_args; i++)
@ -244,14 +243,22 @@ procedural_db_execute (Gimp *gimp,
(procedure->num_values > 0))
memset (&return_args[1], 0, sizeof (Argument) * procedure->num_values);
/* Check if the return value is a PDB_PASS_THROUGH,
in which case run the next procedure in the list */
if (return_args[0].value.pdb_int != GIMP_PDB_PASS_THROUGH)
break;
else if (list) /* Pass through,
destroy return values and run another procedure */
procedural_db_destroy_args (return_args, procedure->num_values);
if (return_args[0].value.pdb_int == GIMP_PDB_PASS_THROUGH)
{
/* If the return value is GIMP_PDB_PASS_THROUGH and there is
* a next procedure in the list, destroy the return values
* and run the next procedure.
*/
if (g_list_next (list))
procedural_db_destroy_args (return_args, procedure->num_values);
}
else
{
/* No GIMP_PDB_PASS_THROUGH, break out of the list of
* procedures and return the current return values.
*/
break;
}
}
return return_args;
@ -466,7 +473,7 @@ procedural_db_destroy_args (Argument *args,
}
void
procedural_db_set_data (Gimp *gimp,
procedural_db_set_data (Gimp *gimp,
const gchar *identifier,
gint32 bytes,
const guint8 *data)

View file

@ -179,7 +179,7 @@ procedural_db_execute (Gimp *gimp,
if (list == NULL)
{
g_message (_("PDB calling error %s not found"), name);
return_args = g_new (Argument, 1);
return_args->arg_type = GIMP_PDB_STATUS;
return_args->value.pdb_int = GIMP_PDB_CALLING_ERROR;
@ -187,7 +187,7 @@ procedural_db_execute (Gimp *gimp,
return return_args;
}
while (list)
for (; list; list = g_list_next (list))
{
if ((procedure = (ProcRecord *) list->data) == NULL)
{
@ -199,7 +199,6 @@ procedural_db_execute (Gimp *gimp,
return return_args;
}
list = list->next;
/* check the arguments */
for (i = 0; i < procedure->num_args; i++)
@ -244,14 +243,22 @@ procedural_db_execute (Gimp *gimp,
(procedure->num_values > 0))
memset (&return_args[1], 0, sizeof (Argument) * procedure->num_values);
/* Check if the return value is a PDB_PASS_THROUGH,
in which case run the next procedure in the list */
if (return_args[0].value.pdb_int != GIMP_PDB_PASS_THROUGH)
break;
else if (list) /* Pass through,
destroy return values and run another procedure */
procedural_db_destroy_args (return_args, procedure->num_values);
if (return_args[0].value.pdb_int == GIMP_PDB_PASS_THROUGH)
{
/* If the return value is GIMP_PDB_PASS_THROUGH and there is
* a next procedure in the list, destroy the return values
* and run the next procedure.
*/
if (g_list_next (list))
procedural_db_destroy_args (return_args, procedure->num_values);
}
else
{
/* No GIMP_PDB_PASS_THROUGH, break out of the list of
* procedures and return the current return values.
*/
break;
}
}
return return_args;
@ -466,7 +473,7 @@ procedural_db_destroy_args (Argument *args,
}
void
procedural_db_set_data (Gimp *gimp,
procedural_db_set_data (Gimp *gimp,
const gchar *identifier,
gint32 bytes,
const guint8 *data)

View file

@ -179,7 +179,7 @@ procedural_db_execute (Gimp *gimp,
if (list == NULL)
{
g_message (_("PDB calling error %s not found"), name);
return_args = g_new (Argument, 1);
return_args->arg_type = GIMP_PDB_STATUS;
return_args->value.pdb_int = GIMP_PDB_CALLING_ERROR;
@ -187,7 +187,7 @@ procedural_db_execute (Gimp *gimp,
return return_args;
}
while (list)
for (; list; list = g_list_next (list))
{
if ((procedure = (ProcRecord *) list->data) == NULL)
{
@ -199,7 +199,6 @@ procedural_db_execute (Gimp *gimp,
return return_args;
}
list = list->next;
/* check the arguments */
for (i = 0; i < procedure->num_args; i++)
@ -244,14 +243,22 @@ procedural_db_execute (Gimp *gimp,
(procedure->num_values > 0))
memset (&return_args[1], 0, sizeof (Argument) * procedure->num_values);
/* Check if the return value is a PDB_PASS_THROUGH,
in which case run the next procedure in the list */
if (return_args[0].value.pdb_int != GIMP_PDB_PASS_THROUGH)
break;
else if (list) /* Pass through,
destroy return values and run another procedure */
procedural_db_destroy_args (return_args, procedure->num_values);
if (return_args[0].value.pdb_int == GIMP_PDB_PASS_THROUGH)
{
/* If the return value is GIMP_PDB_PASS_THROUGH and there is
* a next procedure in the list, destroy the return values
* and run the next procedure.
*/
if (g_list_next (list))
procedural_db_destroy_args (return_args, procedure->num_values);
}
else
{
/* No GIMP_PDB_PASS_THROUGH, break out of the list of
* procedures and return the current return values.
*/
break;
}
}
return return_args;
@ -466,7 +473,7 @@ procedural_db_destroy_args (Argument *args,
}
void
procedural_db_set_data (Gimp *gimp,
procedural_db_set_data (Gimp *gimp,
const gchar *identifier,
gint32 bytes,
const guint8 *data)

View file

@ -179,7 +179,7 @@ procedural_db_execute (Gimp *gimp,
if (list == NULL)
{
g_message (_("PDB calling error %s not found"), name);
return_args = g_new (Argument, 1);
return_args->arg_type = GIMP_PDB_STATUS;
return_args->value.pdb_int = GIMP_PDB_CALLING_ERROR;
@ -187,7 +187,7 @@ procedural_db_execute (Gimp *gimp,
return return_args;
}
while (list)
for (; list; list = g_list_next (list))
{
if ((procedure = (ProcRecord *) list->data) == NULL)
{
@ -199,7 +199,6 @@ procedural_db_execute (Gimp *gimp,
return return_args;
}
list = list->next;
/* check the arguments */
for (i = 0; i < procedure->num_args; i++)
@ -244,14 +243,22 @@ procedural_db_execute (Gimp *gimp,
(procedure->num_values > 0))
memset (&return_args[1], 0, sizeof (Argument) * procedure->num_values);
/* Check if the return value is a PDB_PASS_THROUGH,
in which case run the next procedure in the list */
if (return_args[0].value.pdb_int != GIMP_PDB_PASS_THROUGH)
break;
else if (list) /* Pass through,
destroy return values and run another procedure */
procedural_db_destroy_args (return_args, procedure->num_values);
if (return_args[0].value.pdb_int == GIMP_PDB_PASS_THROUGH)
{
/* If the return value is GIMP_PDB_PASS_THROUGH and there is
* a next procedure in the list, destroy the return values
* and run the next procedure.
*/
if (g_list_next (list))
procedural_db_destroy_args (return_args, procedure->num_values);
}
else
{
/* No GIMP_PDB_PASS_THROUGH, break out of the list of
* procedures and return the current return values.
*/
break;
}
}
return return_args;
@ -466,7 +473,7 @@ procedural_db_destroy_args (Argument *args,
}
void
procedural_db_set_data (Gimp *gimp,
procedural_db_set_data (Gimp *gimp,
const gchar *identifier,
gint32 bytes,
const guint8 *data)

View file

@ -1689,10 +1689,8 @@ undo_pop_layer (GimpImage *gimage,
/* record the current position */
lu->prev_position = gimp_image_get_layer_index (gimage, lu->layer);
/* if exists, set the previous layer */
/* (counterexample: result layer added after a merge op has no previous layer.) */
if(GIMP_IS_LAYER (lu->prev_layer))
/* if exists, set the previous layer */
if (lu->prev_layer)
gimp_image_set_active_layer (gimage, lu->prev_layer);
/* remove the layer */
@ -1868,7 +1866,7 @@ undo_pop_layer_mod (GimpImage *gimage,
GIMP_DRAWABLE (layer)->offset_x = offset_x;
GIMP_DRAWABLE (layer)->offset_y = offset_y;
if (layer->mask)
if (layer->mask)
{
GIMP_DRAWABLE (layer->mask)->offset_x = offset_x;
GIMP_DRAWABLE (layer->mask)->offset_y = offset_y;
@ -2309,11 +2307,9 @@ undo_pop_channel (GimpImage *gimage,
/* remove the channel */
gimp_container_remove (gimage->channels, GIMP_OBJECT (cu->channel));
/* if exists, set the previous channel */
if (cu->prev_channel)
{
/* set the previous channel */
gimp_image_set_active_channel (gimage, cu->prev_channel);
}
gimp_image_set_active_channel (gimage, cu->prev_channel);
/* update the area */
gimp_drawable_update (GIMP_DRAWABLE (cu->channel),
@ -2637,11 +2633,9 @@ undo_pop_vectors (GimpImage *gimage,
/* remove the vectors */
gimp_container_remove (gimage->vectors, GIMP_OBJECT (vu->vectors));
/* if exists, set the previous vectors */
if (vu->prev_vectors)
{
/* set the previous vectors */
gimp_image_set_active_vectors (gimage, vu->prev_vectors);
}
gimp_image_set_active_vectors (gimage, vu->prev_vectors);
}
else
{
@ -2982,8 +2976,8 @@ undo_push_fs_rigor (GimpImage *gimage,
return TRUE;
}
else
return FALSE;
return FALSE;
}
static gboolean
@ -3065,8 +3059,8 @@ undo_push_fs_relax (GimpImage *gimage,
return TRUE;
}
else
return FALSE;
return FALSE;
}
static gboolean
@ -3224,7 +3218,7 @@ undo_pop_transform (GimpImage *gimage,
/* If we're re-implementing the first transform, reactivate tool */
if (state == REDO && tt->original)
{
gimp_tool_control_activate(active_tool->control);
gimp_tool_control_activate (active_tool->control);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tt));
}
@ -3516,7 +3510,7 @@ undo_pop_parasite (GimpImage *gimage,
else
gimp_parasite_detach (gimage->gimp, data->name);
}
if (tmp)
gimp_parasite_free (tmp);