removed some nonfunctional code.

* app/edit_selection.c: removed some nonfunctional code.

	* app/paint_core.c: remove the alt toggles perfectmouse behaviour.

	* app/paintbrush.c: when ctl (or alt) is held set the fg (or bg) color.

	* app/gimpparasite.[ch]: made char *name parameters const.

	* app/parasitelist.c: removed unused static variable.

	* app/gimpdrawable.c, app/gimpimage.c, app/undo.[ch]: added
 	support for undoing parasite changes.

	* libgimp/gimp.h, libgimp/gimpimage.c: added
 	gimp_undo_push_group_start and gimp_undo_push_group_end

	* libgimp/parasite.[ch]: added undoable flag.

	* plug-ins/gdyntext/font_selection.c: fixed c++ style comment.

	* plug-ins/gdyntext/gdyntext.c: use the new undoable parasites.

	* plug-ins/rcm/rcm_misc.c: arctg can't be inline because it is
 	used in other .c files

	* plug-ins/waterselect/waterselect.c,
	* plug-ins/rotators/rotators.c, app/tips_dialog.c, app/plug_in.c:
 	fixed some warnings
This commit is contained in:
jaycox 1999-04-23 06:07:09 +00:00
parent 174e1a0fab
commit d996031ab0
68 changed files with 850 additions and 188 deletions

View File

@ -1,3 +1,34 @@
1999-04-22 Jay Cox <jaycox@earthlink.net>
* app/edit_selection.c: removed some nonfunctional code.
* app/paint_core.c: remove the alt toggles perfectmouse behaviour.
* app/paintbrush.c: when ctl (or alt) is held set the fg (or bg) color.
* app/gimpparasite.[ch]: made char *name parameters const.
* app/parasitelist.c: removed unused static variable.
* app/gimpdrawable.c, app/gimpimage.c, app/undo.[ch]: added
support for undoing parasite changes.
* libgimp/gimp.h, libgimp/gimpimage.c: added
gimp_undo_push_group_start and gimp_undo_push_group_end
* libgimp/parasite.[ch]: added undoable flag.
* plug-ins/gdyntext/font_selection.c: fixed c++ style comment.
* plug-ins/gdyntext/gdyntext.c: use the new undoable parasites.
* plug-ins/rcm/rcm_misc.c: arctg can't be inline because it is
used in other .c files
* plug-ins/waterselect/waterselect.c,
* plug-ins/rotators/rotators.c, app/tips_dialog.c, app/plug_in.c:
fixed some warnings
Fri Apr 23 01:31:29 MEST 1999 Sven Neumann <sven@gimp.org>
* app/crop.c: autocrop used to miss the bottom line

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -42,13 +42,13 @@ gimp_attach_parasite (Parasite *p)
}
void
gimp_detach_parasite (char *name)
gimp_detach_parasite (const char *name)
{
parasite_list_remove(parasites, name);
}
Parasite *
gimp_find_parasite (char *name)
gimp_find_parasite (const char *name)
{
return parasite_list_find(parasites, name);
}

View File

@ -22,8 +22,8 @@
void gimp_init_parasites (void);
void gimp_attach_parasite (Parasite *p);
void gimp_detach_parasite (char *name);
Parasite * gimp_find_parasite (char *name);
void gimp_detach_parasite (const char *name);
Parasite * gimp_find_parasite (const char *name);
char ** gimp_parasite_list (gint *count);
void gimp_parasiterc_save (void);
void gimp_parasiterc_load (void);

View File

@ -444,10 +444,16 @@ gimp_drawable_parasite_list (GimpDrawable *drawable, gint *count)
void
gimp_drawable_attach_parasite (GimpDrawable *drawable, Parasite *parasite)
{
/* only set the dirty bit if we can be saved and the new parasite differs
from the current one */
if (parasite_is_persistent(parasite) &&
!parasite_compare(parasite, gimp_drawable_find_parasite(drawable,
/* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */
if (parasite_is_undoable(parasite))
{
undo_push_group_start(drawable->gimage); /* do a group in case we have
attach_parrent set */
undo_push_drawable_parasite (drawable->gimage, drawable, parasite);
}
else if (parasite_is_persistent(parasite) &&
!parasite_compare(parasite, gimp_drawable_find_parasite(drawable,
parasite_name(parasite))))
gimp_image_dirty(drawable->gimage);
parasite_list_add(drawable->parasites, parasite);
@ -462,6 +468,10 @@ gimp_drawable_attach_parasite (GimpDrawable *drawable, Parasite *parasite)
parasite_shift_parent(parasite);
gimp_attach_parasite(parasite);
}
if (parasite_is_undoable(parasite))
{
undo_push_group_end(drawable->gimage);
}
}
void
@ -470,7 +480,10 @@ gimp_drawable_detach_parasite (GimpDrawable *drawable, const char *parasite)
Parasite *p;
if (!(p = parasite_list_find(drawable->parasites, parasite)))
return;
if (parasite_is_persistent(p))
if (parasite_is_undoable(p))
undo_push_drawable_parasite_remove (drawable->gimage, drawable,
parasite_name(p));
else if (parasite_is_persistent(p))
gimp_image_dirty(drawable->gimage);
parasite_list_remove(drawable->parasites, parasite);
}

View File

@ -994,8 +994,10 @@ gimp_image_parasite_list (GimpImage *image, gint *count)
void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{
/* only set the dirty bit if we can be saved and the new parasite differs
from the current one */
/* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */
if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite)
&& !parasite_compare(parasite, gimp_image_find_parasite(gimage,
parasite_name(parasite))))
@ -1014,7 +1016,9 @@ gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite)))
return;
if (parasite_is_persistent(p))
if (parasite_is_undoable(p))
undo_push_image_parasite_remove (gimage, parasite_name(p));
else if (parasite_is_persistent(p))
gimp_image_dirty(gimage);
parasite_list_remove(gimage->parasites, parasite);
}

View File

@ -994,8 +994,10 @@ gimp_image_parasite_list (GimpImage *image, gint *count)
void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{
/* only set the dirty bit if we can be saved and the new parasite differs
from the current one */
/* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */
if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite)
&& !parasite_compare(parasite, gimp_image_find_parasite(gimage,
parasite_name(parasite))))
@ -1014,7 +1016,9 @@ gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite)))
return;
if (parasite_is_persistent(p))
if (parasite_is_undoable(p))
undo_push_image_parasite_remove (gimage, parasite_name(p));
else if (parasite_is_persistent(p))
gimp_image_dirty(gimage);
parasite_list_remove(gimage->parasites, parasite);
}

View File

@ -994,8 +994,10 @@ gimp_image_parasite_list (GimpImage *image, gint *count)
void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{
/* only set the dirty bit if we can be saved and the new parasite differs
from the current one */
/* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */
if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite)
&& !parasite_compare(parasite, gimp_image_find_parasite(gimage,
parasite_name(parasite))))
@ -1014,7 +1016,9 @@ gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite)))
return;
if (parasite_is_persistent(p))
if (parasite_is_undoable(p))
undo_push_image_parasite_remove (gimage, parasite_name(p));
else if (parasite_is_persistent(p))
gimp_image_dirty(gimage);
parasite_list_remove(gimage->parasites, parasite);
}

View File

@ -994,8 +994,10 @@ gimp_image_parasite_list (GimpImage *image, gint *count)
void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{
/* only set the dirty bit if we can be saved and the new parasite differs
from the current one */
/* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */
if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite)
&& !parasite_compare(parasite, gimp_image_find_parasite(gimage,
parasite_name(parasite))))
@ -1014,7 +1016,9 @@ gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite)))
return;
if (parasite_is_persistent(p))
if (parasite_is_undoable(p))
undo_push_image_parasite_remove (gimage, parasite_name(p));
else if (parasite_is_persistent(p))
gimp_image_dirty(gimage);
parasite_list_remove(gimage->parasites, parasite);
}

View File

@ -994,8 +994,10 @@ gimp_image_parasite_list (GimpImage *image, gint *count)
void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{
/* only set the dirty bit if we can be saved and the new parasite differs
from the current one */
/* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */
if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite)
&& !parasite_compare(parasite, gimp_image_find_parasite(gimage,
parasite_name(parasite))))
@ -1014,7 +1016,9 @@ gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite)))
return;
if (parasite_is_persistent(p))
if (parasite_is_undoable(p))
undo_push_image_parasite_remove (gimage, parasite_name(p));
else if (parasite_is_persistent(p))
gimp_image_dirty(gimage);
parasite_list_remove(gimage->parasites, parasite);
}

View File

@ -41,6 +41,9 @@
#include "tile_manager_pvt.h"
#include "tile.h" /* ick. */
#include "libgimp/parasite.h"
#include "gimpparasite.h"
typedef int (* UndoPopFunc) (GImage *, int, int, void *);
@ -75,6 +78,7 @@ int undo_pop_fs_rigor (GImage *, int, int, void *);
int undo_pop_fs_relax (GImage *, int, int, void *);
int undo_pop_gimage_mod (GImage *, int, int, void *);
int undo_pop_guide (GImage *, int, int, void *);
int undo_pop_parasite (GImage *, int, int, void *);
/* Free functions */
@ -93,6 +97,8 @@ void undo_free_fs_rigor (int, void *);
void undo_free_fs_relax (int, void *);
void undo_free_gimage_mod (int, void *);
void undo_free_guide (int, void *);
void undo_free_parasite (int, void *);
/* Sizing functions */
@ -2099,3 +2105,219 @@ undo_free_guide (int state,
g_free (data_ptr);
}
/************/
/* Parasite */
typedef struct _ParasiteUndo ParasiteUndo;
struct _ParasiteUndo
{
GImage *gimage;
GimpDrawable *drawable;
Parasite *parasite;
char *name;
};
int
undo_push_image_parasite (GImage *gimage,
void *parasite)
{
Undo *new;
ParasiteUndo *data;
long size;
/* increment the dirty flag for this gimage */
gimage_dirty (gimage);
size = sizeof (ParasiteUndo);
if ((new = undo_push (gimage, size, GIMAGE_MOD)))
{
data = g_new (ParasiteUndo, 1);
new->data = data;
new->pop_func = undo_pop_parasite;
new->free_func = undo_free_parasite;
data->gimage = gimage;
data->drawable = NULL;
data->name = g_strdup(parasite_name(parasite));
data->parasite = parasite_copy(gimp_image_find_parasite(gimage, data->name));
return TRUE;
}
return FALSE;
}
int
undo_push_image_parasite_remove (GImage *gimage,
const char *name)
{
Undo *new;
ParasiteUndo *data;
long size;
/* increment the dirty flag for this gimage */
gimage_dirty (gimage);
size = sizeof (ParasiteUndo);
if ((new = undo_push (gimage, size, GIMAGE_MOD)))
{
data = g_new (ParasiteUndo, 1);
new->data = data;
new->pop_func = undo_pop_parasite;
new->free_func = undo_free_parasite;
data->gimage = gimage;
data->drawable = NULL;
data->name = g_strdup(name);
data->parasite = parasite_copy(gimp_image_find_parasite(gimage, data->name));
return TRUE;
}
return FALSE;
}
int
undo_push_drawable_parasite (GImage *gimage,
GimpDrawable *drawable,
void *parasite)
{
Undo *new;
ParasiteUndo *data;
long size;
/* increment the dirty flag for this gimage */
gimage_dirty (gimage);
size = sizeof (ParasiteUndo);
if ((new = undo_push (gimage, size, GIMAGE_MOD)))
{
data = g_new (ParasiteUndo, 1);
new->data = data;
new->pop_func = undo_pop_parasite;
new->free_func = undo_free_parasite;
data->gimage = NULL;
data->drawable = drawable;
data->name = g_strdup(parasite_name(parasite));
data->parasite = parasite_copy(gimp_drawable_find_parasite(drawable, data->name));
return TRUE;
}
return FALSE;
}
int
undo_push_drawable_parasite_remove (GImage *gimage,
GimpDrawable *drawable,
const char *name)
{
Undo *new;
ParasiteUndo *data;
long size;
/* increment the dirty flag for this gimage */
gimage_dirty (gimage);
size = sizeof (ParasiteUndo);
if ((new = undo_push (gimage, size, GIMAGE_MOD)))
{
data = g_new (ParasiteUndo, 1);
new->data = data;
new->pop_func = undo_pop_parasite;
new->free_func = undo_free_parasite;
data->gimage = NULL;
data->drawable = drawable;
data->name = g_strdup(name);
data->parasite = parasite_copy(gimp_drawable_find_parasite(drawable, data->name));
return TRUE;
}
return FALSE;
}
int
undo_pop_parasite (GImage *gimage,
int state,
int type,
void *data_ptr)
{
ParasiteUndo *data;
Parasite *tmp;
int tmp_ref;
data = data_ptr;
tmp = data->parasite;
if (data->gimage)
{
data->parasite = parasite_copy(gimp_image_find_parasite(gimage,
data->name));
if (tmp)
parasite_list_add(data->gimage->parasites, tmp);
else
parasite_list_remove(data->gimage->parasites, data->name);
}
else if (data->drawable)
{
data->parasite = parasite_copy(gimp_drawable_find_parasite(data->drawable,
data->name));
if (tmp)
parasite_list_add(data->drawable->parasites, tmp);
else
parasite_list_remove(data->drawable->parasites, data->name);
}
else
{
data->parasite = parasite_copy(gimp_find_parasite(data->name));
if (tmp)
gimp_attach_parasite(tmp);
else
gimp_detach_parasite(data->name);
}
if (tmp)
parasite_free(tmp);
/* if ((tmp && parasite_is_persistant(tmp)) || */
/* (data->parasite && parasite_is_persistant(data->parasite))) */
switch (state)
{
case UNDO:
gimage_clean (gimage);
break;
case REDO:
gimage_dirty (gimage);
break;
}
return TRUE;
}
void
undo_free_parasite (int state,
void *data_ptr)
{
ParasiteUndo *data;
data = data_ptr;
if (data->parasite)
parasite_free (data->parasite);
if (data->name)
g_free (data->name);
g_free (data_ptr);
}

View File

@ -79,6 +79,11 @@ int undo_push_fs_rigor (GImage *, int);
int undo_push_fs_relax (GImage *, int);
int undo_push_gimage_mod (GImage *);
int undo_push_guide (GImage *, void *);
int undo_push_image_parasite (GImage *, void *);
int undo_push_drawable_parasite (GImage *, GimpDrawable *, void *);
int undo_push_image_parasite_remove (GImage *, const char *);
int undo_push_drawable_parasite_remove (GImage *, GimpDrawable *,
const char *);
int undo_pop (GImage *);
int undo_redo (GImage *);

View File

@ -994,8 +994,10 @@ gimp_image_parasite_list (GimpImage *image, gint *count)
void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{
/* only set the dirty bit if we can be saved and the new parasite differs
from the current one */
/* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */
if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite)
&& !parasite_compare(parasite, gimp_image_find_parasite(gimage,
parasite_name(parasite))))
@ -1014,7 +1016,9 @@ gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite)))
return;
if (parasite_is_persistent(p))
if (parasite_is_undoable(p))
undo_push_image_parasite_remove (gimage, parasite_name(p));
else if (parasite_is_persistent(p))
gimp_image_dirty(gimage);
parasite_list_remove(gimage->parasites, parasite);
}

View File

@ -42,13 +42,13 @@ gimp_attach_parasite (Parasite *p)
}
void
gimp_detach_parasite (char *name)
gimp_detach_parasite (const char *name)
{
parasite_list_remove(parasites, name);
}
Parasite *
gimp_find_parasite (char *name)
gimp_find_parasite (const char *name)
{
return parasite_list_find(parasites, name);
}

View File

@ -22,8 +22,8 @@
void gimp_init_parasites (void);
void gimp_attach_parasite (Parasite *p);
void gimp_detach_parasite (char *name);
Parasite * gimp_find_parasite (char *name);
void gimp_detach_parasite (const char *name);
Parasite * gimp_find_parasite (const char *name);
char ** gimp_parasite_list (gint *count);
void gimp_parasiterc_save (void);
void gimp_parasiterc_load (void);

View File

@ -214,8 +214,6 @@ parasite_list_find(ParasiteList *list, const char *name)
return NULL;
}
static int saved_bytes;
void
parasite_shift_parent(Parasite *p)
{

View File

@ -994,8 +994,10 @@ gimp_image_parasite_list (GimpImage *image, gint *count)
void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{
/* only set the dirty bit if we can be saved and the new parasite differs
from the current one */
/* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */
if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite)
&& !parasite_compare(parasite, gimp_image_find_parasite(gimage,
parasite_name(parasite))))
@ -1014,7 +1016,9 @@ gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite)))
return;
if (parasite_is_persistent(p))
if (parasite_is_undoable(p))
undo_push_image_parasite_remove (gimage, parasite_name(p));
else if (parasite_is_persistent(p))
gimp_image_dirty(gimage);
parasite_list_remove(gimage->parasites, parasite);
}

View File

@ -43,6 +43,7 @@ tips_dialog_create ()
GtkWidget *vbox_check;
GtkWidget *button_check;
gchar * temp;
guchar * utemp;
guchar * src;
guchar * dest;
int x;
@ -98,20 +99,20 @@ tips_dialog_create ()
preview = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_preview_size (GTK_PREVIEW (preview), wilber_width, wilber_height);
temp = g_malloc (wilber_width * 3);
utemp = g_new (guchar, wilber_width * 3);
src = (guchar *)wilber_data;
for (y = 0; y < wilber_height; y++)
{
dest = temp;
dest = utemp;
for (x = 0; x < wilber_width; x++)
{
HEADER_PIXEL(src, dest);
dest += 3;
}
gtk_preview_draw_row (GTK_PREVIEW (preview), temp,
gtk_preview_draw_row (GTK_PREVIEW (preview), utemp,
0, y, wilber_width);
}
g_free(temp);
g_free(utemp);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_end (GTK_BOX (hbox1), frame, FALSE, TRUE, 3);

View File

@ -513,11 +513,6 @@ edit_selection_draw (Tool *tool)
break;
case MaskToLayerTranslate:
if (diff_x < 0)
{
x1 = x1 + 1;
x1 --;
}
gdisplay_transform_coords (gdisp, edit_select.x1, edit_select.y1, &x1, &y1, TRUE);
gdisplay_transform_coords (gdisp, edit_select.x2, edit_select.y2, &x2, &y2, TRUE);
gdk_draw_rectangle (edit_select.core->win,

View File

@ -444,10 +444,16 @@ gimp_drawable_parasite_list (GimpDrawable *drawable, gint *count)
void
gimp_drawable_attach_parasite (GimpDrawable *drawable, Parasite *parasite)
{
/* only set the dirty bit if we can be saved and the new parasite differs
from the current one */
if (parasite_is_persistent(parasite) &&
!parasite_compare(parasite, gimp_drawable_find_parasite(drawable,
/* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */
if (parasite_is_undoable(parasite))
{
undo_push_group_start(drawable->gimage); /* do a group in case we have
attach_parrent set */
undo_push_drawable_parasite (drawable->gimage, drawable, parasite);
}
else if (parasite_is_persistent(parasite) &&
!parasite_compare(parasite, gimp_drawable_find_parasite(drawable,
parasite_name(parasite))))
gimp_image_dirty(drawable->gimage);
parasite_list_add(drawable->parasites, parasite);
@ -462,6 +468,10 @@ gimp_drawable_attach_parasite (GimpDrawable *drawable, Parasite *parasite)
parasite_shift_parent(parasite);
gimp_attach_parasite(parasite);
}
if (parasite_is_undoable(parasite))
{
undo_push_group_end(drawable->gimage);
}
}
void
@ -470,7 +480,10 @@ gimp_drawable_detach_parasite (GimpDrawable *drawable, const char *parasite)
Parasite *p;
if (!(p = parasite_list_find(drawable->parasites, parasite)))
return;
if (parasite_is_persistent(p))
if (parasite_is_undoable(p))
undo_push_drawable_parasite_remove (drawable->gimage, drawable,
parasite_name(p));
else if (parasite_is_persistent(p))
gimp_image_dirty(drawable->gimage);
parasite_list_remove(drawable->parasites, parasite);
}

View File

@ -994,8 +994,10 @@ gimp_image_parasite_list (GimpImage *image, gint *count)
void
gimp_image_attach_parasite (GimpImage *gimage, Parasite *parasite)
{
/* only set the dirty bit if we can be saved and the new parasite differs
from the current one */
/* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */
if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite)
&& !parasite_compare(parasite, gimp_image_find_parasite(gimage,
parasite_name(parasite))))
@ -1014,7 +1016,9 @@ gimp_image_detach_parasite (GimpImage *gimage, const char *parasite)
Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite)))
return;
if (parasite_is_persistent(p))
if (parasite_is_undoable(p))
undo_push_image_parasite_remove (gimage, parasite_name(p));
else if (parasite_is_persistent(p))
gimp_image_dirty(gimage);
parasite_list_remove(gimage->parasites, parasite);
}

View File

@ -42,13 +42,13 @@ gimp_attach_parasite (Parasite *p)
}
void
gimp_detach_parasite (char *name)
gimp_detach_parasite (const char *name)
{
parasite_list_remove(parasites, name);
}
Parasite *
gimp_find_parasite (char *name)
gimp_find_parasite (const char *name)
{
return parasite_list_find(parasites, name);
}

View File

@ -22,8 +22,8 @@
void gimp_init_parasites (void);
void gimp_attach_parasite (Parasite *p);
void gimp_detach_parasite (char *name);
Parasite * gimp_find_parasite (char *name);
void gimp_detach_parasite (const char *name);
Parasite * gimp_find_parasite (const char *name);
char ** gimp_parasite_list (gint *count);
void gimp_parasiterc_save (void);
void gimp_parasiterc_load (void);

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -43,6 +43,7 @@ tips_dialog_create ()
GtkWidget *vbox_check;
GtkWidget *button_check;
gchar * temp;
guchar * utemp;
guchar * src;
guchar * dest;
int x;
@ -98,20 +99,20 @@ tips_dialog_create ()
preview = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_preview_size (GTK_PREVIEW (preview), wilber_width, wilber_height);
temp = g_malloc (wilber_width * 3);
utemp = g_new (guchar, wilber_width * 3);
src = (guchar *)wilber_data;
for (y = 0; y < wilber_height; y++)
{
dest = temp;
dest = utemp;
for (x = 0; x < wilber_width; x++)
{
HEADER_PIXEL(src, dest);
dest += 3;
}
gtk_preview_draw_row (GTK_PREVIEW (preview), temp,
gtk_preview_draw_row (GTK_PREVIEW (preview), utemp,
0, y, wilber_width);
}
g_free(temp);
g_free(utemp);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_end (GTK_BOX (hbox1), frame, FALSE, TRUE, 3);

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -187,7 +187,7 @@ paint_core_button_press (tool, bevent, gdisp_ptr)
gdisplays_selection_visibility (gdisp->gimage, SelectionPause);
/* add motion memory if you press mod1 first ^ perfectmouse */
if (((bevent->state & GDK_MOD1_MASK) != 0) != (perfectmouse != 0))
if (perfectmouse == 0)
gdk_pointer_grab (gdisp->canvas->window, FALSE,
GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);

View File

@ -279,21 +279,15 @@ paintbrush_options_new (void)
return options;
}
#define USE_SPEEDSHOP_CALIPERS 0
#define TIMED_BRUSH 0
#if USE_SPEEDSHOP_CALIPERS
#include <SpeedShop/api.h>
#endif
void *
paintbrush_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
{
#if TIMED_BRUSH
static GTimer *timer;
static GTimer *timer = NULL;
#endif
switch (state)
{
@ -301,29 +295,58 @@ paintbrush_paint_func (PaintCore *paint_core,
#if TIMED_BRUSH
timer = g_timer_new();
g_timer_start(timer);
#if USE_SPEEDSHOP_CALIPERS
ssrt_caliper_point(0, "Painting");
#endif /* USE_SPEEDSHOP_CALIPERS */
#endif /* TIMED_BRUSH */
if ((paint_core->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
{
unsigned char *color;
if ((color = gimp_drawable_get_color_at(drawable, paint_core->curx,
paint_core->cury)))
{
if ((paint_core->state & GDK_CONTROL_MASK))
palette_set_foreground (color[RED_PIX], color[GREEN_PIX],
color [BLUE_PIX]);
else
palette_set_background (color[RED_PIX], color[GREEN_PIX],
color [BLUE_PIX]);
g_free(color);
}
}
break;
case MOTION_PAINT :
paintbrush_motion (paint_core, drawable,
paintbrush_options->fade_out,
paintbrush_options->use_gradient ?
exp(paintbrush_options->gradient_length/10) : 0,
paintbrush_options->incremental,
paintbrush_options->gradient_type);
if ((paint_core->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
{
unsigned char *color;
if ((color = gimp_drawable_get_color_at(drawable, paint_core->curx,
paint_core->cury)))
{
if ((paint_core->state & GDK_CONTROL_MASK))
palette_set_foreground (color[RED_PIX], color[GREEN_PIX],
color [BLUE_PIX]);
else
palette_set_background (color[RED_PIX], color[GREEN_PIX],
color [BLUE_PIX]);
g_free(color);
}
}
else
paintbrush_motion (paint_core, drawable,
paintbrush_options->fade_out,
paintbrush_options->use_gradient ?
exp(paintbrush_options->gradient_length/10) : 0,
paintbrush_options->incremental,
paintbrush_options->gradient_type);
break;
case FINISH_PAINT :
#if TIMED_BRUSH
#if USE_SPEEDSHOP_CALIPERS
ssrt_caliper_point(0, "Not Painting Anymore");
#endif /* USE_SPEEDSHOP_CALIPERS */
g_timer_stop(timer);
printf("painting took %f:\n", g_timer_elapsed(timer, NULL));
g_timer_destroy(timer);
if (timer)
{
g_timer_stop(timer);
printf("painting took %f:\n", g_timer_elapsed(timer, NULL));
g_timer_destroy(timer);
timer = NULL;
}
#endif /* TIMED_BRUSH */
break;
@ -459,16 +482,16 @@ paintbrush_non_gui_paint_func (PaintCore *paint_core,
gboolean
paintbrush_non_gui (GimpDrawable *drawable,
int num_strokes,
double *stroke_array,
double fade_out,
int method,
double gradient_length)
int num_strokes,
double *stroke_array,
double fade_out,
int method,
double gradient_length)
{
int i;
if (paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]))
stroke_array[0], stroke_array[1]))
{
non_gui_fade_out = fade_out;
non_gui_gradient_length = gradient_length;
@ -482,18 +505,18 @@ paintbrush_non_gui (GimpDrawable *drawable,
non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1];
if (num_strokes == 1)
paintbrush_non_gui_paint_func (&non_gui_paint_core, drawable, 0);
paintbrush_non_gui_paint_func (&non_gui_paint_core, drawable, 0);
for (i = 1; i < num_strokes; i++)
{
non_gui_paint_core.curx = stroke_array[i * 2 + 0];
non_gui_paint_core.cury = stroke_array[i * 2 + 1];
{
non_gui_paint_core.curx = stroke_array[i * 2 + 0];
non_gui_paint_core.cury = stroke_array[i * 2 + 1];
paint_core_interpolate (&non_gui_paint_core, drawable);
paint_core_interpolate (&non_gui_paint_core, drawable);
non_gui_paint_core.lastx = non_gui_paint_core.curx;
non_gui_paint_core.lasty = non_gui_paint_core.cury;
}
non_gui_paint_core.lastx = non_gui_paint_core.curx;
non_gui_paint_core.lasty = non_gui_paint_core.cury;
}
/* Finish the painting */
paint_core_finish (&non_gui_paint_core, drawable, -1);

View File

@ -214,8 +214,6 @@ parasite_list_find(ParasiteList *list, const char *name)
return NULL;
}
static int saved_bytes;
void
parasite_shift_parent(Parasite *p)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{

View File

@ -43,6 +43,7 @@ tips_dialog_create ()
GtkWidget *vbox_check;
GtkWidget *button_check;
gchar * temp;
guchar * utemp;
guchar * src;
guchar * dest;
int x;
@ -98,20 +99,20 @@ tips_dialog_create ()
preview = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_preview_size (GTK_PREVIEW (preview), wilber_width, wilber_height);
temp = g_malloc (wilber_width * 3);
utemp = g_new (guchar, wilber_width * 3);
src = (guchar *)wilber_data;
for (y = 0; y < wilber_height; y++)
{
dest = temp;
dest = utemp;
for (x = 0; x < wilber_width; x++)
{
HEADER_PIXEL(src, dest);
dest += 3;
}
gtk_preview_draw_row (GTK_PREVIEW (preview), temp,
gtk_preview_draw_row (GTK_PREVIEW (preview), utemp,
0, y, wilber_width);
}
g_free(temp);
g_free(utemp);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_end (GTK_BOX (hbox1), frame, FALSE, TRUE, 3);

View File

@ -513,11 +513,6 @@ edit_selection_draw (Tool *tool)
break;
case MaskToLayerTranslate:
if (diff_x < 0)
{
x1 = x1 + 1;
x1 --;
}
gdisplay_transform_coords (gdisp, edit_select.x1, edit_select.y1, &x1, &y1, TRUE);
gdisplay_transform_coords (gdisp, edit_select.x2, edit_select.y2, &x2, &y2, TRUE);
gdk_draw_rectangle (edit_select.core->win,

View File

@ -513,11 +513,6 @@ edit_selection_draw (Tool *tool)
break;
case MaskToLayerTranslate:
if (diff_x < 0)
{
x1 = x1 + 1;
x1 --;
}
gdisplay_transform_coords (gdisp, edit_select.x1, edit_select.y1, &x1, &y1, TRUE);
gdisplay_transform_coords (gdisp, edit_select.x2, edit_select.y2, &x2, &y2, TRUE);
gdk_draw_rectangle (edit_select.core->win,

View File

@ -187,7 +187,7 @@ paint_core_button_press (tool, bevent, gdisp_ptr)
gdisplays_selection_visibility (gdisp->gimage, SelectionPause);
/* add motion memory if you press mod1 first ^ perfectmouse */
if (((bevent->state & GDK_MOD1_MASK) != 0) != (perfectmouse != 0))
if (perfectmouse == 0)
gdk_pointer_grab (gdisp->canvas->window, FALSE,
GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);

View File

@ -279,21 +279,15 @@ paintbrush_options_new (void)
return options;
}
#define USE_SPEEDSHOP_CALIPERS 0
#define TIMED_BRUSH 0
#if USE_SPEEDSHOP_CALIPERS
#include <SpeedShop/api.h>
#endif
void *
paintbrush_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
{
#if TIMED_BRUSH
static GTimer *timer;
static GTimer *timer = NULL;
#endif
switch (state)
{
@ -301,29 +295,58 @@ paintbrush_paint_func (PaintCore *paint_core,
#if TIMED_BRUSH
timer = g_timer_new();
g_timer_start(timer);
#if USE_SPEEDSHOP_CALIPERS
ssrt_caliper_point(0, "Painting");
#endif /* USE_SPEEDSHOP_CALIPERS */
#endif /* TIMED_BRUSH */
if ((paint_core->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
{
unsigned char *color;
if ((color = gimp_drawable_get_color_at(drawable, paint_core->curx,
paint_core->cury)))
{
if ((paint_core->state & GDK_CONTROL_MASK))
palette_set_foreground (color[RED_PIX], color[GREEN_PIX],
color [BLUE_PIX]);
else
palette_set_background (color[RED_PIX], color[GREEN_PIX],
color [BLUE_PIX]);
g_free(color);
}
}
break;
case MOTION_PAINT :
paintbrush_motion (paint_core, drawable,
paintbrush_options->fade_out,
paintbrush_options->use_gradient ?
exp(paintbrush_options->gradient_length/10) : 0,
paintbrush_options->incremental,
paintbrush_options->gradient_type);
if ((paint_core->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
{
unsigned char *color;
if ((color = gimp_drawable_get_color_at(drawable, paint_core->curx,
paint_core->cury)))
{
if ((paint_core->state & GDK_CONTROL_MASK))
palette_set_foreground (color[RED_PIX], color[GREEN_PIX],
color [BLUE_PIX]);
else
palette_set_background (color[RED_PIX], color[GREEN_PIX],
color [BLUE_PIX]);
g_free(color);
}
}
else
paintbrush_motion (paint_core, drawable,
paintbrush_options->fade_out,
paintbrush_options->use_gradient ?
exp(paintbrush_options->gradient_length/10) : 0,
paintbrush_options->incremental,
paintbrush_options->gradient_type);
break;
case FINISH_PAINT :
#if TIMED_BRUSH
#if USE_SPEEDSHOP_CALIPERS
ssrt_caliper_point(0, "Not Painting Anymore");
#endif /* USE_SPEEDSHOP_CALIPERS */
g_timer_stop(timer);
printf("painting took %f:\n", g_timer_elapsed(timer, NULL));
g_timer_destroy(timer);
if (timer)
{
g_timer_stop(timer);
printf("painting took %f:\n", g_timer_elapsed(timer, NULL));
g_timer_destroy(timer);
timer = NULL;
}
#endif /* TIMED_BRUSH */
break;
@ -459,16 +482,16 @@ paintbrush_non_gui_paint_func (PaintCore *paint_core,
gboolean
paintbrush_non_gui (GimpDrawable *drawable,
int num_strokes,
double *stroke_array,
double fade_out,
int method,
double gradient_length)
int num_strokes,
double *stroke_array,
double fade_out,
int method,
double gradient_length)
{
int i;
if (paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]))
stroke_array[0], stroke_array[1]))
{
non_gui_fade_out = fade_out;
non_gui_gradient_length = gradient_length;
@ -482,18 +505,18 @@ paintbrush_non_gui (GimpDrawable *drawable,
non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1];
if (num_strokes == 1)
paintbrush_non_gui_paint_func (&non_gui_paint_core, drawable, 0);
paintbrush_non_gui_paint_func (&non_gui_paint_core, drawable, 0);
for (i = 1; i < num_strokes; i++)
{
non_gui_paint_core.curx = stroke_array[i * 2 + 0];
non_gui_paint_core.cury = stroke_array[i * 2 + 1];
{
non_gui_paint_core.curx = stroke_array[i * 2 + 0];
non_gui_paint_core.cury = stroke_array[i * 2 + 1];
paint_core_interpolate (&non_gui_paint_core, drawable);
paint_core_interpolate (&non_gui_paint_core, drawable);
non_gui_paint_core.lastx = non_gui_paint_core.curx;
non_gui_paint_core.lasty = non_gui_paint_core.cury;
}
non_gui_paint_core.lastx = non_gui_paint_core.curx;
non_gui_paint_core.lasty = non_gui_paint_core.cury;
}
/* Finish the painting */
paint_core_finish (&non_gui_paint_core, drawable, -1);

View File

@ -41,6 +41,9 @@
#include "tile_manager_pvt.h"
#include "tile.h" /* ick. */
#include "libgimp/parasite.h"
#include "gimpparasite.h"
typedef int (* UndoPopFunc) (GImage *, int, int, void *);
@ -75,6 +78,7 @@ int undo_pop_fs_rigor (GImage *, int, int, void *);
int undo_pop_fs_relax (GImage *, int, int, void *);
int undo_pop_gimage_mod (GImage *, int, int, void *);
int undo_pop_guide (GImage *, int, int, void *);
int undo_pop_parasite (GImage *, int, int, void *);
/* Free functions */
@ -93,6 +97,8 @@ void undo_free_fs_rigor (int, void *);
void undo_free_fs_relax (int, void *);
void undo_free_gimage_mod (int, void *);
void undo_free_guide (int, void *);
void undo_free_parasite (int, void *);
/* Sizing functions */
@ -2099,3 +2105,219 @@ undo_free_guide (int state,
g_free (data_ptr);
}
/************/
/* Parasite */
typedef struct _ParasiteUndo ParasiteUndo;
struct _ParasiteUndo
{
GImage *gimage;
GimpDrawable *drawable;
Parasite *parasite;
char *name;
};
int
undo_push_image_parasite (GImage *gimage,
void *parasite)
{
Undo *new;
ParasiteUndo *data;
long size;
/* increment the dirty flag for this gimage */
gimage_dirty (gimage);
size = sizeof (ParasiteUndo);
if ((new = undo_push (gimage, size, GIMAGE_MOD)))
{
data = g_new (ParasiteUndo, 1);
new->data = data;
new->pop_func = undo_pop_parasite;
new->free_func = undo_free_parasite;
data->gimage = gimage;
data->drawable = NULL;
data->name = g_strdup(parasite_name(parasite));
data->parasite = parasite_copy(gimp_image_find_parasite(gimage, data->name));
return TRUE;
}
return FALSE;
}
int
undo_push_image_parasite_remove (GImage *gimage,
const char *name)
{
Undo *new;
ParasiteUndo *data;
long size;
/* increment the dirty flag for this gimage */
gimage_dirty (gimage);
size = sizeof (ParasiteUndo);
if ((new = undo_push (gimage, size, GIMAGE_MOD)))
{
data = g_new (ParasiteUndo, 1);
new->data = data;
new->pop_func = undo_pop_parasite;
new->free_func = undo_free_parasite;
data->gimage = gimage;
data->drawable = NULL;
data->name = g_strdup(name);
data->parasite = parasite_copy(gimp_image_find_parasite(gimage, data->name));
return TRUE;
}
return FALSE;
}
int
undo_push_drawable_parasite (GImage *gimage,
GimpDrawable *drawable,
void *parasite)
{
Undo *new;
ParasiteUndo *data;
long size;
/* increment the dirty flag for this gimage */
gimage_dirty (gimage);
size = sizeof (ParasiteUndo);
if ((new = undo_push (gimage, size, GIMAGE_MOD)))
{
data = g_new (ParasiteUndo, 1);
new->data = data;
new->pop_func = undo_pop_parasite;
new->free_func = undo_free_parasite;
data->gimage = NULL;
data->drawable = drawable;
data->name = g_strdup(parasite_name(parasite));
data->parasite = parasite_copy(gimp_drawable_find_parasite(drawable, data->name));
return TRUE;
}
return FALSE;
}
int
undo_push_drawable_parasite_remove (GImage *gimage,
GimpDrawable *drawable,
const char *name)
{
Undo *new;
ParasiteUndo *data;
long size;
/* increment the dirty flag for this gimage */
gimage_dirty (gimage);
size = sizeof (ParasiteUndo);
if ((new = undo_push (gimage, size, GIMAGE_MOD)))
{
data = g_new (ParasiteUndo, 1);
new->data = data;
new->pop_func = undo_pop_parasite;
new->free_func = undo_free_parasite;
data->gimage = NULL;
data->drawable = drawable;
data->name = g_strdup(name);
data->parasite = parasite_copy(gimp_drawable_find_parasite(drawable, data->name));
return TRUE;
}
return FALSE;
}
int
undo_pop_parasite (GImage *gimage,
int state,
int type,
void *data_ptr)
{
ParasiteUndo *data;
Parasite *tmp;
int tmp_ref;
data = data_ptr;
tmp = data->parasite;
if (data->gimage)
{
data->parasite = parasite_copy(gimp_image_find_parasite(gimage,
data->name));
if (tmp)
parasite_list_add(data->gimage->parasites, tmp);
else
parasite_list_remove(data->gimage->parasites, data->name);
}
else if (data->drawable)
{
data->parasite = parasite_copy(gimp_drawable_find_parasite(data->drawable,
data->name));
if (tmp)
parasite_list_add(data->drawable->parasites, tmp);
else
parasite_list_remove(data->drawable->parasites, data->name);
}
else
{
data->parasite = parasite_copy(gimp_find_parasite(data->name));
if (tmp)
gimp_attach_parasite(tmp);
else
gimp_detach_parasite(data->name);
}
if (tmp)
parasite_free(tmp);
/* if ((tmp && parasite_is_persistant(tmp)) || */
/* (data->parasite && parasite_is_persistant(data->parasite))) */
switch (state)
{
case UNDO:
gimage_clean (gimage);
break;
case REDO:
gimage_dirty (gimage);
break;
}
return TRUE;
}
void
undo_free_parasite (int state,
void *data_ptr)
{
ParasiteUndo *data;
data = data_ptr;
if (data->parasite)
parasite_free (data->parasite);
if (data->name)
g_free (data->name);
g_free (data_ptr);
}

View File

@ -79,6 +79,11 @@ int undo_push_fs_rigor (GImage *, int);
int undo_push_fs_relax (GImage *, int);
int undo_push_gimage_mod (GImage *);
int undo_push_guide (GImage *, void *);
int undo_push_image_parasite (GImage *, void *);
int undo_push_drawable_parasite (GImage *, GimpDrawable *, void *);
int undo_push_image_parasite_remove (GImage *, const char *);
int undo_push_drawable_parasite_remove (GImage *, GimpDrawable *,
const char *);
int undo_pop (GImage *);
int undo_redo (GImage *);

View File

@ -421,6 +421,8 @@ void gimp_image_add_layer_mask (gint32 image_ID,
void gimp_image_clean_all (gint32 image_ID);
void gimp_image_disable_undo (gint32 image_ID);
void gimp_image_enable_undo (gint32 image_ID);
void gimp_undo_push_group_start (gint32 image_ID);
void gimp_undo_push_group_end (gint32 image_ID);
void gimp_image_clean_all (gint32 image_ID);
gint32 gimp_image_flatten (gint32 image_ID);
void gimp_image_lower_channel (gint32 image_ID,

View File

@ -373,6 +373,34 @@ gimp_image_enable_undo (gint32 image_ID)
gimp_destroy_params (return_vals, nreturn_vals);
}
void
gimp_undo_push_group_start (gint32 image_ID)
{
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure ("gimp_undo_push_group_start",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}
void
gimp_undo_push_group_end (gint32 image_ID)
{
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure ("gimp_undo_push_group_end",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}
void
gimp_image_clean_all (gint32 image_ID)
{

View File

@ -373,6 +373,34 @@ gimp_image_enable_undo (gint32 image_ID)
gimp_destroy_params (return_vals, nreturn_vals);
}
void
gimp_undo_push_group_start (gint32 image_ID)
{
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure ("gimp_undo_push_group_start",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}
void
gimp_undo_push_group_end (gint32 image_ID)
{
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure ("gimp_undo_push_group_end",
&nreturn_vals,
PARAM_IMAGE, image_ID,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
}
void
gimp_image_clean_all (gint32 image_ID)
{

View File

@ -62,7 +62,6 @@ parasite_new (const char *name, guint32 flags,
p->name = g_strdup(name);
else
{
p->name = NULL;
g_free (p);
return NULL;
}
@ -134,6 +133,14 @@ parasite_is_persistent(const Parasite *p)
return (p->flags & PARASITE_PERSISTENT);
}
int
parasite_is_undoable(const Parasite *p)
{
if (p == NULL)
return FALSE;
return (p->flags & PARASITE_UNDOABLE);
}
int
parasite_has_flag(const Parasite *p, gulong flag)
{

View File

@ -29,12 +29,15 @@ extern "C" {
#endif /* __cplusplus */
#define PARASITE_PERSISTENT 1
#define PARASITE_UNDOABLE 2
#define PARASITE_ATTACH_PARENT (0x80 << 8)
#define PARASITE_PARENT_PERSISTENT (PARASITE_PERSISTENT << 8)
#define PARASITE_PARENT_UNDOABLE (PARASITE_UNDOABLE << 8)
#define PARASITE_ATTACH_GRANDPARENT (0x80 << 16)
#define PARASITE_GRANDPARENT_PERSISTENT (PARASITE_PERSISTENT << 16)
#define PARASITE_GRANDPARENT_UNDOABLE (PARASITE_UNDOABLE << 16)
Parasite *parasite_new (const char *name, guint32 flags,
guint32 size, const void *data);
@ -47,6 +50,7 @@ int parasite_compare (const Parasite *a, const Parasite *b);
int parasite_is_type (const Parasite *parasite,
const char *name);
int parasite_is_persistent (const Parasite *p);
int parasite_is_undoable (const Parasite *p);
int parasite_has_flag (const Parasite *p, gulong flag);
gulong parasite_flags (const Parasite *p);
const char *parasite_name (const Parasite *p);

View File

@ -62,7 +62,6 @@ parasite_new (const char *name, guint32 flags,
p->name = g_strdup(name);
else
{
p->name = NULL;
g_free (p);
return NULL;
}
@ -134,6 +133,14 @@ parasite_is_persistent(const Parasite *p)
return (p->flags & PARASITE_PERSISTENT);
}
int
parasite_is_undoable(const Parasite *p)
{
if (p == NULL)
return FALSE;
return (p->flags & PARASITE_UNDOABLE);
}
int
parasite_has_flag(const Parasite *p, gulong flag)
{

View File

@ -29,12 +29,15 @@ extern "C" {
#endif /* __cplusplus */
#define PARASITE_PERSISTENT 1
#define PARASITE_UNDOABLE 2
#define PARASITE_ATTACH_PARENT (0x80 << 8)
#define PARASITE_PARENT_PERSISTENT (PARASITE_PERSISTENT << 8)
#define PARASITE_PARENT_UNDOABLE (PARASITE_UNDOABLE << 8)
#define PARASITE_ATTACH_GRANDPARENT (0x80 << 16)
#define PARASITE_GRANDPARENT_PERSISTENT (PARASITE_PERSISTENT << 16)
#define PARASITE_GRANDPARENT_UNDOABLE (PARASITE_UNDOABLE << 16)
Parasite *parasite_new (const char *name, guint32 flags,
guint32 size, const void *data);
@ -47,6 +50,7 @@ int parasite_compare (const Parasite *a, const Parasite *b);
int parasite_is_type (const Parasite *parasite,
const char *name);
int parasite_is_persistent (const Parasite *p);
int parasite_is_undoable (const Parasite *p);
int parasite_has_flag (const Parasite *p, gulong flag);
gulong parasite_flags (const Parasite *p);
const char *parasite_name (const Parasite *p);

View File

@ -62,7 +62,6 @@ parasite_new (const char *name, guint32 flags,
p->name = g_strdup(name);
else
{
p->name = NULL;
g_free (p);
return NULL;
}
@ -134,6 +133,14 @@ parasite_is_persistent(const Parasite *p)
return (p->flags & PARASITE_PERSISTENT);
}
int
parasite_is_undoable(const Parasite *p)
{
if (p == NULL)
return FALSE;
return (p->flags & PARASITE_UNDOABLE);
}
int
parasite_has_flag(const Parasite *p, gulong flag)
{

View File

@ -29,12 +29,15 @@ extern "C" {
#endif /* __cplusplus */
#define PARASITE_PERSISTENT 1
#define PARASITE_UNDOABLE 2
#define PARASITE_ATTACH_PARENT (0x80 << 8)
#define PARASITE_PARENT_PERSISTENT (PARASITE_PERSISTENT << 8)
#define PARASITE_PARENT_UNDOABLE (PARASITE_UNDOABLE << 8)
#define PARASITE_ATTACH_GRANDPARENT (0x80 << 16)
#define PARASITE_GRANDPARENT_PERSISTENT (PARASITE_PERSISTENT << 16)
#define PARASITE_GRANDPARENT_UNDOABLE (PARASITE_UNDOABLE << 16)
Parasite *parasite_new (const char *name, guint32 flags,
guint32 size, const void *data);
@ -47,6 +50,7 @@ int parasite_compare (const Parasite *a, const Parasite *b);
int parasite_is_type (const Parasite *parasite,
const char *name);
int parasite_is_persistent (const Parasite *p);
int parasite_is_undoable (const Parasite *p);
int parasite_has_flag (const Parasite *p, gulong flag);
gulong parasite_flags (const Parasite *p);
const char *parasite_name (const Parasite *p);

View File

@ -252,7 +252,7 @@ static void do_layerrot(GDrawable *drawable,
drawable = gimp_drawable_get(drawable->id);
}
else /* not a layer... probably a channel... abort operation */
exit;
return;
/* If 'preserve transparency' was on, we need to temporatily

View File

@ -99,7 +99,7 @@ static void font_selection_init(FontSelection *fs)
fs->font = GTK_WIDGET(fs)->style->font;
/* get X font list and setup font names and styles */
//#define DEBUG_SPAM
/* #define DEBUG_SPAM */
#ifndef DEBUG_SPAM
/* FIXME: not only for "-*", do also "*"!!! */
xfontnames = XListFonts(GDK_DISPLAY(), "-*", MAX_FONTS, &num_fonts);

View File

@ -340,11 +340,16 @@ static void gdt_run(char *name, int nparams, GParam *param, int *nreturn_vals,
gdtvals.new_layer = !gimp_drawable_has_alpha(gdtvals.drawable_id);
break;
}
gimp_undo_push_group_start(gdtvals.image_id);
gdt_render_text(&gdtvals);
gdt_set_values(&gdtvals);
if (run_mode == RUN_INTERACTIVE)
gimp_set_data("plug_in_gdyntext", &gdtvals, sizeof(GdtVals));
values[1].data.d_int32 = gdtvals.layer_id;
gimp_undo_push_group_end(gdtvals.image_id);
}
@ -496,7 +501,7 @@ void gdt_set_values(GdtVals *data)
data->spacing);
#ifdef GIMP_HAVE_PARASITES
parasite = parasite_new(GDYNTEXT_PARASITE, PARASITE_PERSISTENT,
parasite = parasite_new(GDYNTEXT_PARASITE, PARASITE_PERSISTENT | PARASITE_UNDOABLE,
strlen(lname), lname);
gimp_drawable_attach_parasite(data->drawable_id, parasite);
parasite_free(parasite);
@ -532,9 +537,6 @@ void gdt_render_text(GdtVals *data)
GParamColor old_color, text_color;
gimp_progress_init("GIMP Dynamic Text");
ret_vals = gimp_run_procedure("gimp_undo_push_group_start", &nret_vals,
PARAM_IMAGE, data->image_id, PARAM_END);
gimp_destroy_params(ret_vals, nret_vals);
/* save and remove current selection */
ret_vals = gimp_run_procedure("gimp_selection_is_empty", &nret_vals,
@ -771,10 +773,6 @@ void gdt_render_text(GdtVals *data)
gimp_image_remove_channel(data->image_id, selection_channel);
}
ret_vals = gimp_run_procedure("gimp_undo_push_group_end", &nret_vals,
PARAM_IMAGE, data->image_id, PARAM_END);
gimp_destroy_params(ret_vals, nret_vals);
gimp_displays_flush();
gimp_progress_update(100.0);
}

View File

@ -49,7 +49,7 @@
/*-----------------------------------------------------------------------------------*/
inline float arctg(float y, float x)
float arctg(float y, float x)
{
float temp = atan2(y,x);
return (temp<0) ? (temp+TP) : temp;
@ -379,7 +379,7 @@ void rcm_render_preview(GtkWidget *preview, gint version)
{
for (k=0; k<3; k++)
{
// transp = reduced->mask[i*RW*bytes+j*bytes+3] / 255.0;
/* transp = reduced->mask[i*RW*bytes+j*bytes+3] / 255.0; */
transp = rgb_array[i*RW*bytes+j*bytes+3] / 255.0;
a[3*j+k] = transp * a[3*j+k] + (1-transp) * rcm_fake_transparency(i,j);
}

View File

@ -252,7 +252,7 @@ static void do_layerrot(GDrawable *drawable,
drawable = gimp_drawable_get(drawable->id);
}
else /* not a layer... probably a channel... abort operation */
exit;
return;
/* If 'preserve transparency' was on, we need to temporatily

View File

@ -483,7 +483,7 @@ proximity_out_event (GtkWidget *widget, GdkEventProximity *event)
{
#ifdef VERBOSE
g_print ("proximity out\n");
#endif VERBOSE
#endif /* VERBOSE */
return TRUE;
}