mirror of https://github.com/GNOME/gimp.git
added MAINTAINERS to EXTRA_DIST
* Makefile.am: added MAINTAINERS to EXTRA_DIST * configure.in: nicer -Wall, -ansi, etc. adding for CFLAGS with gcc * libgimp/parasite*.h * libgimp/gimpintl.h * app/Makefile.am * po/Makefile.in.in * configure.in: portablity, locale patch (gimp-joke-981028-0) * configure.in * plug-ins/Makefile.am: added lic, mapcolor, and xbm plug-ins * app/app_procs.c * app/menus.c: cosmetic message fixes * libgimp/parasite.c: use %p to print pointers * plug-ins/dbbrowser/dbbrowser_utils.[ch]: changes for new clist stuff * plug-ins/script-fu/script-fu-enums.h * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu.c * plug-ins/script-fu/scripts/carved-logo.scm * plug-ins/script-fu/scripts/chrome-it.scm * plug-ins/script-fu/scripts/crystal-logo.scm * plug-ins/script-fu/scripts/neon-logo.scm * plug-ins/script-fu/scripts/sota-chrome-logo.scm: applied gimp-ruth-981103-0, adds a filesel to script-fu and SF-FILENAME param type. Make some scripts use this. -Yosh
This commit is contained in:
parent
66cd5c1678
commit
8575718342
35
ChangeLog
35
ChangeLog
|
@ -1,3 +1,37 @@
|
|||
Thu Nov 5 16:42:21 PST 1998 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* Makefile.am: added MAINTAINERS to EXTRA_DIST
|
||||
|
||||
* configure.in: nicer -Wall, -ansi, etc. adding for CFLAGS with gcc
|
||||
|
||||
* libgimp/parasite*.h
|
||||
* libgimp/gimpintl.h
|
||||
* app/Makefile.am
|
||||
* po/Makefile.in.in
|
||||
* configure.in: portablity, locale patch (gimp-joke-981028-0)
|
||||
|
||||
* configure.in
|
||||
* plug-ins/Makefile.am: added lic, mapcolor, and xbm plug-ins
|
||||
|
||||
* app/app_procs.c
|
||||
* app/menus.c: cosmetic message fixes
|
||||
|
||||
* libgimp/parasite.c: use %p to print pointers
|
||||
|
||||
* plug-ins/dbbrowser/dbbrowser_utils.[ch]: changes for new clist
|
||||
stuff
|
||||
|
||||
* plug-ins/script-fu/script-fu-enums.h
|
||||
* plug-ins/script-fu/script-fu-scripts.c
|
||||
* plug-ins/script-fu/script-fu.c
|
||||
* plug-ins/script-fu/scripts/carved-logo.scm
|
||||
* plug-ins/script-fu/scripts/chrome-it.scm
|
||||
* plug-ins/script-fu/scripts/crystal-logo.scm
|
||||
* plug-ins/script-fu/scripts/neon-logo.scm
|
||||
* plug-ins/script-fu/scripts/sota-chrome-logo.scm: applied
|
||||
gimp-ruth-981103-0, adds a filesel to script-fu and SF-FILENAME
|
||||
param type. Make some scripts use this.
|
||||
|
||||
Thu Nov 5 21:55:46 GMT 1998 Andy Thomas <alt@picnic.demon.co.uk>
|
||||
|
||||
* app/gradient.c
|
||||
|
@ -509,6 +543,7 @@ Mon Oct 5 01:08:11 CST 1998 Seth Burgess <sjburges@gimp.org>
|
|||
Many thanks to Marc Lehman for reporting these. More to come.
|
||||
|
||||
Mon Oct 5 23:56:09 EEST 1998 Lauri Alanko <nether@gimp.org>
|
||||
|
||||
* po/fr.po: fixed a compile-halting typo
|
||||
|
||||
Mon Oct 5 16:18:08 EDT 1998 Matthew Wilson <msw@gimp.org>
|
||||
|
|
27
Makefile.am
27
Makefile.am
|
@ -4,9 +4,32 @@ SUBDIRS = po intl libgimp plug-ins app data
|
|||
|
||||
bin_SCRIPTS = gimptool
|
||||
|
||||
EXTRA_DIST = TODO gtkrc gimp_logo.ppm gimp_splash.ppm gimp1_1_splash.ppm rmshm user_install gimp_tips.txt ps-menurc gimp.1 gimptool.1 gtkrc.forest2 gimp.m4
|
||||
EXTRA_DIST = \
|
||||
MAINTAINERS \
|
||||
TODO \
|
||||
gtkrc \
|
||||
gimp_logo.ppm \
|
||||
gimp_splash.ppm \
|
||||
gimp1_1_splash.ppm \
|
||||
rmshm \
|
||||
user_install \
|
||||
gimp_tips.txt \
|
||||
ps-menurc \
|
||||
gimp.1 \
|
||||
gimptool.1 \
|
||||
gtkrc.forest2 \
|
||||
gimp.m4
|
||||
|
||||
gimpdata_DATA = gimprc gimprc_user gtkrc gimp_logo.ppm gimp_splash.ppm gimp1_1_splash.ppm gimp_tips.txt ps-menurc gtkrc.forest2
|
||||
gimpdata_DATA = \
|
||||
gimprc \
|
||||
gimprc_user \
|
||||
gtkrc \
|
||||
gimp_logo.ppm \
|
||||
gimp_splash.ppm \
|
||||
gimp1_1_splash.ppm \
|
||||
gimp_tips.txt \
|
||||
ps-menurc \
|
||||
gtkrc.forest2
|
||||
|
||||
gimpdata_SCRIPTS = user_install
|
||||
|
||||
|
|
|
@ -336,7 +336,8 @@ EXTRA_DIST = \
|
|||
CPPFLAGS = \
|
||||
-DLIBDIR=\""$(gimpplugindir)"\" \
|
||||
-DDATADIR=\""$(gimpdatadir)"\" \
|
||||
-DGIMPDIR=\""$(gimpdir)"\"
|
||||
-DGIMPDIR=\""$(gimpdir)"\" \
|
||||
-DLOCALEDIR=\""$(localedir)"\"
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
|
|
|
@ -458,7 +458,7 @@ app_init (void)
|
|||
sprintf (filename, "%s/gtkrc", gimp_dir);
|
||||
|
||||
if ((be_verbose == TRUE) || (no_splash == TRUE))
|
||||
g_print (_("parsing %s\n"), filename);
|
||||
g_print (_("parsing \"%s\"\n"), filename);
|
||||
|
||||
gtk_rc_parse (filename);
|
||||
}
|
||||
|
|
|
@ -343,7 +343,7 @@ menus_set_sensitive (char *path,
|
|||
gtk_widget_set_sensitive (widget, sensitive);
|
||||
}
|
||||
if (!ifactory || !widget)
|
||||
printf (_("Unable to set sensitivity for menu which doesn't exist:\n%s"), path);
|
||||
g_message (_("Unable to set sensitivity for menu which doesn't exist:\n%s"), path);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -368,7 +368,7 @@ menus_set_state (char *path,
|
|||
widget = NULL;
|
||||
}
|
||||
if (!ifactory || !widget)
|
||||
printf (_("Unable to set state for menu which doesn't exist:\n%s"), path);
|
||||
g_message (_("Unable to set state for menu which doesn't exist:\n%s\n"), path);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -343,7 +343,7 @@ menus_set_sensitive (char *path,
|
|||
gtk_widget_set_sensitive (widget, sensitive);
|
||||
}
|
||||
if (!ifactory || !widget)
|
||||
printf (_("Unable to set sensitivity for menu which doesn't exist:\n%s"), path);
|
||||
g_message (_("Unable to set sensitivity for menu which doesn't exist:\n%s"), path);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -368,7 +368,7 @@ menus_set_state (char *path,
|
|||
widget = NULL;
|
||||
}
|
||||
if (!ifactory || !widget)
|
||||
printf (_("Unable to set state for menu which doesn't exist:\n%s"), path);
|
||||
g_message (_("Unable to set state for menu which doesn't exist:\n%s\n"), path);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -343,7 +343,7 @@ menus_set_sensitive (char *path,
|
|||
gtk_widget_set_sensitive (widget, sensitive);
|
||||
}
|
||||
if (!ifactory || !widget)
|
||||
printf (_("Unable to set sensitivity for menu which doesn't exist:\n%s"), path);
|
||||
g_message (_("Unable to set sensitivity for menu which doesn't exist:\n%s"), path);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -368,7 +368,7 @@ menus_set_state (char *path,
|
|||
widget = NULL;
|
||||
}
|
||||
if (!ifactory || !widget)
|
||||
printf (_("Unable to set state for menu which doesn't exist:\n%s"), path);
|
||||
g_message (_("Unable to set state for menu which doesn't exist:\n%s\n"), path);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -343,7 +343,7 @@ menus_set_sensitive (char *path,
|
|||
gtk_widget_set_sensitive (widget, sensitive);
|
||||
}
|
||||
if (!ifactory || !widget)
|
||||
printf (_("Unable to set sensitivity for menu which doesn't exist:\n%s"), path);
|
||||
g_message (_("Unable to set sensitivity for menu which doesn't exist:\n%s"), path);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -368,7 +368,7 @@ menus_set_state (char *path,
|
|||
widget = NULL;
|
||||
}
|
||||
if (!ifactory || !widget)
|
||||
printf (_("Unable to set state for menu which doesn't exist:\n%s"), path);
|
||||
g_message (_("Unable to set state for menu which doesn't exist:\n%s\n"), path);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
48
configure.in
48
configure.in
|
@ -66,40 +66,41 @@ ALL_LINGUAS="fr sv ja it fi ko de"
|
|||
AM_GNU_GETTEXT
|
||||
|
||||
dnl Check for GTK+
|
||||
AM_PATH_GTK(1.1.2,,
|
||||
AM_PATH_GTK(1.1.3,,
|
||||
AC_MSG_ERROR(Test for GTK failed. See the file 'INSTALL' for help.))
|
||||
|
||||
changequote(,)dnl
|
||||
|
||||
dnl Evil stuff to extract GLIB stuff from gtk-config output
|
||||
dnl (we want to make sure it matches with the gtk we're using)
|
||||
GLIB_CFLAGS=`echo $GTK_CFLAGS | sed 's/^.*\(-I[[^ ]]*glib[[^ ]]* *-I[[^ ]]*\).*$/\1/'`
|
||||
GLIB_LDFLAGS=`echo $gtk_libs | sed -e 's/^.*-lgdk[[^ ]]* *\(-L[[^ ]]*\).*$/\1/' -e 's/^.* -lgdk[[^ ]]* .*$//'`
|
||||
GLIB_CFLAGS=`echo $GTK_CFLAGS | sed 's/^.*\(-I[^ ]*glib[^ ]* *-I[^ ]*\).*$/\1/'`
|
||||
GLIB_LDFLAGS=`echo $gtk_libs | sed -e 's/^.*-lgdk[^ ]* *\(-L[^ ]*\).*$/\1/' -e 's/^.* -lgdk[^ ]* .*$//'`
|
||||
if test -z "$glib_ldflags" ; then
|
||||
GLIB_LDFLAGS=`echo $GTK_LIBS | sed 's/^ *\(-L[[^ ]]*\) .*$/\1/'`
|
||||
GLIB_LDFLAGS=`echo $GTK_LIBS | sed 's/^ *\(-L[^ ]*\) .*$/\1/'`
|
||||
fi
|
||||
GLIB_LIBS="$GLIB_LDFLAGS `echo $GTK_LIBS | sed 's/^.*\(-lglib[[^ ]]*\).*$/\1/'`"
|
||||
GLIB_LIBS="$GLIB_LDFLAGS `echo $GTK_LIBS | sed 's/^.*\(-lglib[^ ]*\).*$/\1/'`"
|
||||
|
||||
if eval "test x$GCC = xyes"; then
|
||||
if echo "$CFLAGS" | grep "\-Wall" > /dev/null 2> /dev/null; then
|
||||
CFLAGS="$CFLAGS"
|
||||
else
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
fi
|
||||
case " $CFLAGS " in
|
||||
*[\ \ ]-Wall[\ \ ]*) ;;
|
||||
*) CFLAGS="$CFLAGS -Wall" ;;
|
||||
esac
|
||||
|
||||
if eval "test x$enable_ansi = xyes"; then
|
||||
if echo "$CFLAGS" | grep "\-ansi" > /dev/null 2> /dev/null; then
|
||||
CFLAGS="$CFLAGS"
|
||||
else
|
||||
CFLAGS="$CFLAGS -ansi"
|
||||
fi
|
||||
if test "x$enable_ansi" = "xyes"; then
|
||||
case " $CFLAGS " in
|
||||
*[\ \ ]-ansi[\ \ ]*) ;;
|
||||
*) CFLAGS="$CFLAGS -ansi" ;;
|
||||
esac
|
||||
|
||||
if echo "$CFLAGS" | grep "\-pedantic" > /dev/null 2> /dev/null; then
|
||||
CFLAGS="$CFLAGS"
|
||||
else
|
||||
CFLAGS="$CFLAGS -pedantic"
|
||||
fi
|
||||
case " $CFLAGS " in
|
||||
*[\ \ ]-pedantic[\ \ ]*) ;;
|
||||
*) CFLAGS="$CFLAGS -pedantic" ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
changequote([,])dnl
|
||||
|
||||
dnl DU4 native cc currently needs -std1 for ANSI mode (instead of K&R)
|
||||
AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
|
||||
gimp_save_LIBS=$LIBS
|
||||
|
@ -384,6 +385,7 @@ LIBS="$gimp_save_LIBS"
|
|||
|
||||
gimpdatadir=$datadir/gimp
|
||||
gimpplugindir=$libdir/$PACKAGE/$GIMP_MAJOR_VERSION.$GIMP_MINOR_VERSION
|
||||
localedir=$datadir/locale
|
||||
|
||||
brushdata=`ls -1 $srcdir/data/brushes | grep -v Makefile`
|
||||
gradientdata=`ls -1 $srcdir/data/gradients | grep -v Makefile`
|
||||
|
@ -547,6 +549,7 @@ AC_SUBST(GLIB_LIBS)
|
|||
AC_SUBST(gimpdir)
|
||||
AC_SUBST(gimpdatadir)
|
||||
AC_SUBST(gimpplugindir)
|
||||
AC_SUBST(localedir)
|
||||
AC_SUBST(brushdata)
|
||||
AC_SUBST(gradientdata)
|
||||
AC_SUBST(palettedata)
|
||||
|
@ -669,7 +672,9 @@ plug-ins/illusion/Makefile
|
|||
plug-ins/iwarp/Makefile
|
||||
plug-ins/jigsaw/Makefile
|
||||
plug-ins/laplace/Makefile
|
||||
plug-ins/lic/Makefile
|
||||
plug-ins/mail/Makefile
|
||||
plug-ins/mapcolor/Makefile
|
||||
plug-ins/max_rgb/Makefile
|
||||
plug-ins/maze/Makefile
|
||||
plug-ins/mblur/Makefile
|
||||
|
@ -725,6 +730,7 @@ plug-ins/waterselect/Makefile
|
|||
plug-ins/waves/Makefile
|
||||
plug-ins/whirlpinch/Makefile
|
||||
plug-ins/wind/Makefile
|
||||
plug-ins/xbm/Makefile
|
||||
plug-ins/xwd/Makefile
|
||||
plug-ins/zealouscrop/Makefile
|
||||
app/Makefile
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef __GIMPINTL_H__
|
||||
#define __GIMPINTL_H__
|
||||
|
||||
#define LOCALEDIR "/usr/local/share/locale"
|
||||
|
||||
/* Copied from gnome-i18n.h by Tom Tromey <tromey@creche.cygnus.com> */
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include "parasiteP.h"
|
||||
#include "parasite.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
|
@ -29,7 +31,7 @@ static void parasite_print(Parasite *p)
|
|||
printf("(pid %d)attempt to print a null parasite\n", getpid());
|
||||
return;
|
||||
}
|
||||
printf("(pid %d), parasite: %X\n", getpid(), p);
|
||||
printf("(pid %d), parasite: %p\n", getpid(), p);
|
||||
if (p->name)
|
||||
printf("\tname: %s\n", p->name);
|
||||
else
|
||||
|
@ -37,7 +39,7 @@ static void parasite_print(Parasite *p)
|
|||
printf("\tflags: %d\n", p->flags);
|
||||
printf("\tsize: %d\n", p->size);
|
||||
if (p->size > 0)
|
||||
printf("\tdata: %X\n", p->data);
|
||||
printf("\tdata: %p\n", p->data);
|
||||
}
|
||||
|
||||
Parasite *
|
||||
|
|
|
@ -46,4 +46,4 @@ int parasite_is_persistant (const Parasite *p);
|
|||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif _PARASITE_H_
|
||||
#endif /* _PARASITE_H_ */
|
||||
|
|
|
@ -22,4 +22,4 @@
|
|||
|
||||
typedef struct _Parasite Parasite;
|
||||
|
||||
#endif _PARASITEF_H_
|
||||
#endif /* _PARASITEF_H_ */
|
||||
|
|
|
@ -31,4 +31,4 @@ struct _Parasite
|
|||
* responsible for tracking byte order */
|
||||
};
|
||||
|
||||
#endif _PARASITEP_H_
|
||||
#endif /* _PARASITEP_H_ */
|
||||
|
|
|
@ -82,8 +82,9 @@ gimp_db_browser(void (* apply_callback) ( gchar *selected_proc_name,
|
|||
/* list : list in a scrolled_win */
|
||||
|
||||
dbbrowser->clist = gtk_clist_new(1);
|
||||
gtk_clist_set_policy (GTK_CLIST (dbbrowser->clist), GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
dbbrowser->scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (dbbrowser->scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (dbbrowser->clist),
|
||||
GTK_SELECTION_BROWSE);
|
||||
|
||||
|
@ -91,9 +92,10 @@ gimp_db_browser(void (* apply_callback) ( gchar *selected_proc_name,
|
|||
gtk_signal_connect (GTK_OBJECT (dbbrowser->clist), "select_row",
|
||||
(GtkSignalFunc) procedure_select_callback,
|
||||
dbbrowser);
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
dbbrowser->clist, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), dbbrowser->scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (dbbrowser->scrolled_win), dbbrowser->clist);
|
||||
gtk_widget_show(dbbrowser->clist);
|
||||
gtk_widget_show(dbbrowser->scrolled_win);
|
||||
|
||||
/* search entry */
|
||||
|
||||
|
|
|
@ -82,8 +82,9 @@ gimp_db_browser(void (* apply_callback) ( gchar *selected_proc_name,
|
|||
/* list : list in a scrolled_win */
|
||||
|
||||
dbbrowser->clist = gtk_clist_new(1);
|
||||
gtk_clist_set_policy (GTK_CLIST (dbbrowser->clist), GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
dbbrowser->scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (dbbrowser->scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (dbbrowser->clist),
|
||||
GTK_SELECTION_BROWSE);
|
||||
|
||||
|
@ -91,9 +92,10 @@ gimp_db_browser(void (* apply_callback) ( gchar *selected_proc_name,
|
|||
gtk_signal_connect (GTK_OBJECT (dbbrowser->clist), "select_row",
|
||||
(GtkSignalFunc) procedure_select_callback,
|
||||
dbbrowser);
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
dbbrowser->clist, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), dbbrowser->scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (dbbrowser->scrolled_win), dbbrowser->clist);
|
||||
gtk_widget_show(dbbrowser->clist);
|
||||
gtk_widget_show(dbbrowser->scrolled_win);
|
||||
|
||||
/* search entry */
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include "parasiteP.h"
|
||||
#include "parasite.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
|
@ -29,7 +31,7 @@ static void parasite_print(Parasite *p)
|
|||
printf("(pid %d)attempt to print a null parasite\n", getpid());
|
||||
return;
|
||||
}
|
||||
printf("(pid %d), parasite: %X\n", getpid(), p);
|
||||
printf("(pid %d), parasite: %p\n", getpid(), p);
|
||||
if (p->name)
|
||||
printf("\tname: %s\n", p->name);
|
||||
else
|
||||
|
@ -37,7 +39,7 @@ static void parasite_print(Parasite *p)
|
|||
printf("\tflags: %d\n", p->flags);
|
||||
printf("\tsize: %d\n", p->size);
|
||||
if (p->size > 0)
|
||||
printf("\tdata: %X\n", p->data);
|
||||
printf("\tdata: %p\n", p->data);
|
||||
}
|
||||
|
||||
Parasite *
|
||||
|
|
|
@ -46,4 +46,4 @@ int parasite_is_persistant (const Parasite *p);
|
|||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif _PARASITE_H_
|
||||
#endif /* _PARASITE_H_ */
|
||||
|
|
|
@ -22,4 +22,4 @@
|
|||
|
||||
typedef struct _Parasite Parasite;
|
||||
|
||||
#endif _PARASITEF_H_
|
||||
#endif /* _PARASITEF_H_ */
|
||||
|
|
|
@ -31,4 +31,4 @@ struct _Parasite
|
|||
* responsible for tracking byte order */
|
||||
};
|
||||
|
||||
#endif _PARASITEP_H_
|
||||
#endif /* _PARASITEP_H_ */
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include "parasiteP.h"
|
||||
#include "parasite.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
|
@ -29,7 +31,7 @@ static void parasite_print(Parasite *p)
|
|||
printf("(pid %d)attempt to print a null parasite\n", getpid());
|
||||
return;
|
||||
}
|
||||
printf("(pid %d), parasite: %X\n", getpid(), p);
|
||||
printf("(pid %d), parasite: %p\n", getpid(), p);
|
||||
if (p->name)
|
||||
printf("\tname: %s\n", p->name);
|
||||
else
|
||||
|
@ -37,7 +39,7 @@ static void parasite_print(Parasite *p)
|
|||
printf("\tflags: %d\n", p->flags);
|
||||
printf("\tsize: %d\n", p->size);
|
||||
if (p->size > 0)
|
||||
printf("\tdata: %X\n", p->data);
|
||||
printf("\tdata: %p\n", p->data);
|
||||
}
|
||||
|
||||
Parasite *
|
||||
|
|
|
@ -46,4 +46,4 @@ int parasite_is_persistant (const Parasite *p);
|
|||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif _PARASITE_H_
|
||||
#endif /* _PARASITE_H_ */
|
||||
|
|
|
@ -79,7 +79,9 @@ SUBDIRS = \
|
|||
iwarp \
|
||||
jigsaw \
|
||||
laplace \
|
||||
lic \
|
||||
mail \
|
||||
mapcolor \
|
||||
max_rgb \
|
||||
maze \
|
||||
mblur \
|
||||
|
@ -135,6 +137,7 @@ SUBDIRS = \
|
|||
waves \
|
||||
whirlpinch \
|
||||
wind \
|
||||
xbm \
|
||||
xwd \
|
||||
zealouscrop
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,696 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
* mapcolor plugin
|
||||
* Copyright (C) 1998 Peter Kirchgessner
|
||||
* (email: pkirchg@aol.com, WWW: http://members.aol.com/pkirchg)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Event history:
|
||||
* V 1.00, PK, 26-Oct-98: Creation.
|
||||
*/
|
||||
#define VERSIO 1.00
|
||||
static char dversio[] = "v1.00 26-Oct-98";
|
||||
static char ident[] = "@(#) GIMP mapcolor plug-in v1.00 26-Oct-98";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include "gtk/gtk.h"
|
||||
#include "libgimp/gimp.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#define PRV_WIDTH 50
|
||||
#define PRV_HEIGHT 20
|
||||
|
||||
typedef struct
|
||||
{
|
||||
guchar colors[4][3];
|
||||
gint32 map_mode;
|
||||
} PLVALS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *activate; /* The button that activates the color sel. dialog */
|
||||
GtkWidget *colselect; /* The colour selection dialog itself */
|
||||
GtkWidget *preview; /* The colour preview */
|
||||
unsigned char color[3];/* The selected colour */
|
||||
} CSEL;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
CSEL csel[4];
|
||||
PLVALS *plvals;
|
||||
gint run; /* run */
|
||||
} RunInterface;
|
||||
|
||||
static RunInterface runint =
|
||||
{
|
||||
NULL, /* dialog */
|
||||
{
|
||||
{ NULL, NULL, NULL, { 0 } }, /* Color selection dialogs */
|
||||
{ NULL, NULL, NULL, { 0 } },
|
||||
{ NULL, NULL, NULL, { 0 } },
|
||||
{ NULL, NULL, NULL, { 0 } }
|
||||
},
|
||||
NULL, /* plug-in values */
|
||||
FALSE /* run */
|
||||
};
|
||||
|
||||
|
||||
/* Declare some local functions.
|
||||
*/
|
||||
static void query (void);
|
||||
static void run (char *name,
|
||||
int nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
|
||||
GPlugInInfo PLUG_IN_INFO =
|
||||
{
|
||||
NULL, /* init_proc */
|
||||
NULL, /* quit_proc */
|
||||
query, /* query_proc */
|
||||
run, /* run_proc */
|
||||
};
|
||||
|
||||
static gint dialog (PLVALS *plvals);
|
||||
static void mapcolor_close_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void mapcolor_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void add_color_button (int csel_index, int left, int top,
|
||||
GtkWidget *table, PLVALS *plvals);
|
||||
static void color_select_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_select_cancel_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_preview_show (GtkWidget *widget,
|
||||
unsigned char *color);
|
||||
|
||||
static void color_mapping (GDrawable *drawable, PLVALS *plvals);
|
||||
|
||||
|
||||
/* The run mode */
|
||||
static GRunModeType l_run_mode;
|
||||
|
||||
|
||||
MAIN ()
|
||||
|
||||
|
||||
static void
|
||||
query (void)
|
||||
|
||||
{
|
||||
static GParamDef adjust_args[] =
|
||||
{
|
||||
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
||||
{ PARAM_IMAGE, "image", "Input image (not used)" },
|
||||
{ PARAM_DRAWABLE, "drawable", "Input drawable to adjust" }
|
||||
};
|
||||
static int nadjust_args = sizeof (adjust_args) / sizeof (adjust_args[0]);
|
||||
|
||||
static GParamDef map_args[] =
|
||||
{
|
||||
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
||||
{ PARAM_IMAGE, "image", "Input image (not used)" },
|
||||
{ PARAM_DRAWABLE, "drawable", "Input drawable where colors are to map" },
|
||||
{ PARAM_COLOR, "srccolor_1", "First source color" },
|
||||
{ PARAM_COLOR, "srccolor_2", "Second source color" },
|
||||
{ PARAM_COLOR, "dstcolor_1", "First destination color" },
|
||||
{ PARAM_COLOR, "dstcolor_2", "Second destination color" },
|
||||
{ PARAM_INT32, "map_mode", "Mapping mode (0: linear, others reserved)" }
|
||||
};
|
||||
static int nmap_args = sizeof (map_args) / sizeof (map_args[0]);
|
||||
|
||||
gimp_install_procedure ("plug_in_color_adjust",
|
||||
"Adjust current foreground/background color in the\
|
||||
drawable to black/white",
|
||||
"The current foreground color is mapped to black, \
|
||||
the current background color is mapped to white.",
|
||||
"Peter Kirchgessner",
|
||||
"Peter Kirchgessner",
|
||||
dversio,
|
||||
"<Image>/Filters/Colors/Adjust Fgrd.-Bkgrd.",
|
||||
"RGB*",
|
||||
PROC_PLUG_IN,
|
||||
nadjust_args, 0,
|
||||
adjust_args, NULL);
|
||||
|
||||
gimp_install_procedure ("plug_in_color_map",
|
||||
"Map two source colors to two destination colors. \
|
||||
Other colors are mapped by interpolation.",
|
||||
"Map two source colors to two destination colors. \
|
||||
Other colors are mapped by interpolation.",
|
||||
"Peter Kirchgessner",
|
||||
"Peter Kirchgessner",
|
||||
dversio,
|
||||
"<Image>/Filters/Colors/Color Mapping",
|
||||
"RGB*",
|
||||
PROC_PLUG_IN,
|
||||
nmap_args, 0,
|
||||
map_args, NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
run (char *name,
|
||||
int nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
GParam **return_vals)
|
||||
|
||||
{
|
||||
static GParam values[1];
|
||||
GRunModeType run_mode;
|
||||
GDrawable *drawable = NULL;
|
||||
GStatusType status = STATUS_SUCCESS;
|
||||
guchar *c = (guchar *)ident;
|
||||
int j;
|
||||
static PLVALS plvals =
|
||||
{
|
||||
{ { 0, 0, 0}, { 255, 255, 255 }, { 0, 0, 0 }, { 255, 255, 255 } },
|
||||
0
|
||||
};
|
||||
|
||||
l_run_mode = run_mode = param[0].data.d_int32;
|
||||
|
||||
*nreturn_vals = 1;
|
||||
*return_vals = values;
|
||||
|
||||
values[0].type = PARAM_STATUS;
|
||||
values[0].data.d_status = status;
|
||||
|
||||
while (status == STATUS_SUCCESS)
|
||||
{
|
||||
if (nparams < 3)
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Make sure the drawable is RGB color */
|
||||
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
||||
if (!gimp_drawable_color (drawable->id))
|
||||
{
|
||||
gimp_message ("color_adjust/color_map: cannot operate on grey/indexed\
|
||||
images");
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
if (strcmp (name, "plug_in_color_adjust") == 0)
|
||||
{
|
||||
if (nparams != 3) /* Make sure all the arguments are there */
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
c = &(plvals.colors[0][0]); /* First source color */
|
||||
gimp_palette_get_foreground (c, c+1, c+2);
|
||||
c = &(plvals.colors[1][0]); /* Second source color */
|
||||
gimp_palette_get_background (c, c+1, c+2);
|
||||
c = &(plvals.colors[2][0]); /* First destination color */
|
||||
c[0] = c[1] = c[2] = 0; /* Foreground mapped to black */
|
||||
c = &(plvals.colors[3][0]); /* second destination color */
|
||||
c[0] = c[1] = c[2] = 255; /* Background mapped to white */
|
||||
plvals.map_mode = 0;
|
||||
|
||||
if (run_mode != RUN_NONINTERACTIVE)
|
||||
gimp_progress_init ("Adjust Foreground/Background");
|
||||
|
||||
color_mapping (drawable, &plvals);
|
||||
break;
|
||||
}
|
||||
|
||||
if (strcmp (name, "plug_in_color_map") == 0)
|
||||
{
|
||||
if (run_mode == RUN_NONINTERACTIVE)
|
||||
{
|
||||
if (nparams != 8) /* Make sure all the arguments are there */
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
plvals.colors[j][0] = param[3+j].data.d_color.red;
|
||||
plvals.colors[j][1] = param[3+j].data.d_color.green;
|
||||
plvals.colors[j][2] = param[3+j].data.d_color.blue;
|
||||
}
|
||||
plvals.map_mode = param[7].data.d_int32;
|
||||
}
|
||||
else if (run_mode == RUN_INTERACTIVE)
|
||||
{
|
||||
gimp_get_data (name, &plvals);
|
||||
|
||||
c = &(plvals.colors[0][0]); /* First source color */
|
||||
gimp_palette_get_foreground (c, c+1, c+2);
|
||||
c = &(plvals.colors[1][0]); /* Second source color */
|
||||
gimp_palette_get_background (c, c+1, c+2);
|
||||
|
||||
if (!dialog (&plvals)) break;
|
||||
}
|
||||
else if (run_mode == RUN_WITH_LAST_VALS)
|
||||
{
|
||||
gimp_get_data (name, &plvals);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
if (run_mode != RUN_NONINTERACTIVE)
|
||||
gimp_progress_init ("Mapping colors");
|
||||
|
||||
color_mapping (drawable, &plvals);
|
||||
|
||||
if (run_mode == RUN_INTERACTIVE)
|
||||
gimp_set_data (name, &plvals, sizeof (plvals));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
if ((status == STATUS_SUCCESS) && (run_mode != RUN_NONINTERACTIVE))
|
||||
gimp_displays_flush ();
|
||||
|
||||
if (drawable != NULL) gimp_drawable_detach (drawable);
|
||||
values[0].data.d_status = status;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
dialog (PLVALS *plvals)
|
||||
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *dlg;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *table;
|
||||
guchar *color_cube;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
argv[0] = g_strdup ("Map colors");
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
gtk_rc_parse (gimp_gtkrc ());
|
||||
|
||||
gdk_set_use_xshm(gimp_use_xshm());
|
||||
|
||||
gtk_preview_set_gamma(gimp_gamma());
|
||||
gtk_preview_set_install_cmap(gimp_install_cmap());
|
||||
color_cube = gimp_color_cube();
|
||||
gtk_preview_set_color_cube(color_cube[0], color_cube[1], color_cube[2],
|
||||
color_cube[3]);
|
||||
gtk_widget_set_default_visual(gtk_preview_get_visual());
|
||||
gtk_widget_set_default_colormap(gtk_preview_get_cmap());
|
||||
|
||||
runint.dialog = dlg = gtk_dialog_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (dlg), "Map colors");
|
||||
gtk_window_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
|
||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||
(GtkSignalFunc) mapcolor_close_callback,
|
||||
NULL);
|
||||
|
||||
/* Action area */
|
||||
button = gtk_button_new_with_label ("OK");
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) mapcolor_ok_callback, dlg);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->action_area), button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("Cancel");
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gtk_widget_destroy,
|
||||
GTK_OBJECT (dlg));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->action_area), button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* parameter settings */
|
||||
runint.plvals = plvals;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 0);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* The table keeps the color selections */
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
add_color_button (0, 0, 1, table, plvals);
|
||||
add_color_button (1, 0, 2, table, plvals);
|
||||
add_color_button (2, 2, 1, table, plvals);
|
||||
add_color_button (3, 2, 2, table, plvals);
|
||||
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
gtk_main ();
|
||||
gdk_flush ();
|
||||
|
||||
return runint.run;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
color_preview_show (GtkWidget *widget,
|
||||
unsigned char *rgb)
|
||||
|
||||
{guchar *buf, *bp;
|
||||
int j, width, height;
|
||||
|
||||
width = PRV_WIDTH;
|
||||
height = PRV_HEIGHT;
|
||||
|
||||
bp = buf = g_malloc (width*3);
|
||||
if (buf == NULL) return;
|
||||
|
||||
for (j = 0; j < width; j++)
|
||||
{
|
||||
*(bp++) = rgb[0];
|
||||
*(bp++) = rgb[1];
|
||||
*(bp++) = rgb[2];
|
||||
}
|
||||
for (j = 0; j < height; j++)
|
||||
gtk_preview_draw_row (GTK_PREVIEW (widget), buf, 0, j, width);
|
||||
|
||||
gtk_widget_draw (widget, NULL);
|
||||
|
||||
g_free (buf);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
color_select_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
||||
{gdouble color[3];
|
||||
int idx, j;
|
||||
GtkWidget *dialog;
|
||||
|
||||
idx = (int)data;
|
||||
if ((dialog = runint.csel[idx].colselect) == NULL) return;
|
||||
|
||||
gtk_color_selection_get_color (
|
||||
GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (dialog)->colorsel),
|
||||
color);
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
runint.csel[idx].color[j] = (unsigned char)(color[j]*255.0);
|
||||
|
||||
color_preview_show (runint.csel[idx].preview, &(runint.csel[idx].color[0]));
|
||||
|
||||
runint.csel[idx].colselect = NULL;
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
color_select_cancel_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
||||
{int idx;
|
||||
GtkWidget *dialog;
|
||||
|
||||
idx = (int)data;
|
||||
if ((dialog = runint.csel[idx].colselect) == NULL) return;
|
||||
|
||||
runint.csel[idx].colselect = NULL;
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mapcolor_color_button_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
||||
{int idx, j;
|
||||
GtkColorSelectionDialog *csd;
|
||||
GtkWidget *dialog;
|
||||
gdouble colour[3];
|
||||
static char *label[4] = { "First source color", "Second source color",
|
||||
"First destination color", "Second destination color" };
|
||||
|
||||
idx = (int)data;
|
||||
|
||||
/* Is the colour selection dialog already running ? */
|
||||
if (runint.csel[idx].colselect != NULL) return;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
colour[j] = runint.csel[idx].color[j] / 255.0;
|
||||
|
||||
dialog = runint.csel[idx].colselect = gtk_color_selection_dialog_new (
|
||||
label[idx]);
|
||||
|
||||
csd = GTK_COLOR_SELECTION_DIALOG (dialog);
|
||||
|
||||
gtk_widget_destroy (csd->help_button);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
|
||||
(GtkSignalFunc) color_select_cancel_callback, data);
|
||||
gtk_signal_connect (GTK_OBJECT (csd->ok_button), "clicked",
|
||||
(GtkSignalFunc) color_select_ok_callback, data);
|
||||
gtk_signal_connect (GTK_OBJECT (csd->cancel_button), "clicked",
|
||||
(GtkSignalFunc) color_select_cancel_callback, data);
|
||||
|
||||
gtk_color_selection_set_color (GTK_COLOR_SELECTION (csd->colorsel), colour);
|
||||
|
||||
gtk_window_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
add_color_button (int csel_index,
|
||||
int left,
|
||||
int top,
|
||||
GtkWidget *table,
|
||||
PLVALS *plvals)
|
||||
|
||||
{
|
||||
GtkWidget *label;
|
||||
GtkWidget *button;
|
||||
GtkWidget *preview;
|
||||
GtkWidget *hbox;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_table_attach (GTK_TABLE (table), hbox, left, left+1, top, top+1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
|
||||
label = gtk_label_new ((left == 0) ? "From:" : "To:");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
|
||||
gtk_widget_show (label);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_table_attach (GTK_TABLE (table), hbox, left+1, left+2, top, top+1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
|
||||
button = runint.csel[csel_index].activate = gtk_button_new ();
|
||||
|
||||
memcpy (&(runint.csel[csel_index].color[0]),
|
||||
&(plvals->colors[csel_index][0]), 3);
|
||||
preview = runint.csel[csel_index].preview = gtk_preview_new(GTK_PREVIEW_COLOR);
|
||||
gtk_preview_size (GTK_PREVIEW (preview), PRV_WIDTH, PRV_HEIGHT);
|
||||
gtk_container_add (GTK_CONTAINER (button), preview);
|
||||
gtk_widget_show (preview);
|
||||
|
||||
color_preview_show (preview, &(runint.csel[csel_index].color[0]));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) mapcolor_color_button_callback,
|
||||
(gpointer)csel_index);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
gtk_widget_show (hbox);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mapcolor_close_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mapcolor_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
||||
{int j;
|
||||
GtkWidget *dialog;
|
||||
PLVALS *plvals = runint.plvals;
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
memcpy (&(plvals->colors[j][0]), &(runint.csel[j].color[0]), 3);
|
||||
|
||||
/* Destroy color selection dialogs if still running */
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
dialog = runint.csel[j].colselect;
|
||||
if (dialog != NULL)
|
||||
{
|
||||
runint.csel[j].colselect = NULL;
|
||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
}
|
||||
}
|
||||
plvals->map_mode = 0; /* Currently always linear mapping */
|
||||
|
||||
runint.run = TRUE;
|
||||
gtk_widget_destroy (GTK_WIDGET (data));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
get_mapping (guchar *src_col1,
|
||||
guchar *src_col2,
|
||||
guchar *dst_col1,
|
||||
guchar *dst_col2,
|
||||
gint32 map_mode,
|
||||
guchar *redmap,
|
||||
guchar *greenmap,
|
||||
guchar *bluemap)
|
||||
|
||||
{int rgb, i, j, a, as, b, bs;
|
||||
guchar *colormap[3];
|
||||
|
||||
/* Currently we always do a linear mapping */
|
||||
|
||||
colormap[0] = redmap;
|
||||
colormap[1] = greenmap;
|
||||
colormap[2] = bluemap;
|
||||
|
||||
switch (map_mode)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
for (rgb = 0; rgb < 3; rgb++)
|
||||
{
|
||||
a = src_col1[rgb]; as = dst_col1[rgb];
|
||||
b = src_col2[rgb]; bs = dst_col2[rgb];
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
j = ((i - a) * (bs - as)) / (b - a) + as;
|
||||
if (j > 255) j = 255; else if (j < 0) j = 0;
|
||||
colormap[rgb][i] = j;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
color_mapping (GDrawable *drawable,
|
||||
PLVALS *plvals)
|
||||
|
||||
{
|
||||
int processed, total;
|
||||
gint x, y, xmin, xmax, ymin, ymax;
|
||||
unsigned char *src, *dest;
|
||||
GPixelRgn src_rgn, dest_rgn;
|
||||
gpointer pr;
|
||||
double progress;
|
||||
unsigned char redmap[256], greenmap[256], bluemap[256];
|
||||
unsigned char *src_col1 = plvals->colors[0];
|
||||
unsigned char *src_col2 = plvals->colors[1];
|
||||
unsigned char *dst_col1 = plvals->colors[2];
|
||||
unsigned char *dst_col2 = plvals->colors[3];
|
||||
|
||||
if ( (src_col1[0] == src_col2[0])
|
||||
|| (src_col1[1] == src_col2[1])
|
||||
|| (src_col1[2] == src_col2[2])) return;
|
||||
|
||||
gimp_drawable_mask_bounds (drawable->id, &xmin, &ymin, &xmax, &ymax);
|
||||
if ((ymin == ymax) || (xmin == xmax)) return;
|
||||
total = (xmax - xmin) * (ymax - ymin);
|
||||
|
||||
gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1));
|
||||
gimp_pixel_rgn_init (&src_rgn, drawable, xmin, ymin,
|
||||
(xmax - xmin), (ymax - ymin), FALSE, FALSE);
|
||||
gimp_pixel_rgn_init (&dest_rgn, drawable, xmin, ymin,
|
||||
(xmax - xmin), (ymax - ymin), TRUE, TRUE);
|
||||
|
||||
pr = gimp_pixel_rgns_register (2, &src_rgn, &dest_rgn);
|
||||
|
||||
get_mapping (src_col1, src_col2, dst_col1, dst_col2, plvals->map_mode,
|
||||
redmap, greenmap, bluemap);
|
||||
|
||||
processed = 0;
|
||||
progress = 0.0;
|
||||
for (; pr != NULL; pr = gimp_pixel_rgns_process (pr))
|
||||
{
|
||||
for (y = 0; y < src_rgn.h; y++)
|
||||
{
|
||||
src = src_rgn.data + y * src_rgn.rowstride;
|
||||
dest = dest_rgn.data + y * dest_rgn.rowstride;
|
||||
for (x = 0; x < src_rgn.w; x++)
|
||||
{
|
||||
dest[0] = redmap[src[0]];
|
||||
dest[1] = greenmap[src[1]];
|
||||
dest[2] = bluemap[src[2]];
|
||||
src += drawable->bpp;
|
||||
dest += drawable->bpp;
|
||||
processed++;
|
||||
}
|
||||
}
|
||||
if (l_run_mode != RUN_NONINTERACTIVE)
|
||||
{
|
||||
if ((double)processed/(double)total - progress > 0.1)
|
||||
{
|
||||
progress = (double)processed/(double)total;
|
||||
gimp_progress_update (progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (l_run_mode != RUN_NONINTERACTIVE)
|
||||
gimp_progress_update (1.0);
|
||||
|
||||
gimp_drawable_flush (drawable);
|
||||
gimp_drawable_merge_shadow (drawable->id, TRUE);
|
||||
gimp_drawable_update (drawable->id, xmin, ymin, (xmax - xmin), (ymax - ymin));
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -82,8 +82,9 @@ gimp_db_browser(void (* apply_callback) ( gchar *selected_proc_name,
|
|||
/* list : list in a scrolled_win */
|
||||
|
||||
dbbrowser->clist = gtk_clist_new(1);
|
||||
gtk_clist_set_policy (GTK_CLIST (dbbrowser->clist), GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
dbbrowser->scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (dbbrowser->scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (dbbrowser->clist),
|
||||
GTK_SELECTION_BROWSE);
|
||||
|
||||
|
@ -91,9 +92,10 @@ gimp_db_browser(void (* apply_callback) ( gchar *selected_proc_name,
|
|||
gtk_signal_connect (GTK_OBJECT (dbbrowser->clist), "select_row",
|
||||
(GtkSignalFunc) procedure_select_callback,
|
||||
dbbrowser);
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
dbbrowser->clist, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), dbbrowser->scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (dbbrowser->scrolled_win), dbbrowser->clist);
|
||||
gtk_widget_show(dbbrowser->clist);
|
||||
gtk_widget_show(dbbrowser->scrolled_win);
|
||||
|
||||
/* search entry */
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ typedef struct {
|
|||
GtkWidget* descr_table;
|
||||
|
||||
GtkWidget* clist;
|
||||
GtkWidget* scrolled_win;
|
||||
|
||||
/* the currently selected procedure */
|
||||
gchar *selected_proc_name;
|
||||
|
|
|
@ -82,8 +82,9 @@ gimp_db_browser(void (* apply_callback) ( gchar *selected_proc_name,
|
|||
/* list : list in a scrolled_win */
|
||||
|
||||
dbbrowser->clist = gtk_clist_new(1);
|
||||
gtk_clist_set_policy (GTK_CLIST (dbbrowser->clist), GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
dbbrowser->scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (dbbrowser->scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (dbbrowser->clist),
|
||||
GTK_SELECTION_BROWSE);
|
||||
|
||||
|
@ -91,9 +92,10 @@ gimp_db_browser(void (* apply_callback) ( gchar *selected_proc_name,
|
|||
gtk_signal_connect (GTK_OBJECT (dbbrowser->clist), "select_row",
|
||||
(GtkSignalFunc) procedure_select_callback,
|
||||
dbbrowser);
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
dbbrowser->clist, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), dbbrowser->scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (dbbrowser->scrolled_win), dbbrowser->clist);
|
||||
gtk_widget_show(dbbrowser->clist);
|
||||
gtk_widget_show(dbbrowser->scrolled_win);
|
||||
|
||||
/* search entry */
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ typedef struct {
|
|||
GtkWidget* descr_table;
|
||||
|
||||
GtkWidget* clist;
|
||||
GtkWidget* scrolled_win;
|
||||
|
||||
/* the currently selected procedure */
|
||||
gchar *selected_proc_name;
|
||||
|
|
|
@ -82,8 +82,9 @@ gimp_db_browser(void (* apply_callback) ( gchar *selected_proc_name,
|
|||
/* list : list in a scrolled_win */
|
||||
|
||||
dbbrowser->clist = gtk_clist_new(1);
|
||||
gtk_clist_set_policy (GTK_CLIST (dbbrowser->clist), GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
dbbrowser->scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (dbbrowser->scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (dbbrowser->clist),
|
||||
GTK_SELECTION_BROWSE);
|
||||
|
||||
|
@ -91,9 +92,10 @@ gimp_db_browser(void (* apply_callback) ( gchar *selected_proc_name,
|
|||
gtk_signal_connect (GTK_OBJECT (dbbrowser->clist), "select_row",
|
||||
(GtkSignalFunc) procedure_select_callback,
|
||||
dbbrowser);
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
dbbrowser->clist, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), dbbrowser->scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (dbbrowser->scrolled_win), dbbrowser->clist);
|
||||
gtk_widget_show(dbbrowser->clist);
|
||||
gtk_widget_show(dbbrowser->scrolled_win);
|
||||
|
||||
/* search entry */
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
Makefile.in
|
||||
Makefile
|
||||
.deps
|
||||
_libs
|
||||
.libs
|
||||
lic
|
|
@ -0,0 +1,38 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
pluginlibdir = $(gimpplugindir)/plug-ins
|
||||
|
||||
pluginlib_PROGRAMS = lic
|
||||
|
||||
lic_SOURCES = \
|
||||
lic.c
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
$(GTK_CFLAGS) \
|
||||
-I$(includedir)
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/libgimp/libgimpui.la \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(GTK_LIBS) \
|
||||
@LIBJPEG_LIB@
|
||||
|
||||
DEPS = \
|
||||
$(top_builddir)/libgimp/libgimpui.la \
|
||||
$(top_builddir)/libgimp/libgimp.la
|
||||
|
||||
lic_DEPENDENCIES = $(DEPS)
|
||||
|
||||
.PHONY: files
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
@for subdir in $(SUBDIRS); do \
|
||||
files=`cd $$subdir; $(MAKE) files | grep -v "make\[[1-9]\]"`; \
|
||||
for file in $$files; do \
|
||||
echo $$subdir/$$file; \
|
||||
done; \
|
||||
done
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,6 @@
|
|||
Makefile.in
|
||||
Makefile
|
||||
.deps
|
||||
_libs
|
||||
.libs
|
||||
mapcolor
|
|
@ -0,0 +1,36 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
pluginlibdir = $(gimpplugindir)/plug-ins
|
||||
|
||||
pluginlib_PROGRAMS = mapcolor
|
||||
|
||||
mapcolor_SOURCES = \
|
||||
mapcolor.c
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
$(GTK_CFLAGS) \
|
||||
-I$(includedir)
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(GTK_LIBS) \
|
||||
@LIBJPEG_LIB@
|
||||
|
||||
DEPS = \
|
||||
$(top_builddir)/libgimp/libgimp.la
|
||||
|
||||
mapcolor_DEPENDENCIES = $(DEPS)
|
||||
|
||||
.PHONY: files
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
@for subdir in $(SUBDIRS); do \
|
||||
files=`cd $$subdir; $(MAKE) files | grep -v "make\[[1-9]\]"`; \
|
||||
for file in $$files; do \
|
||||
echo $$subdir/$$file; \
|
||||
done; \
|
||||
done
|
|
@ -0,0 +1,696 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
* mapcolor plugin
|
||||
* Copyright (C) 1998 Peter Kirchgessner
|
||||
* (email: pkirchg@aol.com, WWW: http://members.aol.com/pkirchg)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Event history:
|
||||
* V 1.00, PK, 26-Oct-98: Creation.
|
||||
*/
|
||||
#define VERSIO 1.00
|
||||
static char dversio[] = "v1.00 26-Oct-98";
|
||||
static char ident[] = "@(#) GIMP mapcolor plug-in v1.00 26-Oct-98";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include "gtk/gtk.h"
|
||||
#include "libgimp/gimp.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#define PRV_WIDTH 50
|
||||
#define PRV_HEIGHT 20
|
||||
|
||||
typedef struct
|
||||
{
|
||||
guchar colors[4][3];
|
||||
gint32 map_mode;
|
||||
} PLVALS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *activate; /* The button that activates the color sel. dialog */
|
||||
GtkWidget *colselect; /* The colour selection dialog itself */
|
||||
GtkWidget *preview; /* The colour preview */
|
||||
unsigned char color[3];/* The selected colour */
|
||||
} CSEL;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
CSEL csel[4];
|
||||
PLVALS *plvals;
|
||||
gint run; /* run */
|
||||
} RunInterface;
|
||||
|
||||
static RunInterface runint =
|
||||
{
|
||||
NULL, /* dialog */
|
||||
{
|
||||
{ NULL, NULL, NULL, { 0 } }, /* Color selection dialogs */
|
||||
{ NULL, NULL, NULL, { 0 } },
|
||||
{ NULL, NULL, NULL, { 0 } },
|
||||
{ NULL, NULL, NULL, { 0 } }
|
||||
},
|
||||
NULL, /* plug-in values */
|
||||
FALSE /* run */
|
||||
};
|
||||
|
||||
|
||||
/* Declare some local functions.
|
||||
*/
|
||||
static void query (void);
|
||||
static void run (char *name,
|
||||
int nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
|
||||
GPlugInInfo PLUG_IN_INFO =
|
||||
{
|
||||
NULL, /* init_proc */
|
||||
NULL, /* quit_proc */
|
||||
query, /* query_proc */
|
||||
run, /* run_proc */
|
||||
};
|
||||
|
||||
static gint dialog (PLVALS *plvals);
|
||||
static void mapcolor_close_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void mapcolor_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void add_color_button (int csel_index, int left, int top,
|
||||
GtkWidget *table, PLVALS *plvals);
|
||||
static void color_select_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_select_cancel_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_preview_show (GtkWidget *widget,
|
||||
unsigned char *color);
|
||||
|
||||
static void color_mapping (GDrawable *drawable, PLVALS *plvals);
|
||||
|
||||
|
||||
/* The run mode */
|
||||
static GRunModeType l_run_mode;
|
||||
|
||||
|
||||
MAIN ()
|
||||
|
||||
|
||||
static void
|
||||
query (void)
|
||||
|
||||
{
|
||||
static GParamDef adjust_args[] =
|
||||
{
|
||||
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
||||
{ PARAM_IMAGE, "image", "Input image (not used)" },
|
||||
{ PARAM_DRAWABLE, "drawable", "Input drawable to adjust" }
|
||||
};
|
||||
static int nadjust_args = sizeof (adjust_args) / sizeof (adjust_args[0]);
|
||||
|
||||
static GParamDef map_args[] =
|
||||
{
|
||||
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
||||
{ PARAM_IMAGE, "image", "Input image (not used)" },
|
||||
{ PARAM_DRAWABLE, "drawable", "Input drawable where colors are to map" },
|
||||
{ PARAM_COLOR, "srccolor_1", "First source color" },
|
||||
{ PARAM_COLOR, "srccolor_2", "Second source color" },
|
||||
{ PARAM_COLOR, "dstcolor_1", "First destination color" },
|
||||
{ PARAM_COLOR, "dstcolor_2", "Second destination color" },
|
||||
{ PARAM_INT32, "map_mode", "Mapping mode (0: linear, others reserved)" }
|
||||
};
|
||||
static int nmap_args = sizeof (map_args) / sizeof (map_args[0]);
|
||||
|
||||
gimp_install_procedure ("plug_in_color_adjust",
|
||||
"Adjust current foreground/background color in the\
|
||||
drawable to black/white",
|
||||
"The current foreground color is mapped to black, \
|
||||
the current background color is mapped to white.",
|
||||
"Peter Kirchgessner",
|
||||
"Peter Kirchgessner",
|
||||
dversio,
|
||||
"<Image>/Filters/Colors/Adjust Fgrd.-Bkgrd.",
|
||||
"RGB*",
|
||||
PROC_PLUG_IN,
|
||||
nadjust_args, 0,
|
||||
adjust_args, NULL);
|
||||
|
||||
gimp_install_procedure ("plug_in_color_map",
|
||||
"Map two source colors to two destination colors. \
|
||||
Other colors are mapped by interpolation.",
|
||||
"Map two source colors to two destination colors. \
|
||||
Other colors are mapped by interpolation.",
|
||||
"Peter Kirchgessner",
|
||||
"Peter Kirchgessner",
|
||||
dversio,
|
||||
"<Image>/Filters/Colors/Color Mapping",
|
||||
"RGB*",
|
||||
PROC_PLUG_IN,
|
||||
nmap_args, 0,
|
||||
map_args, NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
run (char *name,
|
||||
int nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
GParam **return_vals)
|
||||
|
||||
{
|
||||
static GParam values[1];
|
||||
GRunModeType run_mode;
|
||||
GDrawable *drawable = NULL;
|
||||
GStatusType status = STATUS_SUCCESS;
|
||||
guchar *c = (guchar *)ident;
|
||||
int j;
|
||||
static PLVALS plvals =
|
||||
{
|
||||
{ { 0, 0, 0}, { 255, 255, 255 }, { 0, 0, 0 }, { 255, 255, 255 } },
|
||||
0
|
||||
};
|
||||
|
||||
l_run_mode = run_mode = param[0].data.d_int32;
|
||||
|
||||
*nreturn_vals = 1;
|
||||
*return_vals = values;
|
||||
|
||||
values[0].type = PARAM_STATUS;
|
||||
values[0].data.d_status = status;
|
||||
|
||||
while (status == STATUS_SUCCESS)
|
||||
{
|
||||
if (nparams < 3)
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Make sure the drawable is RGB color */
|
||||
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
||||
if (!gimp_drawable_color (drawable->id))
|
||||
{
|
||||
gimp_message ("color_adjust/color_map: cannot operate on grey/indexed\
|
||||
images");
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
if (strcmp (name, "plug_in_color_adjust") == 0)
|
||||
{
|
||||
if (nparams != 3) /* Make sure all the arguments are there */
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
c = &(plvals.colors[0][0]); /* First source color */
|
||||
gimp_palette_get_foreground (c, c+1, c+2);
|
||||
c = &(plvals.colors[1][0]); /* Second source color */
|
||||
gimp_palette_get_background (c, c+1, c+2);
|
||||
c = &(plvals.colors[2][0]); /* First destination color */
|
||||
c[0] = c[1] = c[2] = 0; /* Foreground mapped to black */
|
||||
c = &(plvals.colors[3][0]); /* second destination color */
|
||||
c[0] = c[1] = c[2] = 255; /* Background mapped to white */
|
||||
plvals.map_mode = 0;
|
||||
|
||||
if (run_mode != RUN_NONINTERACTIVE)
|
||||
gimp_progress_init ("Adjust Foreground/Background");
|
||||
|
||||
color_mapping (drawable, &plvals);
|
||||
break;
|
||||
}
|
||||
|
||||
if (strcmp (name, "plug_in_color_map") == 0)
|
||||
{
|
||||
if (run_mode == RUN_NONINTERACTIVE)
|
||||
{
|
||||
if (nparams != 8) /* Make sure all the arguments are there */
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
plvals.colors[j][0] = param[3+j].data.d_color.red;
|
||||
plvals.colors[j][1] = param[3+j].data.d_color.green;
|
||||
plvals.colors[j][2] = param[3+j].data.d_color.blue;
|
||||
}
|
||||
plvals.map_mode = param[7].data.d_int32;
|
||||
}
|
||||
else if (run_mode == RUN_INTERACTIVE)
|
||||
{
|
||||
gimp_get_data (name, &plvals);
|
||||
|
||||
c = &(plvals.colors[0][0]); /* First source color */
|
||||
gimp_palette_get_foreground (c, c+1, c+2);
|
||||
c = &(plvals.colors[1][0]); /* Second source color */
|
||||
gimp_palette_get_background (c, c+1, c+2);
|
||||
|
||||
if (!dialog (&plvals)) break;
|
||||
}
|
||||
else if (run_mode == RUN_WITH_LAST_VALS)
|
||||
{
|
||||
gimp_get_data (name, &plvals);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
if (run_mode != RUN_NONINTERACTIVE)
|
||||
gimp_progress_init ("Mapping colors");
|
||||
|
||||
color_mapping (drawable, &plvals);
|
||||
|
||||
if (run_mode == RUN_INTERACTIVE)
|
||||
gimp_set_data (name, &plvals, sizeof (plvals));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
if ((status == STATUS_SUCCESS) && (run_mode != RUN_NONINTERACTIVE))
|
||||
gimp_displays_flush ();
|
||||
|
||||
if (drawable != NULL) gimp_drawable_detach (drawable);
|
||||
values[0].data.d_status = status;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
dialog (PLVALS *plvals)
|
||||
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *dlg;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *table;
|
||||
guchar *color_cube;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
argv[0] = g_strdup ("Map colors");
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
gtk_rc_parse (gimp_gtkrc ());
|
||||
|
||||
gdk_set_use_xshm(gimp_use_xshm());
|
||||
|
||||
gtk_preview_set_gamma(gimp_gamma());
|
||||
gtk_preview_set_install_cmap(gimp_install_cmap());
|
||||
color_cube = gimp_color_cube();
|
||||
gtk_preview_set_color_cube(color_cube[0], color_cube[1], color_cube[2],
|
||||
color_cube[3]);
|
||||
gtk_widget_set_default_visual(gtk_preview_get_visual());
|
||||
gtk_widget_set_default_colormap(gtk_preview_get_cmap());
|
||||
|
||||
runint.dialog = dlg = gtk_dialog_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (dlg), "Map colors");
|
||||
gtk_window_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
|
||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||
(GtkSignalFunc) mapcolor_close_callback,
|
||||
NULL);
|
||||
|
||||
/* Action area */
|
||||
button = gtk_button_new_with_label ("OK");
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) mapcolor_ok_callback, dlg);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->action_area), button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("Cancel");
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gtk_widget_destroy,
|
||||
GTK_OBJECT (dlg));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->action_area), button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* parameter settings */
|
||||
runint.plvals = plvals;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 0);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* The table keeps the color selections */
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
add_color_button (0, 0, 1, table, plvals);
|
||||
add_color_button (1, 0, 2, table, plvals);
|
||||
add_color_button (2, 2, 1, table, plvals);
|
||||
add_color_button (3, 2, 2, table, plvals);
|
||||
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
gtk_main ();
|
||||
gdk_flush ();
|
||||
|
||||
return runint.run;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
color_preview_show (GtkWidget *widget,
|
||||
unsigned char *rgb)
|
||||
|
||||
{guchar *buf, *bp;
|
||||
int j, width, height;
|
||||
|
||||
width = PRV_WIDTH;
|
||||
height = PRV_HEIGHT;
|
||||
|
||||
bp = buf = g_malloc (width*3);
|
||||
if (buf == NULL) return;
|
||||
|
||||
for (j = 0; j < width; j++)
|
||||
{
|
||||
*(bp++) = rgb[0];
|
||||
*(bp++) = rgb[1];
|
||||
*(bp++) = rgb[2];
|
||||
}
|
||||
for (j = 0; j < height; j++)
|
||||
gtk_preview_draw_row (GTK_PREVIEW (widget), buf, 0, j, width);
|
||||
|
||||
gtk_widget_draw (widget, NULL);
|
||||
|
||||
g_free (buf);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
color_select_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
||||
{gdouble color[3];
|
||||
int idx, j;
|
||||
GtkWidget *dialog;
|
||||
|
||||
idx = (int)data;
|
||||
if ((dialog = runint.csel[idx].colselect) == NULL) return;
|
||||
|
||||
gtk_color_selection_get_color (
|
||||
GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (dialog)->colorsel),
|
||||
color);
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
runint.csel[idx].color[j] = (unsigned char)(color[j]*255.0);
|
||||
|
||||
color_preview_show (runint.csel[idx].preview, &(runint.csel[idx].color[0]));
|
||||
|
||||
runint.csel[idx].colselect = NULL;
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
color_select_cancel_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
||||
{int idx;
|
||||
GtkWidget *dialog;
|
||||
|
||||
idx = (int)data;
|
||||
if ((dialog = runint.csel[idx].colselect) == NULL) return;
|
||||
|
||||
runint.csel[idx].colselect = NULL;
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mapcolor_color_button_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
||||
{int idx, j;
|
||||
GtkColorSelectionDialog *csd;
|
||||
GtkWidget *dialog;
|
||||
gdouble colour[3];
|
||||
static char *label[4] = { "First source color", "Second source color",
|
||||
"First destination color", "Second destination color" };
|
||||
|
||||
idx = (int)data;
|
||||
|
||||
/* Is the colour selection dialog already running ? */
|
||||
if (runint.csel[idx].colselect != NULL) return;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
colour[j] = runint.csel[idx].color[j] / 255.0;
|
||||
|
||||
dialog = runint.csel[idx].colselect = gtk_color_selection_dialog_new (
|
||||
label[idx]);
|
||||
|
||||
csd = GTK_COLOR_SELECTION_DIALOG (dialog);
|
||||
|
||||
gtk_widget_destroy (csd->help_button);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
|
||||
(GtkSignalFunc) color_select_cancel_callback, data);
|
||||
gtk_signal_connect (GTK_OBJECT (csd->ok_button), "clicked",
|
||||
(GtkSignalFunc) color_select_ok_callback, data);
|
||||
gtk_signal_connect (GTK_OBJECT (csd->cancel_button), "clicked",
|
||||
(GtkSignalFunc) color_select_cancel_callback, data);
|
||||
|
||||
gtk_color_selection_set_color (GTK_COLOR_SELECTION (csd->colorsel), colour);
|
||||
|
||||
gtk_window_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
add_color_button (int csel_index,
|
||||
int left,
|
||||
int top,
|
||||
GtkWidget *table,
|
||||
PLVALS *plvals)
|
||||
|
||||
{
|
||||
GtkWidget *label;
|
||||
GtkWidget *button;
|
||||
GtkWidget *preview;
|
||||
GtkWidget *hbox;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_table_attach (GTK_TABLE (table), hbox, left, left+1, top, top+1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
|
||||
label = gtk_label_new ((left == 0) ? "From:" : "To:");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
|
||||
gtk_widget_show (label);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_table_attach (GTK_TABLE (table), hbox, left+1, left+2, top, top+1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
|
||||
button = runint.csel[csel_index].activate = gtk_button_new ();
|
||||
|
||||
memcpy (&(runint.csel[csel_index].color[0]),
|
||||
&(plvals->colors[csel_index][0]), 3);
|
||||
preview = runint.csel[csel_index].preview = gtk_preview_new(GTK_PREVIEW_COLOR);
|
||||
gtk_preview_size (GTK_PREVIEW (preview), PRV_WIDTH, PRV_HEIGHT);
|
||||
gtk_container_add (GTK_CONTAINER (button), preview);
|
||||
gtk_widget_show (preview);
|
||||
|
||||
color_preview_show (preview, &(runint.csel[csel_index].color[0]));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) mapcolor_color_button_callback,
|
||||
(gpointer)csel_index);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
gtk_widget_show (hbox);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mapcolor_close_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mapcolor_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
||||
{int j;
|
||||
GtkWidget *dialog;
|
||||
PLVALS *plvals = runint.plvals;
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
memcpy (&(plvals->colors[j][0]), &(runint.csel[j].color[0]), 3);
|
||||
|
||||
/* Destroy color selection dialogs if still running */
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
dialog = runint.csel[j].colselect;
|
||||
if (dialog != NULL)
|
||||
{
|
||||
runint.csel[j].colselect = NULL;
|
||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
}
|
||||
}
|
||||
plvals->map_mode = 0; /* Currently always linear mapping */
|
||||
|
||||
runint.run = TRUE;
|
||||
gtk_widget_destroy (GTK_WIDGET (data));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
get_mapping (guchar *src_col1,
|
||||
guchar *src_col2,
|
||||
guchar *dst_col1,
|
||||
guchar *dst_col2,
|
||||
gint32 map_mode,
|
||||
guchar *redmap,
|
||||
guchar *greenmap,
|
||||
guchar *bluemap)
|
||||
|
||||
{int rgb, i, j, a, as, b, bs;
|
||||
guchar *colormap[3];
|
||||
|
||||
/* Currently we always do a linear mapping */
|
||||
|
||||
colormap[0] = redmap;
|
||||
colormap[1] = greenmap;
|
||||
colormap[2] = bluemap;
|
||||
|
||||
switch (map_mode)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
for (rgb = 0; rgb < 3; rgb++)
|
||||
{
|
||||
a = src_col1[rgb]; as = dst_col1[rgb];
|
||||
b = src_col2[rgb]; bs = dst_col2[rgb];
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
j = ((i - a) * (bs - as)) / (b - a) + as;
|
||||
if (j > 255) j = 255; else if (j < 0) j = 0;
|
||||
colormap[rgb][i] = j;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
color_mapping (GDrawable *drawable,
|
||||
PLVALS *plvals)
|
||||
|
||||
{
|
||||
int processed, total;
|
||||
gint x, y, xmin, xmax, ymin, ymax;
|
||||
unsigned char *src, *dest;
|
||||
GPixelRgn src_rgn, dest_rgn;
|
||||
gpointer pr;
|
||||
double progress;
|
||||
unsigned char redmap[256], greenmap[256], bluemap[256];
|
||||
unsigned char *src_col1 = plvals->colors[0];
|
||||
unsigned char *src_col2 = plvals->colors[1];
|
||||
unsigned char *dst_col1 = plvals->colors[2];
|
||||
unsigned char *dst_col2 = plvals->colors[3];
|
||||
|
||||
if ( (src_col1[0] == src_col2[0])
|
||||
|| (src_col1[1] == src_col2[1])
|
||||
|| (src_col1[2] == src_col2[2])) return;
|
||||
|
||||
gimp_drawable_mask_bounds (drawable->id, &xmin, &ymin, &xmax, &ymax);
|
||||
if ((ymin == ymax) || (xmin == xmax)) return;
|
||||
total = (xmax - xmin) * (ymax - ymin);
|
||||
|
||||
gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1));
|
||||
gimp_pixel_rgn_init (&src_rgn, drawable, xmin, ymin,
|
||||
(xmax - xmin), (ymax - ymin), FALSE, FALSE);
|
||||
gimp_pixel_rgn_init (&dest_rgn, drawable, xmin, ymin,
|
||||
(xmax - xmin), (ymax - ymin), TRUE, TRUE);
|
||||
|
||||
pr = gimp_pixel_rgns_register (2, &src_rgn, &dest_rgn);
|
||||
|
||||
get_mapping (src_col1, src_col2, dst_col1, dst_col2, plvals->map_mode,
|
||||
redmap, greenmap, bluemap);
|
||||
|
||||
processed = 0;
|
||||
progress = 0.0;
|
||||
for (; pr != NULL; pr = gimp_pixel_rgns_process (pr))
|
||||
{
|
||||
for (y = 0; y < src_rgn.h; y++)
|
||||
{
|
||||
src = src_rgn.data + y * src_rgn.rowstride;
|
||||
dest = dest_rgn.data + y * dest_rgn.rowstride;
|
||||
for (x = 0; x < src_rgn.w; x++)
|
||||
{
|
||||
dest[0] = redmap[src[0]];
|
||||
dest[1] = greenmap[src[1]];
|
||||
dest[2] = bluemap[src[2]];
|
||||
src += drawable->bpp;
|
||||
dest += drawable->bpp;
|
||||
processed++;
|
||||
}
|
||||
}
|
||||
if (l_run_mode != RUN_NONINTERACTIVE)
|
||||
{
|
||||
if ((double)processed/(double)total - progress > 0.1)
|
||||
{
|
||||
progress = (double)processed/(double)total;
|
||||
gimp_progress_update (progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (l_run_mode != RUN_NONINTERACTIVE)
|
||||
gimp_progress_update (1.0);
|
||||
|
||||
gimp_drawable_flush (drawable);
|
||||
gimp_drawable_merge_shadow (drawable->id, TRUE);
|
||||
gimp_drawable_update (drawable->id, xmin, ymin, (xmax - xmin), (ymax - ymin));
|
||||
}
|
|
@ -35,7 +35,8 @@ typedef enum
|
|||
SF_FONT,
|
||||
SF_PATTERN,
|
||||
SF_BRUSH,
|
||||
SF_GRADIENT
|
||||
SF_GRADIENT,
|
||||
SF_FILENAME
|
||||
} SFArgType;
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -68,6 +68,13 @@ typedef struct
|
|||
gchar *fontname;
|
||||
} SFFont;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *preview;
|
||||
GtkWidget *dialog;
|
||||
gchar *filename;
|
||||
} SFFilename;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gchar *name;
|
||||
|
@ -88,6 +95,7 @@ typedef union
|
|||
gchar * sfa_value;
|
||||
SFAdjustment sfa_adjustment;
|
||||
SFFont sfa_font;
|
||||
SFFilename sfa_file;
|
||||
gchar * sfa_pattern;
|
||||
gchar * sfa_gradient;
|
||||
SFBrush sfa_brush;
|
||||
|
@ -140,7 +148,9 @@ static void script_fu_disable_cc (gint err_msg);
|
|||
static void script_fu_interface (SFScript *script);
|
||||
static void script_fu_color_preview (GtkWidget *preview,
|
||||
gdouble *color);
|
||||
static void script_fu_font_preview (GtkWidget *preview,
|
||||
static void script_fu_file_preview (GtkWidget *preview,
|
||||
gchar *fontname);
|
||||
static void script_fu_font_preview (GtkWidget *preview,
|
||||
gchar *fontname);
|
||||
static void script_fu_cleanup_widgets (SFScript *script);
|
||||
static void script_fu_ok_callback (GtkWidget *widget,
|
||||
|
@ -164,6 +174,15 @@ static void script_fu_color_preview_cancel (GtkWidget *widget,
|
|||
static gint script_fu_color_preview_delete (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data);
|
||||
static void script_fu_file_preview_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void script_fu_file_dialog_ok (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void script_fu_file_dialog_cancel (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static gint script_fu_file_dialog_delete (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data);
|
||||
static void script_fu_font_preview_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void script_fu_font_dialog_ok (GtkWidget *widget,
|
||||
|
@ -575,6 +594,19 @@ script_fu_add_script (LISP a)
|
|||
args[i + 1].description = script->arg_labels[i];
|
||||
break;
|
||||
|
||||
case SF_FILENAME:
|
||||
if (!TYPEP (car (a), tc_string))
|
||||
return my_err ("script-fu-register: filename defaults must be string values", NIL);
|
||||
script->arg_defaults[i].sfa_file.filename = g_strdup (get_c_string (car (a)));
|
||||
script->arg_values[i].sfa_file.filename = g_strdup (script->arg_defaults[i].sfa_file.filename);
|
||||
script->arg_values[i].sfa_file.preview = NULL;
|
||||
script->arg_values[i].sfa_file.dialog = NULL;
|
||||
|
||||
args[i + 1].type = PARAM_STRING;
|
||||
args[i + 1].name = "filename";
|
||||
args[i + 1].description = script->arg_labels[i];
|
||||
break;
|
||||
|
||||
case SF_FONT:
|
||||
if (!TYPEP (car (a), tc_string))
|
||||
return my_err ("script-fu-register: font defaults must be string values", NIL);
|
||||
|
@ -776,6 +808,9 @@ script_fu_script_proc (char *name,
|
|||
case SF_STRING:
|
||||
length += strlen (params[i + 1].data.d_string) + 3;
|
||||
break;
|
||||
case SF_FILENAME:
|
||||
length += strlen (params[i + 1].data.d_string) + 3;
|
||||
break;
|
||||
case SF_ADJUSTMENT:
|
||||
length += strlen (params[i + 1].data.d_string) + 1;
|
||||
break;
|
||||
|
@ -827,6 +862,7 @@ script_fu_script_proc (char *name,
|
|||
text = params[i + 1].data.d_string;
|
||||
break;
|
||||
case SF_STRING:
|
||||
case SF_FILENAME:
|
||||
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
|
||||
text = buffer;
|
||||
break;
|
||||
|
@ -938,6 +974,10 @@ script_fu_free_script (SFScript *script)
|
|||
break;
|
||||
case SF_ADJUSTMENT:
|
||||
break;
|
||||
case SF_FILENAME:
|
||||
g_free (script->arg_defaults[i].sfa_file.filename);
|
||||
g_free (script->arg_values[i].sfa_file.filename);
|
||||
break;
|
||||
case SF_FONT:
|
||||
g_free (script->arg_defaults[i].sfa_font.fontname);
|
||||
g_free (script->arg_values[i].sfa_font.fontname);
|
||||
|
@ -1180,6 +1220,7 @@ script_fu_interface (SFScript *script)
|
|||
gtk_range_set_update_policy (GTK_RANGE (script->args_widgets[i]),
|
||||
GTK_UPDATE_DELAYED);
|
||||
break;
|
||||
|
||||
case SF_SPINNER:
|
||||
script->args_widgets[i] = gtk_spin_button_new (script->arg_values[i].sfa_adjustment.adj, 0, 0);
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (script->args_widgets[i]), TRUE);
|
||||
|
@ -1193,6 +1234,23 @@ script_fu_interface (SFScript *script)
|
|||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SF_FILENAME:
|
||||
script->args_widgets[i] = gtk_button_new();
|
||||
script->arg_values[i].sfa_file.preview = gtk_label_new ("");
|
||||
gtk_widget_set_usize (script->args_widgets[i], TEXT_WIDTH, 0);
|
||||
gtk_container_add (GTK_CONTAINER (script->args_widgets[i]),
|
||||
script->arg_values[i].sfa_file.preview);
|
||||
gtk_widget_show (script->arg_values[i].sfa_file.preview);
|
||||
|
||||
script_fu_file_preview (script->arg_values[i].sfa_file.preview,
|
||||
script->arg_values[i].sfa_file.filename);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (script->args_widgets[i]), "clicked",
|
||||
(GtkSignalFunc) script_fu_file_preview_callback,
|
||||
&script->arg_values[i].sfa_file);
|
||||
break;
|
||||
|
||||
case SF_FONT:
|
||||
script->args_widgets[i] = gtk_button_new();
|
||||
script->arg_values[i].sfa_font.preview = gtk_label_new ("");
|
||||
|
@ -1208,6 +1266,7 @@ script_fu_interface (SFScript *script)
|
|||
(GtkSignalFunc) script_fu_font_preview_callback,
|
||||
&script->arg_values[i].sfa_font);
|
||||
break;
|
||||
|
||||
case SF_PATTERN:
|
||||
script->args_widgets[i] = gimp_pattern_select_widget("Script-fu Pattern Selection",
|
||||
script->arg_values[i].sfa_pattern,
|
||||
|
@ -1220,6 +1279,7 @@ script_fu_interface (SFScript *script)
|
|||
script_fu_gradient_preview,
|
||||
&script->arg_values[i].sfa_gradient);
|
||||
break;
|
||||
|
||||
case SF_BRUSH:
|
||||
script->args_widgets[i] =
|
||||
gimp_brush_select_widget("Script-fu brush Selection",
|
||||
|
@ -1234,15 +1294,16 @@ script_fu_interface (SFScript *script)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), script->args_widgets[i],
|
||||
((script->arg_types[i] == SF_VALUE) || (script->arg_types[i] == SF_STRING) || (script->arg_types[i] == SF_FONT)),
|
||||
((script->arg_types[i] == SF_VALUE) || (script->arg_types[i] == SF_STRING) || (script->arg_types[i] == SF_FONT)), 0);
|
||||
((script->arg_types[i] == SF_VALUE) || (script->arg_types[i] == SF_STRING) || (script->arg_types[i] == SF_FILENAME) ||(script->arg_types[i] == SF_FONT)),
|
||||
((script->arg_types[i] == SF_VALUE) || (script->arg_types[i] == SF_STRING) || (script->arg_types[i] == SF_FILENAME) || (script->arg_types[i] == SF_FONT)), 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), hbox, /* script->args_widgets[i], */
|
||||
1, 2, i, i + 1,
|
||||
GTK_FILL | (((script->arg_types[i] == SF_VALUE) || (script->arg_types[i] == SF_STRING) || (script->arg_types[i] == SF_FONT))
|
||||
GTK_FILL | (((script->arg_types[i] == SF_VALUE) || (script->arg_types[i] == SF_STRING) || (script->arg_types[i] == SF_FILENAME) || (script->arg_types[i] == SF_FONT))
|
||||
? GTK_EXPAND : 0),
|
||||
GTK_FILL, 4, 2);
|
||||
gtk_widget_show (script->args_widgets[i]);
|
||||
|
@ -1382,6 +1443,18 @@ script_fu_brush_preview(char * name, /* Name */
|
|||
|
||||
|
||||
|
||||
static void
|
||||
script_fu_file_preview (GtkWidget *preview,
|
||||
gchar *data)
|
||||
{
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
gtk_label_set (GTK_LABEL (preview), g_basename((gchar *) data));
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
script_fu_font_preview (GtkWidget *preview,
|
||||
gchar *data)
|
||||
|
@ -1441,6 +1514,13 @@ script_fu_cleanup_widgets (SFScript *script)
|
|||
script->arg_values[i].sfa_color.dialog = NULL;
|
||||
}
|
||||
break;
|
||||
case SF_FILENAME:
|
||||
if (script->arg_values[i].sfa_file.dialog != NULL)
|
||||
{
|
||||
gtk_widget_destroy (script->arg_values[i].sfa_file.dialog);
|
||||
script->arg_values[i].sfa_file.dialog = NULL;
|
||||
}
|
||||
break;
|
||||
case SF_FONT:
|
||||
if (script->arg_values[i].sfa_font.dialog != NULL)
|
||||
{
|
||||
|
@ -1485,7 +1565,7 @@ script_fu_ok_callback (GtkWidget *widget,
|
|||
font = gdk_font_load (script->arg_values[i].sfa_font.fontname);
|
||||
if (font == NULL)
|
||||
{
|
||||
g_message (" At least one font you've choosen is invalid. \n Please check your settings.\n");
|
||||
g_message ("At least one font you've choosen is invalid.\nPlease check your settings.\n");
|
||||
return;
|
||||
}
|
||||
g_free (font);
|
||||
|
@ -1517,6 +1597,9 @@ script_fu_ok_callback (GtkWidget *widget,
|
|||
case SF_ADJUSTMENT:
|
||||
length += 24; /* Maximum size of float value should not exceed this many characters */
|
||||
break;
|
||||
case SF_FILENAME:
|
||||
length += strlen (script->arg_values[i].sfa_file.filename) + 3;
|
||||
break;
|
||||
case SF_FONT:
|
||||
length += strlen (script->arg_values[i].sfa_font.fontname) + 3;
|
||||
break;
|
||||
|
@ -1588,6 +1671,10 @@ script_fu_ok_callback (GtkWidget *widget,
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case SF_FILENAME:
|
||||
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", script->arg_values[i].sfa_file.filename);
|
||||
text = buffer;
|
||||
break;
|
||||
case SF_FONT:
|
||||
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", script->arg_values[i].sfa_font.fontname);
|
||||
text = buffer;
|
||||
|
@ -1833,6 +1920,16 @@ script_fu_reset_callback (GtkWidget *widget,
|
|||
gtk_adjustment_set_value (script->arg_values[i].sfa_adjustment.adj,
|
||||
script->arg_values[i].sfa_adjustment.value);
|
||||
break;
|
||||
case SF_FILENAME:
|
||||
g_free (script->arg_values[i].sfa_file.filename);
|
||||
script->arg_values[i].sfa_file.filename = g_strdup (script->arg_defaults[i].sfa_file.filename);
|
||||
if (script->arg_values[i].sfa_file.dialog)
|
||||
{
|
||||
gtk_file_selection_set_filename (GTK_FILE_SELECTION (script->arg_values[i].sfa_file.dialog), script->arg_values[i].sfa_file.filename);
|
||||
}
|
||||
script_fu_file_preview (script->arg_values[i].sfa_file.preview,
|
||||
script->arg_values[i].sfa_file.filename);
|
||||
break;
|
||||
case SF_FONT:
|
||||
g_free (script->arg_values[i].sfa_font.fontname);
|
||||
script->arg_values[i].sfa_font.fontname = g_strdup (script->arg_defaults[i].sfa_font.fontname);
|
||||
|
@ -1967,6 +2064,77 @@ script_fu_color_preview_delete (GtkWidget *widget,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
script_fu_file_preview_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkFileSelection *fs;
|
||||
SFFilename *file;
|
||||
|
||||
file = (SFFilename *) data;
|
||||
|
||||
if (!file->dialog)
|
||||
{
|
||||
file->dialog = gtk_file_selection_new ("Script-Fu File Selector");
|
||||
fs = GTK_FILE_SELECTION (file->dialog);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
|
||||
(GtkSignalFunc) script_fu_file_dialog_ok,
|
||||
file);
|
||||
gtk_signal_connect (GTK_OBJECT (fs), "delete_event",
|
||||
(GtkSignalFunc) script_fu_file_dialog_delete,
|
||||
file);
|
||||
gtk_signal_connect (GTK_OBJECT (fs->cancel_button), "clicked",
|
||||
(GtkSignalFunc) script_fu_file_dialog_cancel,
|
||||
file);
|
||||
}
|
||||
else
|
||||
fs = GTK_FILE_SELECTION (file->dialog);
|
||||
|
||||
gtk_file_selection_set_filename (GTK_FILE_SELECTION (fs), file->filename);
|
||||
gtk_window_position (GTK_WINDOW (file->dialog), GTK_WIN_POS_MOUSE);
|
||||
gtk_widget_show (file->dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
script_fu_file_dialog_ok (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
SFFilename *file;
|
||||
gchar *filename;
|
||||
|
||||
file = (SFFilename *) data;
|
||||
|
||||
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (file->dialog));
|
||||
if (filename != NULL)
|
||||
{
|
||||
g_free (file->filename);
|
||||
file->filename = g_strdup(filename);
|
||||
}
|
||||
gtk_widget_hide (file->dialog);
|
||||
|
||||
script_fu_file_preview (file->preview, file->filename);
|
||||
}
|
||||
|
||||
static void
|
||||
script_fu_file_dialog_cancel (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
SFFilename *file;
|
||||
file = (SFFilename *) data;
|
||||
|
||||
gtk_widget_hide (file->dialog);
|
||||
}
|
||||
|
||||
static gint
|
||||
script_fu_file_dialog_delete (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
script_fu_file_dialog_cancel (widget, data);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
script_fu_font_preview_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -1990,7 +2158,6 @@ script_fu_font_preview_callback (GtkWidget *widget,
|
|||
gtk_signal_connect (GTK_OBJECT (fsd->cancel_button), "clicked",
|
||||
(GtkSignalFunc) script_fu_font_dialog_cancel,
|
||||
font);
|
||||
|
||||
}
|
||||
else
|
||||
fsd = GTK_FONT_SELECTION_DIALOG (font->dialog);
|
||||
|
|
|
@ -68,6 +68,13 @@ typedef struct
|
|||
gchar *fontname;
|
||||
} SFFont;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *preview;
|
||||
GtkWidget *dialog;
|
||||
gchar *filename;
|
||||
} SFFilename;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gchar *name;
|
||||
|
@ -88,6 +95,7 @@ typedef union
|
|||
gchar * sfa_value;
|
||||
SFAdjustment sfa_adjustment;
|
||||
SFFont sfa_font;
|
||||
SFFilename sfa_file;
|
||||
gchar * sfa_pattern;
|
||||
gchar * sfa_gradient;
|
||||
SFBrush sfa_brush;
|
||||
|
@ -140,7 +148,9 @@ static void script_fu_disable_cc (gint err_msg);
|
|||
static void script_fu_interface (SFScript *script);
|
||||
static void script_fu_color_preview (GtkWidget *preview,
|
||||
gdouble *color);
|
||||
static void script_fu_font_preview (GtkWidget *preview,
|
||||
static void script_fu_file_preview (GtkWidget *preview,
|
||||
gchar *fontname);
|
||||
static void script_fu_font_preview (GtkWidget *preview,
|
||||
gchar *fontname);
|
||||
static void script_fu_cleanup_widgets (SFScript *script);
|
||||
static void script_fu_ok_callback (GtkWidget *widget,
|
||||
|
@ -164,6 +174,15 @@ static void script_fu_color_preview_cancel (GtkWidget *widget,
|
|||
static gint script_fu_color_preview_delete (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data);
|
||||
static void script_fu_file_preview_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void script_fu_file_dialog_ok (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void script_fu_file_dialog_cancel (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static gint script_fu_file_dialog_delete (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data);
|
||||
static void script_fu_font_preview_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void script_fu_font_dialog_ok (GtkWidget *widget,
|
||||
|
@ -575,6 +594,19 @@ script_fu_add_script (LISP a)
|
|||
args[i + 1].description = script->arg_labels[i];
|
||||
break;
|
||||
|
||||
case SF_FILENAME:
|
||||
if (!TYPEP (car (a), tc_string))
|
||||
return my_err ("script-fu-register: filename defaults must be string values", NIL);
|
||||
script->arg_defaults[i].sfa_file.filename = g_strdup (get_c_string (car (a)));
|
||||
script->arg_values[i].sfa_file.filename = g_strdup (script->arg_defaults[i].sfa_file.filename);
|
||||
script->arg_values[i].sfa_file.preview = NULL;
|
||||
script->arg_values[i].sfa_file.dialog = NULL;
|
||||
|
||||
args[i + 1].type = PARAM_STRING;
|
||||
args[i + 1].name = "filename";
|
||||
args[i + 1].description = script->arg_labels[i];
|
||||
break;
|
||||
|
||||
case SF_FONT:
|
||||
if (!TYPEP (car (a), tc_string))
|
||||
return my_err ("script-fu-register: font defaults must be string values", NIL);
|
||||
|
@ -776,6 +808,9 @@ script_fu_script_proc (char *name,
|
|||
case SF_STRING:
|
||||
length += strlen (params[i + 1].data.d_string) + 3;
|
||||
break;
|
||||
case SF_FILENAME:
|
||||
length += strlen (params[i + 1].data.d_string) + 3;
|
||||
break;
|
||||
case SF_ADJUSTMENT:
|
||||
length += strlen (params[i + 1].data.d_string) + 1;
|
||||
break;
|
||||
|
@ -827,6 +862,7 @@ script_fu_script_proc (char *name,
|
|||
text = params[i + 1].data.d_string;
|
||||
break;
|
||||
case SF_STRING:
|
||||
case SF_FILENAME:
|
||||
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
|
||||
text = buffer;
|
||||
break;
|
||||
|
@ -938,6 +974,10 @@ script_fu_free_script (SFScript *script)
|
|||
break;
|
||||
case SF_ADJUSTMENT:
|
||||
break;
|
||||
case SF_FILENAME:
|
||||
g_free (script->arg_defaults[i].sfa_file.filename);
|
||||
g_free (script->arg_values[i].sfa_file.filename);
|
||||
break;
|
||||
case SF_FONT:
|
||||
g_free (script->arg_defaults[i].sfa_font.fontname);
|
||||
g_free (script->arg_values[i].sfa_font.fontname);
|
||||
|
@ -1180,6 +1220,7 @@ script_fu_interface (SFScript *script)
|
|||
gtk_range_set_update_policy (GTK_RANGE (script->args_widgets[i]),
|
||||
GTK_UPDATE_DELAYED);
|
||||
break;
|
||||
|
||||
case SF_SPINNER:
|
||||
script->args_widgets[i] = gtk_spin_button_new (script->arg_values[i].sfa_adjustment.adj, 0, 0);
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (script->args_widgets[i]), TRUE);
|
||||
|
@ -1193,6 +1234,23 @@ script_fu_interface (SFScript *script)
|
|||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SF_FILENAME:
|
||||
script->args_widgets[i] = gtk_button_new();
|
||||
script->arg_values[i].sfa_file.preview = gtk_label_new ("");
|
||||
gtk_widget_set_usize (script->args_widgets[i], TEXT_WIDTH, 0);
|
||||
gtk_container_add (GTK_CONTAINER (script->args_widgets[i]),
|
||||
script->arg_values[i].sfa_file.preview);
|
||||
gtk_widget_show (script->arg_values[i].sfa_file.preview);
|
||||
|
||||
script_fu_file_preview (script->arg_values[i].sfa_file.preview,
|
||||
script->arg_values[i].sfa_file.filename);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (script->args_widgets[i]), "clicked",
|
||||
(GtkSignalFunc) script_fu_file_preview_callback,
|
||||
&script->arg_values[i].sfa_file);
|
||||
break;
|
||||
|
||||
case SF_FONT:
|
||||
script->args_widgets[i] = gtk_button_new();
|
||||
script->arg_values[i].sfa_font.preview = gtk_label_new ("");
|
||||
|
@ -1208,6 +1266,7 @@ script_fu_interface (SFScript *script)
|
|||
(GtkSignalFunc) script_fu_font_preview_callback,
|
||||
&script->arg_values[i].sfa_font);
|
||||
break;
|
||||
|
||||
case SF_PATTERN:
|
||||
script->args_widgets[i] = gimp_pattern_select_widget("Script-fu Pattern Selection",
|
||||
script->arg_values[i].sfa_pattern,
|
||||
|
@ -1220,6 +1279,7 @@ script_fu_interface (SFScript *script)
|
|||
script_fu_gradient_preview,
|
||||
&script->arg_values[i].sfa_gradient);
|
||||
break;
|
||||
|
||||
case SF_BRUSH:
|
||||
script->args_widgets[i] =
|
||||
gimp_brush_select_widget("Script-fu brush Selection",
|
||||
|
@ -1234,15 +1294,16 @@ script_fu_interface (SFScript *script)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), script->args_widgets[i],
|
||||
((script->arg_types[i] == SF_VALUE) || (script->arg_types[i] == SF_STRING) || (script->arg_types[i] == SF_FONT)),
|
||||
((script->arg_types[i] == SF_VALUE) || (script->arg_types[i] == SF_STRING) || (script->arg_types[i] == SF_FONT)), 0);
|
||||
((script->arg_types[i] == SF_VALUE) || (script->arg_types[i] == SF_STRING) || (script->arg_types[i] == SF_FILENAME) ||(script->arg_types[i] == SF_FONT)),
|
||||
((script->arg_types[i] == SF_VALUE) || (script->arg_types[i] == SF_STRING) || (script->arg_types[i] == SF_FILENAME) || (script->arg_types[i] == SF_FONT)), 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), hbox, /* script->args_widgets[i], */
|
||||
1, 2, i, i + 1,
|
||||
GTK_FILL | (((script->arg_types[i] == SF_VALUE) || (script->arg_types[i] == SF_STRING) || (script->arg_types[i] == SF_FONT))
|
||||
GTK_FILL | (((script->arg_types[i] == SF_VALUE) || (script->arg_types[i] == SF_STRING) || (script->arg_types[i] == SF_FILENAME) || (script->arg_types[i] == SF_FONT))
|
||||
? GTK_EXPAND : 0),
|
||||
GTK_FILL, 4, 2);
|
||||
gtk_widget_show (script->args_widgets[i]);
|
||||
|
@ -1382,6 +1443,18 @@ script_fu_brush_preview(char * name, /* Name */
|
|||
|
||||
|
||||
|
||||
static void
|
||||
script_fu_file_preview (GtkWidget *preview,
|
||||
gchar *data)
|
||||
{
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
gtk_label_set (GTK_LABEL (preview), g_basename((gchar *) data));
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
script_fu_font_preview (GtkWidget *preview,
|
||||
gchar *data)
|
||||
|
@ -1441,6 +1514,13 @@ script_fu_cleanup_widgets (SFScript *script)
|
|||
script->arg_values[i].sfa_color.dialog = NULL;
|
||||
}
|
||||
break;
|
||||
case SF_FILENAME:
|
||||
if (script->arg_values[i].sfa_file.dialog != NULL)
|
||||
{
|
||||
gtk_widget_destroy (script->arg_values[i].sfa_file.dialog);
|
||||
script->arg_values[i].sfa_file.dialog = NULL;
|
||||
}
|
||||
break;
|
||||
case SF_FONT:
|
||||
if (script->arg_values[i].sfa_font.dialog != NULL)
|
||||
{
|
||||
|
@ -1485,7 +1565,7 @@ script_fu_ok_callback (GtkWidget *widget,
|
|||
font = gdk_font_load (script->arg_values[i].sfa_font.fontname);
|
||||
if (font == NULL)
|
||||
{
|
||||
g_message (" At least one font you've choosen is invalid. \n Please check your settings.\n");
|
||||
g_message ("At least one font you've choosen is invalid.\nPlease check your settings.\n");
|
||||
return;
|
||||
}
|
||||
g_free (font);
|
||||
|
@ -1517,6 +1597,9 @@ script_fu_ok_callback (GtkWidget *widget,
|
|||
case SF_ADJUSTMENT:
|
||||
length += 24; /* Maximum size of float value should not exceed this many characters */
|
||||
break;
|
||||
case SF_FILENAME:
|
||||
length += strlen (script->arg_values[i].sfa_file.filename) + 3;
|
||||
break;
|
||||
case SF_FONT:
|
||||
length += strlen (script->arg_values[i].sfa_font.fontname) + 3;
|
||||
break;
|
||||
|
@ -1588,6 +1671,10 @@ script_fu_ok_callback (GtkWidget *widget,
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case SF_FILENAME:
|
||||
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", script->arg_values[i].sfa_file.filename);
|
||||
text = buffer;
|
||||
break;
|
||||
case SF_FONT:
|
||||
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", script->arg_values[i].sfa_font.fontname);
|
||||
text = buffer;
|
||||
|
@ -1833,6 +1920,16 @@ script_fu_reset_callback (GtkWidget *widget,
|
|||
gtk_adjustment_set_value (script->arg_values[i].sfa_adjustment.adj,
|
||||
script->arg_values[i].sfa_adjustment.value);
|
||||
break;
|
||||
case SF_FILENAME:
|
||||
g_free (script->arg_values[i].sfa_file.filename);
|
||||
script->arg_values[i].sfa_file.filename = g_strdup (script->arg_defaults[i].sfa_file.filename);
|
||||
if (script->arg_values[i].sfa_file.dialog)
|
||||
{
|
||||
gtk_file_selection_set_filename (GTK_FILE_SELECTION (script->arg_values[i].sfa_file.dialog), script->arg_values[i].sfa_file.filename);
|
||||
}
|
||||
script_fu_file_preview (script->arg_values[i].sfa_file.preview,
|
||||
script->arg_values[i].sfa_file.filename);
|
||||
break;
|
||||
case SF_FONT:
|
||||
g_free (script->arg_values[i].sfa_font.fontname);
|
||||
script->arg_values[i].sfa_font.fontname = g_strdup (script->arg_defaults[i].sfa_font.fontname);
|
||||
|
@ -1967,6 +2064,77 @@ script_fu_color_preview_delete (GtkWidget *widget,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
script_fu_file_preview_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkFileSelection *fs;
|
||||
SFFilename *file;
|
||||
|
||||
file = (SFFilename *) data;
|
||||
|
||||
if (!file->dialog)
|
||||
{
|
||||
file->dialog = gtk_file_selection_new ("Script-Fu File Selector");
|
||||
fs = GTK_FILE_SELECTION (file->dialog);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
|
||||
(GtkSignalFunc) script_fu_file_dialog_ok,
|
||||
file);
|
||||
gtk_signal_connect (GTK_OBJECT (fs), "delete_event",
|
||||
(GtkSignalFunc) script_fu_file_dialog_delete,
|
||||
file);
|
||||
gtk_signal_connect (GTK_OBJECT (fs->cancel_button), "clicked",
|
||||
(GtkSignalFunc) script_fu_file_dialog_cancel,
|
||||
file);
|
||||
}
|
||||
else
|
||||
fs = GTK_FILE_SELECTION (file->dialog);
|
||||
|
||||
gtk_file_selection_set_filename (GTK_FILE_SELECTION (fs), file->filename);
|
||||
gtk_window_position (GTK_WINDOW (file->dialog), GTK_WIN_POS_MOUSE);
|
||||
gtk_widget_show (file->dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
script_fu_file_dialog_ok (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
SFFilename *file;
|
||||
gchar *filename;
|
||||
|
||||
file = (SFFilename *) data;
|
||||
|
||||
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (file->dialog));
|
||||
if (filename != NULL)
|
||||
{
|
||||
g_free (file->filename);
|
||||
file->filename = g_strdup(filename);
|
||||
}
|
||||
gtk_widget_hide (file->dialog);
|
||||
|
||||
script_fu_file_preview (file->preview, file->filename);
|
||||
}
|
||||
|
||||
static void
|
||||
script_fu_file_dialog_cancel (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
SFFilename *file;
|
||||
file = (SFFilename *) data;
|
||||
|
||||
gtk_widget_hide (file->dialog);
|
||||
}
|
||||
|
||||
static gint
|
||||
script_fu_file_dialog_delete (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
script_fu_file_dialog_cancel (widget, data);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
script_fu_font_preview_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -1990,7 +2158,6 @@ script_fu_font_preview_callback (GtkWidget *widget,
|
|||
gtk_signal_connect (GTK_OBJECT (fsd->cancel_button), "clicked",
|
||||
(GtkSignalFunc) script_fu_font_dialog_cancel,
|
||||
font);
|
||||
|
||||
}
|
||||
else
|
||||
fsd = GTK_FONT_SELECTION_DIALOG (font->dialog);
|
||||
|
|
|
@ -474,6 +474,7 @@ init_constants ()
|
|||
setvar (cintern ("SF-TOGGLE"), flocons (SF_TOGGLE), NIL);
|
||||
setvar (cintern ("SF-VALUE"), flocons (SF_VALUE), NIL);
|
||||
setvar (cintern ("SF-STRING"), flocons (SF_STRING), NIL);
|
||||
setvar (cintern ("SF-FILENAME"), flocons (SF_FILENAME), NIL);
|
||||
setvar (cintern ("SF-ADJUSTMENT"), flocons (SF_ADJUSTMENT), NIL);
|
||||
setvar (cintern ("SF-FONT"), flocons (SF_FONT), NIL);
|
||||
setvar (cintern ("SF-PATTERN"), flocons (SF_PATTERN), NIL);
|
||||
|
|
|
@ -160,5 +160,6 @@
|
|||
SF-STRING "Text String" "Marble"
|
||||
SF-VALUE "Font Size (in pixels)" "100"
|
||||
SF-STRING "Font" "Engraver"
|
||||
SF-STRING "Background Img" (string-append "" gimp-data-dir "/scripts/texture3.jpg")
|
||||
; SF-STRING "Background Img" (string-append "" gimp-data-dir "/scripts/texture3.jpg")
|
||||
SF-FILENAME "Background Img" (string-append "" gimp-data-dir "/scripts/texture3.jpg")
|
||||
SF-TOGGLE "Carve Raised Text" FALSE)
|
||||
|
|
|
@ -193,7 +193,8 @@
|
|||
SF-VALUE "Chrome Saturation" "-80"
|
||||
SF-VALUE "Chrome Lightness" "-47"
|
||||
SF-VALUE "Chrome Factor" "0.75"
|
||||
SF-STRING "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg")
|
||||
; SF-STRING "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg")
|
||||
SF-FILENAME "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg")
|
||||
SF-COLOR "Highlight Balance" '(211 95 0)
|
||||
SF-COLOR "Chrome Balance" '(0 0 0)
|
||||
SF-TOGGLE "Chrome White Areas" TRUE)
|
||||
|
|
|
@ -197,5 +197,7 @@
|
|||
SF-STRING "Text String" "Crystal"
|
||||
SF-VALUE "Font Size (in pixels)" "150"
|
||||
SF-STRING "Font" "Engraver"
|
||||
SF-STRING "Background Img" (string-append "" gimp-data-dir "/scripts/texture1.jpg")
|
||||
SF-STRING "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg"))
|
||||
; SF-STRING "Background Img" (string-append "" gimp-data-dir "/scripts/texture1.jpg")
|
||||
SF-FILENAME "Background Img" (string-append "" gimp-data-dir "/scripts/texture1.jpg")
|
||||
; SF-STRING "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg"))
|
||||
SF-FILENAME "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg"))
|
||||
|
|
|
@ -161,8 +161,8 @@
|
|||
SF-STRING "Text String" "NEON"
|
||||
; SF-VALUE "Font Size (in pixels)" "150"
|
||||
SF-ADJUSTMENT "Font Size" '(150 2 256 1 10 0 0)
|
||||
; SF-STRING "Font" "Blippo"
|
||||
SF-FONT "Font" "-*-blippo-*-*-*-*-*-*-*-*-*-*-*-*"
|
||||
SF-STRING "Font" "Blippo"
|
||||
SF-COLOR "Background Color" '(0 0 0)
|
||||
SF-COLOR "Glow Color" '(38 211 255)
|
||||
SF-TOGGLE "Create Shadow" FALSE)
|
||||
|
|
|
@ -199,6 +199,7 @@
|
|||
SF-ADJUSTMENT "Font size (in pixels)" '(150 1 1000 1 10 0 1)
|
||||
; SF-STRING "Font" "RoostHeavy"
|
||||
SF-FONT "Font" "-*-roostheavy-*-r-*-*-24-*-*-*-p-*-*-*"
|
||||
SF-STRING "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg")
|
||||
; SF-STRING "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg")
|
||||
SF-FILENAME "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg")
|
||||
SF-COLOR "Highlight Balance" '(211 95 0)
|
||||
SF-COLOR "Chrome Balance" '(0 0 0))
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
Makefile.in
|
||||
Makefile
|
||||
.deps
|
||||
_libs
|
||||
.libs
|
||||
xbm
|
|
@ -0,0 +1,36 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
pluginlibdir = $(gimpplugindir)/plug-ins
|
||||
|
||||
pluginlib_PROGRAMS = xbm
|
||||
|
||||
xbm_SOURCES = \
|
||||
xbm.c
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
$(GTK_CFLAGS) \
|
||||
-I$(includedir)
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(GTK_LIBS) \
|
||||
@LIBJPEG_LIB@
|
||||
|
||||
DEPS = \
|
||||
$(top_builddir)/libgimp/libgimp.la
|
||||
|
||||
xbm_DEPENDENCIES = $(DEPS)
|
||||
|
||||
.PHONY: files
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
@for subdir in $(SUBDIRS); do \
|
||||
files=`cd $$subdir; $(MAKE) files | grep -v "make\[[1-9]\]"`; \
|
||||
for file in $$files; do \
|
||||
echo $$subdir/$$file; \
|
||||
done; \
|
||||
done
|
File diff suppressed because it is too large
Load Diff
|
@ -19,7 +19,7 @@ VPATH = @srcdir@
|
|||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
datadir = $(prefix)/@DATADIRNAME@
|
||||
localedir = $(datadir)/locale
|
||||
localedir = @localedir@
|
||||
gnulocaledir = $(prefix)/share/locale
|
||||
gettextsrcdir = $(prefix)/share/gettext/po
|
||||
subdir = po
|
||||
|
|
Loading…
Reference in New Issue