Commit d996031a authored by jaycox's avatar jaycox

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
parent 174e1a0f
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
......
......@@ -2130,7 +2130,7 @@ plug_in_flush (GIOChannel *channel)
{
GIOError error;
int count;
int bytes;
guint bytes;
if (current_write_buffer_index > 0)
{
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
}
......@@ -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 *);
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -214,8 +214,6 @@ parasite_list_find(ParasiteList *list, const char *name)
return NULL;
}
static int saved_bytes;
void
parasite_shift_parent(Parasite *p)
{
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -513,11 +513,6 @@ edit_selection_draw (Tool *tool)
break;