Commit a579edc9 authored by Sven Neumann's avatar Sven Neumann
Browse files

some small fixes and the new GAP VCR Navigator


--Sven
parent 4131ba84
Tue Jan 11 01:50:41 CET 2000 Sven Neumann <sven@gimp.org>
* libgimp/parasite.c
* app/gimpparasite.c
* app/parasitelist.c: indentation (actually I was searching for a
memleak, but had no luck so far)
* app/blob.c: raise the maximum image size that will make the ink tool
fail to 16384 x 16384 (sort of fixes bug #4464)
* Makefile.am
* pixmaps/first.xpm
* pixmaps/last.xpm
* pixmaps/next.xpm
* pixmaps/play.xpm
* pixmaps/prev.xpm
* pixmaps/update.xpm: new icons
* plug-ins/gap/gap_decode_mpeg_main.c
* plug-ins/gap/gap_decode_xanim.c
* plug-ins/gap/gap_lib.c
* plug-ins/gap/gap_lib.h
* plug-ins/gap/gap_main.c
* plug-ins/gap/gap_pdb_calls.c
* plug-ins/gap/gap_pdb_calls.h
* plug-ins/gap/gap_range_ops.c: changes by Wolfgang Hofer
* plug-ins/gap/Makefile.am
* plug-ins/gap/gap_navigator_dialog.c: new GAP VCR Navigator brought
to you by Wolfgang Hofer <hof@hotbot.com>. Needs some work, but is
already very nice, IMHO
Mon Jan 10 01:13:02 PST 2000 Manish Singh <yosh@gimp.org>
 
* tools/pdbgen/pdb/gimage.pdb: Made appropriate changes to
......
......@@ -41,12 +41,15 @@ EXTRA_DIST = \
pixmaps/duplicate.xpm \
pixmaps/eek.xpm \
pixmaps/eye.xbm \
pixmaps/first.xpm \
pixmaps/last.xpm \
pixmaps/layer.xbm \
pixmaps/linked.xbm \
pixmaps/locked.xbm \
pixmaps/lower.xpm \
pixmaps/mask.xbm \
pixmaps/navbutton.xpm \
pixmaps/next.xpm \
pixmaps/new.xpm \
pixmaps/no.xpm \
pixmaps/raise.xpm \
......@@ -56,11 +59,14 @@ EXTRA_DIST = \
pixmaps/penedit.xpm \
pixmaps/pennorm.xpm \
pixmaps/penstroke.xpm \
pixmaps/play.xpm \
pixmaps/prev.xpm \
pixmaps/qmasksel.xpm \
pixmaps/qmasknosel.xpm \
pixmaps/question.xpm \
pixmaps/topath.xpm \
pixmaps/toselection.xpm \
pixmaps/update.xpm \
pixmaps/yes.xpm \
pixmaps/zoom_in.xpm \
pixmaps/zoom_out.xpm \
......
......@@ -452,8 +452,24 @@ blob_line (Blob *b, int x0, int y0, int x1, int y1)
#define TABLE_SIZE 256
#define ELLIPSE_SHIFT 2
#define TABLE_SHIFT 14
#define TOTAL_SHIFT (ELLIPSE_SHIFT + TABLE_SHIFT)
#define TABLE_SHIFT 12
#define TOTAL_SHIFT (ELLIPSE_SHIFT + TABLE_SHIFT)
/*
* The choose of this values limits the maximal image_size to
* 16384 x 16384 pixels. The values will overflow as soon as
* x or y > INT_MAX / (1 << (ELLIPSE_SHIFT + TABLE_SHIFT)) / SUBSAMPLE
*
* Alternatively the code could be change the code as follows:
*
* xc_base = floor (xc)
* xc_shift = 0.5 + (xc - xc_base) * (1 << TOTAL_SHIFT);
*
* gint x = xc_base + (xc_shift + c * xp_shift + s * xq_shift +
* (1 << (TOTAL_SHIFT - 1))) >> TOTAL_SHIFT;
*
* which would change the limit from the image to the ellipse size
*/
static int trig_initialized = 0;
static int trig_table[TABLE_SIZE];
......
......@@ -36,30 +36,33 @@ static ParasiteList *parasites = NULL;
void
gimp_init_parasites()
{
g_return_if_fail(parasites == NULL);
parasites = parasite_list_new();
gimp_parasiterc_load();
g_return_if_fail (parasites == NULL);
parasites = parasite_list_new ();
gimp_parasiterc_load ();
}
void
gimp_parasite_attach (Parasite *p)
{
parasite_list_add(parasites, p);
parasite_list_add (parasites, p);
}
void
gimp_parasite_detach (const char *name)
{
parasite_list_remove(parasites, name);
parasite_list_remove (parasites, name);
}
Parasite *
gimp_parasite_find (const char *name)
{
return parasite_list_find(parasites, name);
return parasite_list_find (parasites, name);
}
static void list_func(char *key, Parasite *p, char ***cur)
static void
list_func (char *key,
Parasite *p,
char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
......@@ -67,7 +70,7 @@ static void list_func(char *key, Parasite *p, char ***cur)
char **
gimp_parasite_list (gint *count)
{
char **list, **cur;
gchar **list, **cur;
*count = parasite_list_length (parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
......@@ -77,7 +80,10 @@ gimp_parasite_list (gint *count)
return list;
}
static void save_func(char *key, Parasite *p, FILE *fp)
static void
save_func (char *key,
Parasite *p,
FILE *fp)
{
if (parasite_is_persistent (p))
{
......@@ -115,7 +121,7 @@ static void save_func(char *key, Parasite *p, FILE *fp)
}
void
gimp_parasiterc_save(void)
gimp_parasiterc_save (void)
{
char *filename;
FILE *fp;
......@@ -135,17 +141,17 @@ gimp_parasiterc_save(void)
fclose (fp);
if (rename(gimp_personal_rc_file ("#parasiterc.tmp~"),
gimp_personal_rc_file("parasiterc")) != 0)
gimp_personal_rc_file ("parasiterc")) != 0)
unlink(gimp_personal_rc_file ("#parasiterc.tmp~"));
}
void
gimp_parasiterc_load()
gimp_parasiterc_load (void)
{
char *filename;
filename = gimp_personal_rc_file ("parasiterc");
app_init_update_status(NULL, filename, -1);
app_init_update_status (NULL, filename, -1);
parse_gimprc_file (filename);
g_free (filename);
}
......@@ -36,30 +36,33 @@ static ParasiteList *parasites = NULL;
void
gimp_init_parasites()
{
g_return_if_fail(parasites == NULL);
parasites = parasite_list_new();
gimp_parasiterc_load();
g_return_if_fail (parasites == NULL);
parasites = parasite_list_new ();
gimp_parasiterc_load ();
}
void
gimp_parasite_attach (Parasite *p)
{
parasite_list_add(parasites, p);
parasite_list_add (parasites, p);
}
void
gimp_parasite_detach (const char *name)
{
parasite_list_remove(parasites, name);
parasite_list_remove (parasites, name);
}
Parasite *
gimp_parasite_find (const char *name)
{
return parasite_list_find(parasites, name);
return parasite_list_find (parasites, name);
}
static void list_func(char *key, Parasite *p, char ***cur)
static void
list_func (char *key,
Parasite *p,
char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
......@@ -67,7 +70,7 @@ static void list_func(char *key, Parasite *p, char ***cur)
char **
gimp_parasite_list (gint *count)
{
char **list, **cur;
gchar **list, **cur;
*count = parasite_list_length (parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
......@@ -77,7 +80,10 @@ gimp_parasite_list (gint *count)
return list;
}
static void save_func(char *key, Parasite *p, FILE *fp)
static void
save_func (char *key,
Parasite *p,
FILE *fp)
{
if (parasite_is_persistent (p))
{
......@@ -115,7 +121,7 @@ static void save_func(char *key, Parasite *p, FILE *fp)
}
void
gimp_parasiterc_save(void)
gimp_parasiterc_save (void)
{
char *filename;
FILE *fp;
......@@ -135,17 +141,17 @@ gimp_parasiterc_save(void)
fclose (fp);
if (rename(gimp_personal_rc_file ("#parasiterc.tmp~"),
gimp_personal_rc_file("parasiterc")) != 0)
gimp_personal_rc_file ("parasiterc")) != 0)
unlink(gimp_personal_rc_file ("#parasiterc.tmp~"));
}
void
gimp_parasiterc_load()
gimp_parasiterc_load (void)
{
char *filename;
filename = gimp_personal_rc_file ("parasiterc");
app_init_update_status(NULL, filename, -1);
app_init_update_status (NULL, filename, -1);
parse_gimprc_file (filename);
g_free (filename);
}
......@@ -45,7 +45,7 @@ parasite_list_init (ParasiteList* list)
}
static void
parasite_list_class_init(ParasiteListClass *klass)
parasite_list_class_init (ParasiteListClass *klass)
{
GtkObjectClass *class = GTK_OBJECT_CLASS(klass);
GtkType type = class->type;
......@@ -53,164 +53,192 @@ parasite_list_class_init(ParasiteListClass *klass)
class->destroy = parasite_list_destroy;
parasite_list_signals[ADD] =
gimp_signal_new("add", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
gimp_signal_new ("add", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
parasite_list_signals[REMOVE] =
gimp_signal_new("remove", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
gimp_signal_new ("remove", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
gtk_object_class_add_signals (class, parasite_list_signals, LAST_SIGNAL);
}
GtkType
parasite_list_get_type()
parasite_list_get_type (void)
{
static GtkType type = 0;
if (!type)
{
GtkTypeInfo info =
{
"ParasiteList",
sizeof (ParasiteList),
sizeof (ParasiteListClass),
(GtkClassInitFunc) parasite_list_class_init,
(GtkObjectInitFunc) parasite_list_init,
NULL,
NULL,
(GtkClassInitFunc) NULL
};
type = gtk_type_unique(GIMP_TYPE_OBJECT, &info);
}
GtkTypeInfo info =
{
"ParasiteList",
sizeof (ParasiteList),
sizeof (ParasiteListClass),
(GtkClassInitFunc) parasite_list_class_init,
(GtkObjectInitFunc) parasite_list_init,
NULL,
NULL,
(GtkClassInitFunc) NULL
};
type = gtk_type_unique (GIMP_TYPE_OBJECT, &info);
}
return type;
}
ParasiteList*
parasite_list_new()
parasite_list_new (void)
{
ParasiteList *list = gtk_type_new(GIMP_TYPE_PARASITE_LIST);
ParasiteList *list = gtk_type_new (GIMP_TYPE_PARASITE_LIST);
list->table = NULL;
return list;
}
static int
free_a_parasite(void *key, void *parasite, void *unused)
free_a_parasite (void *key,
void *parasite,
void *unused)
{
parasite_free((Parasite *)parasite);
parasite_free ((Parasite *)parasite);
return TRUE;
}
static void
parasite_list_destroy(GtkObject *obj)
parasite_list_destroy (GtkObject *obj)
{
ParasiteList *list;
g_return_if_fail(obj != NULL);
g_return_if_fail(GIMP_IS_PARASITE_LIST(obj));
g_return_if_fail (obj != NULL);
g_return_if_fail (GIMP_IS_PARASITE_LIST(obj));
list = (ParasiteList *)obj;
if (list->table)
{
g_hash_table_foreach_remove(list->table, free_a_parasite, NULL);
g_hash_table_destroy(list->table);
}
{
g_hash_table_foreach_remove (list->table, free_a_parasite, NULL);
g_hash_table_destroy (list->table);
}
}
static void
parasite_copy_one(void *key, void *p, void *data)
parasite_copy_one (void *key,
void *p,
void *data)
{
ParasiteList *list = (ParasiteList*)data;
Parasite *parasite = (Parasite*)p;
parasite_list_add(list, parasite);
parasite_list_add (list, parasite);
}
ParasiteList*
parasite_list_copy(const ParasiteList *list)
parasite_list_copy (const ParasiteList *list)
{
ParasiteList *newlist;
newlist = parasite_list_new();
newlist = parasite_list_new ();
if (list->table)
g_hash_table_foreach(list->table, parasite_copy_one, newlist);
g_hash_table_foreach (list->table, parasite_copy_one, newlist);
return newlist;
}
void
parasite_list_add(ParasiteList *list, Parasite *p)
parasite_list_add (ParasiteList *list,
Parasite *p)
{
g_return_if_fail(list != NULL);
g_return_if_fail (list != NULL);
if (list->table == NULL)
list->table = g_hash_table_new(g_str_hash, g_str_equal);
g_return_if_fail(p != NULL);
g_return_if_fail(p->name != NULL);
parasite_list_remove(list, p->name);
p = parasite_copy(p);
g_hash_table_insert(list->table, p->name, p);
list->table = g_hash_table_new (g_str_hash, g_str_equal);
g_return_if_fail (p != NULL);
g_return_if_fail (p->name != NULL);
parasite_list_remove (list, p->name);
p = parasite_copy (p);
g_hash_table_insert (list->table, p->name, p);
gtk_signal_emit (GTK_OBJECT(list), parasite_list_signals[ADD], p);
}
void
parasite_list_remove(ParasiteList *list, const char *name)
parasite_list_remove (ParasiteList *list,
const char *name)
{
Parasite *p;
g_return_if_fail(list != NULL);
g_return_if_fail (list != NULL);
if (list->table)
{
p = parasite_list_find(list, name);
if (p)
{
g_hash_table_remove(list->table, name);
gtk_signal_emit (GTK_OBJECT(list), parasite_list_signals[REMOVE], p);
parasite_free(p);
p = parasite_list_find(list, name);
if (p)
{
g_hash_table_remove (list->table, name);
gtk_signal_emit (GTK_OBJECT(list), parasite_list_signals[REMOVE], p);
parasite_free (p);
}
}
}
}
gint
parasite_list_length(ParasiteList *list)
parasite_list_length (ParasiteList *list)
{
g_return_val_if_fail(list != NULL, 0);
g_return_val_if_fail (list != NULL, 0);
if (!list->table)
return 0;
return g_hash_table_size(list->table);
return g_hash_table_size (list->table);
}
static void ppcount_func(char *key, Parasite *p, int *count)
static void
ppcount_func (char *key,
Parasite *p,
int *count)
{
if (parasite_is_persistent(p))
if (parasite_is_persistent (p))
*count = *count + 1;
}
gint
parasite_list_persistent_length(ParasiteList *list)
parasite_list_persistent_length (ParasiteList *list)
{
int ppcount = 0;
g_return_val_if_fail(list != NULL, 0);
g_return_val_if_fail (list != NULL, 0);
if (!list->table)
return 0;
parasite_list_foreach(list, (GHFunc)ppcount_func, &ppcount);
parasite_list_foreach (list, (GHFunc)ppcount_func, &ppcount);
return ppcount;
}
void
parasite_list_foreach(ParasiteList *list, GHFunc function, gpointer user_data)
parasite_list_foreach (ParasiteList *list,
GHFunc function,
gpointer user_data)
{
g_return_if_fail(list != NULL);
g_return_if_fail (list != NULL);
if (!list->table)
return;
g_hash_table_foreach(list->table, function, user_data);
g_hash_table_foreach (list->table, function, user_data);
}
Parasite *
parasite_list_find(ParasiteList *list, const char *name)
parasite_list_find (ParasiteList *list,
const char *name)
{
g_return_val_if_fail(list != NULL, NULL);
g_return_val_if_fail (list != NULL, NULL);
if (list->table)
return (Parasite *)g_hash_table_lookup(list->table, name);
return (Parasite *)g_hash_table_lookup (list->table, name);
else
return NULL;
}
void
parasite_shift_parent(Parasite *p)
parasite_shift_parent (Parasite *p)
{
if (p == NULL)
return;
p->flags = (p->flags >> 8);
}
......@@ -36,30 +36,33 @@ static ParasiteList *parasites = NULL;
void
gimp_init_parasites()
{
g_return_if_fail(parasites == NULL);
parasites = parasite_list_new();
gimp_parasiterc_load();
g_return_if_fail (parasites == NULL);
parasites = parasite_list_new ();
gimp_parasiterc_load ();
}
void
gimp_parasite_attach (Parasite *p)
{
parasite_list_add(parasites, p);
parasite_list_add (parasites, p);
}
void
gimp_parasite_detach (const char *name)
{
parasite_list_remove(parasites, name);
parasite_list_remove (parasites, name);
}
Parasite *
gimp_parasite_find (const char *name)
{
return parasite_list_find(parasites, name);
return parasite_list_find (parasites, name);
}
static void list_func(char *key, Parasite *p, char ***cur)
static void
list_func (char *key,
Parasite *p,
char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
......@@ -67,7 +70,7 @@ static void list_func(char *key, Parasite *p, char ***cur)
char **
gimp_parasite_list (gint *count)
{
char **list, **cur;
gchar **list, **cur;
*count = parasite_list_length (parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
......@@ -77,7 +80,10 @@ gimp_parasite_list (gint *count)
return list;
}
static void save_func(char *key, Parasite *p, FILE *fp)
static void
save_func (char *key,
Parasite *p,
FILE *fp)
{
if (parasite_is_persistent (p))
{
......@@ -115,7 +121,7 @@ static void save_func(char *key, Parasite *p, FILE *fp)
}
void
gimp_parasiterc_save(void)
gimp_parasiterc_save (void)
{
char *filename;
FILE *fp;
......@@ -135,17 +141,17 @@ gimp_parasiterc_save(void)
fclose (fp);
if (rename(gimp_personal_rc_file ("#parasiterc.tmp~"),
gimp_personal_rc_file("parasiterc")) != 0)
gimp_personal_rc_file ("parasiterc")) != 0)
unlink(gimp_personal_rc_file ("#parasiterc.tmp~"));
}
void
gimp_parasiterc_load()
gimp_parasiterc_load (void)
{
char *filename;
filename = gimp_personal_rc_file ("parasiterc");
app_init_update_status(NULL, filename, -1);
app_init_update_status (NULL, filename, -1);
parse_gimprc_file (filename);