Commit fdb4b50f authored by Manish Singh's avatar Manish Singh

check for inline by ourselves if it's not defined in glibconfig.h. So

* configure.in: check for inline by ourselves if it's not
defined in glibconfig.h. So inline works if glib is compiled
with a different compiler than gimp. The plug-ins that use
inline #include "config.h" now (blur, destripe, emboss,
gfli, nlfilt, ps, randomize, sinus, and zealouscrop)

* app/main.c: applied gimp-kc-980707-0; fixes command line
parsing

* plug-ins/dbbrowser/dbbrowser_utils.c: searching by name does
- <-> _ translation

* Added filter pack plugin

-Yosh
parent c911759b
Mon Jul 13 22:49:15 PDT 1998 Manish Singh <yosh@gimp.org>
* configure.in: check for inline by ourselves if it's not
defined in glibconfig.h. So inline works if glib is compiled
with a different compiler than gimp. The plug-ins that use
inline #include "config.h" now (blur, destripe, emboss,
gfli, nlfilt, ps, randomize, sinus, and zealouscrop)
* app/main.c: applied gimp-kc-980707-0; fixes command line
parsing
* plug-ins/dbbrowser/dbbrowser_utils.c: searching by name does
- <-> _ translation
* Added filter pack plugin
Mon Jul 13 22:00:31 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/rect_select.c : argh, s/snprintf/g_snprintf
......
......@@ -42,9 +42,6 @@
#undef USE_PTHREADS
/* #undef PACKAGE */
/* #undef VERSION */
/* Leave that blank line there!! Autoheader needs it.
If you're adding to this file, keep in mind:
......
......@@ -89,6 +89,10 @@ gimp_SOURCES = \
dialog_types.h \
disp_callbacks.c \
disp_callbacks.h \
docindex.c \
docindex.h \
docindexif.c \
docindexif.h \
draw_core.c \
draw_core.h \
drawable.c \
......@@ -290,11 +294,7 @@ gimp_SOURCES = \
undo_cmds.h \
wilber.h \
xcf.c \
xcf.h \
docindex.c \
docindex.h \
docindexif.c \
docindexif.h
xcf.h
EXTRA_DIST = \
tools/channel.xbm \
......
......@@ -134,18 +134,17 @@ main (int argc, char **argv)
(strcmp (argv[i], "-n") == 0))
{
no_interface = TRUE;
argv[i] = NULL;
}
else if ((strcmp (argv[i], "--batch") == 0) ||
(strcmp (argv[i], "-b") == 0))
{
argv[i] = NULL;
for (j = 0, i++ ; i < argc; j++, i++)
{
for (j = 0, i++ ; i < argc && argv[i][0] != '-'; j++, i++)
batch_cmds[j] = argv[i];
argv[i] = NULL;
}
batch_cmds[j] = NULL;
if (batch_cmds[0] == NULL) /* We need at least one batch command */
show_help = TRUE;
if (argv[i-1][0] != '-') /* Did loop end due to a new argument? */
--i; /* Ensure new argument gets processed */
}
else if (strcmp (argv[i], "--system-gimprc") == 0)
{
......
......@@ -25,6 +25,9 @@
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define as __inline if that's what the C compiler calls it. */
#undef inline
/* Define to `int' if <sys/types.h> doesn't define. */
#undef pid_t
......@@ -74,9 +77,6 @@
#undef USE_PTHREADS
/* #undef PACKAGE */
/* #undef VERSION */
/* Define if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
......
......@@ -303,6 +303,19 @@ AC_CHECK_FUNC(random, [
dnl check for difftime
AC_CHECK_FUNC(difftime, , AC_DEFINE(NO_DIFFTIME))
dnl check for inline
AC_MSG_CHECKING([for inline definition in glibconfig.h])
AC_EGREP_CPP(glib_defines_inline,
[#include <glibconfig.h>
#ifdef inline
glib_defines_inline
#endif
], have_glib_inline=yes, have_glib_inline=no)
AC_MSG_RESULT($have_glib_inline)
if test "$have_glib_inline" = "no"; then
AC_C_INLINE
fi
dnl Threads
AC_ARG_WITH(threads, [ --with-threads=[posix] support threading ])
THREAD_LIBS=
......@@ -312,7 +325,6 @@ if test "x$with_threads" = "xposix" || test "x$with_threads" = "xyes"; then
CFLAGS="$CFLAGS -D_REENTRANT"
THREAD_LIBS="-lpthread")
fi
AC_SUBST(THREAD_LIBS)
CPPFLAGS="$gimp_save_CPPFLAGS"
LDFLAGS="$gimp_save_LDFLAGS"
......@@ -439,6 +451,7 @@ AC_SUBST(LPSTAT_DEF)
AC_SUBST(LPR_DEF)
AC_SUBST(LPC_DEF)
AC_SUBST(MAILER)
AC_SUBST(THREAD_LIBS)
dnl Output the Makefiles
......@@ -502,6 +515,7 @@ plug-ins/film/Makefile
plug-ins/fits/Makefile
plug-ins/flame/Makefile
plug-ins/flarefx/Makefile
plug-ins/fp/Makefile
plug-ins/fractaltrace/Makefile
plug-ins/gauss_iir/Makefile
plug-ins/gauss_rle/Makefile
......
......@@ -502,7 +502,8 @@ dialog_search_callback (GtkWidget *widget,
int num_procs;
int i, j;
dbbrowser_t* dbbrowser = data;
gchar *func_name, *label;
gchar *func_name, *label, *query_text;
GString *query;
gtk_clist_freeze(GTK_CLIST(dbbrowser->clist));
gtk_clist_clear(GTK_CLIST(dbbrowser->clist));
......@@ -513,9 +514,25 @@ dialog_search_callback (GtkWidget *widget,
{
gtk_window_set_title (GTK_WINDOW (dbbrowser->dlg),
"DB Browser (by name - please wait)");
gimp_query_database (gtk_entry_get_text( GTK_ENTRY(dbbrowser->search_entry) ),
query = g_string_new ("");
query_text = gtk_entry_get_text(GTK_ENTRY(dbbrowser->search_entry));
while (*query_text)
{
if ((*query_text == '_') || (*query_text == '-'))
g_string_append (query, "[-_]");
else
g_string_append_c (query, *query_text);
query_text++;
}
gimp_query_database (query->str,
".*", ".*", ".*", ".*", ".*", ".*",
&num_procs, &proc_list);
g_string_free (query, TRUE);
}
else if ( widget == (dbbrowser->blurb_button) )
{
......
......@@ -502,7 +502,8 @@ dialog_search_callback (GtkWidget *widget,
int num_procs;
int i, j;
dbbrowser_t* dbbrowser = data;
gchar *func_name, *label;
gchar *func_name, *label, *query_text;
GString *query;
gtk_clist_freeze(GTK_CLIST(dbbrowser->clist));
gtk_clist_clear(GTK_CLIST(dbbrowser->clist));
......@@ -513,9 +514,25 @@ dialog_search_callback (GtkWidget *widget,
{
gtk_window_set_title (GTK_WINDOW (dbbrowser->dlg),
"DB Browser (by name - please wait)");
gimp_query_database (gtk_entry_get_text( GTK_ENTRY(dbbrowser->search_entry) ),
query = g_string_new ("");
query_text = gtk_entry_get_text(GTK_ENTRY(dbbrowser->search_entry));
while (*query_text)
{
if ((*query_text == '_') || (*query_text == '-'))
g_string_append (query, "[-_]");
else
g_string_append_c (query, *query_text);
query_text++;
}
gimp_query_database (query->str,
".*", ".*", ".*", ".*", ".*", ".*",
&num_procs, &proc_list);
g_string_free (query, TRUE);
}
else if ( widget == (dbbrowser->blurb_button) )
{
......
......@@ -52,6 +52,7 @@ SUBDIRS = \
fits \
flame \
flarefx \
fp \
fractaltrace \
gauss_iir \
gauss_rle \
......
......@@ -58,6 +58,10 @@
#include "gtk/gtk.h"
#include <plug-ins/gpc/gpc.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/*********************************
*
* PLUGIN-SPECIFIC CONSTANTS
......
......@@ -58,6 +58,10 @@
#include "gtk/gtk.h"
#include <plug-ins/gpc/gpc.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/*********************************
*
* PLUGIN-SPECIFIC CONSTANTS
......
......@@ -50,6 +50,10 @@
#include <libgimp/gimpui.h>
#include <string.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/*
* Constants...
*/
......
......@@ -33,11 +33,13 @@
#include <sys/types.h>
#include <libgimp/gimp.h>
#include <gtk/gtk.h>
#include <plug-ins/megawidget/megawidget.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
......
#include <stdio.h>
#include <stdlib.h>
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "fp.h"
#include "fp_hsv.h"
FP_Params Current =
{
1,
.25, /* Initial Roughness */
NULL,
.6, /* Initial Degree of Aliasing */
NULL,
80,
NULL,
MIDTONES, /* Initial Range */
BY_VAL, /* Initial God knows what */
TRUE, /* Selection Only */
TRUE, /* Real Time */
0, /* Offset */
0,
{32,224,255},
{0,0,0}
};
GDrawable *drawable, *mask;
void query (void);
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 */
};
MAIN()
void
query ()
{
GParamDef args[] =
{
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image", "Input image (used for indexed images)" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
};
GParamDef *return_vals = NULL;
int nargs = sizeof (args) / sizeof (args[0]);
int nreturn_vals = 0;
gimp_install_procedure ("Filter Pack Simulation",
"Allows the user to change H, S, or C with many previews",
"Then something else here",
"Pavel Grinfeld (pavel@ml.com)",
"Pavel Grinfeld (pavel@ml.com)",
"27th March 1997",
"<Image>/Filters/Darkroom/Filter Pack",
"RGB*,INDEXED*,GRAY*",
PROC_PLUG_IN,
nargs, nreturn_vals,
args, return_vals);
}
/********************************STANDARD RUN*************************/
void
run (char *name,
int nparams,
GParam *param,
int *nreturn_vals,
GParam **return_vals)
{
GParam values[1];
GStatusType status = STATUS_SUCCESS;
*nreturn_vals = 1;
*return_vals = values;
values[0].type = PARAM_STATUS;
values[0].data.d_status = status;
initializeFilterPacks();
drawable = gimp_drawable_get (param[2].data.d_drawable);
mask=gimp_drawable_get(gimp_image_get_selection(param[1].data.d_image));
if (gimp_drawable_indexed (drawable->id) ||gimp_drawable_gray (drawable->id) ) {
ErrorMessage("Convert the image to RGB first!");
status = STATUS_EXECUTION_ERROR;
}
else if (gimp_drawable_color (drawable->id) && fp_dialog())
{
gimp_progress_init ("Applying the Filter Pack...");
gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1));
fp (drawable);
gimp_displays_flush ();
}
else status = STATUS_EXECUTION_ERROR;
values[0].data.d_status = status;
if (status==STATUS_SUCCESS)
gimp_drawable_detach (drawable);
}
void
fp_row (const guchar *src_row,
guchar *dest_row,
gint row,
gint row_width,
gint bytes)
{
gint col, bytenum, k;
int JudgeBy, Intensity=0, P[3], backupP[3];
hsv H,S,V;
gint M, m, middle;
for (col = 0; col < row_width ; col++)
{
backupP[0] = P[0] = src_row[col*bytes+0];
backupP[0] = P[1] = src_row[col*bytes+1];
backupP[0] = P[2] = src_row[col*bytes+2];
rgb_to_hsv(P[0]/255.0, P[1]/255.0, P[2]/255.0, &H, &S, &V);
for (JudgeBy=BY_HUE; JudgeBy<JUDGE_BY; JudgeBy++) {
if (!Current.Touched[JudgeBy]) continue;
switch (JudgeBy) {
case BY_HUE:
Intensity=255*H;
break;
case BY_SAT:
Intensity=255*S;
break;
case BY_VAL:
Intensity=255*V;
break;
}
/* It's important to take care of Saturation first!!! */
m = MIN(MIN(P[0],P[1]),P[2]);
M = MAX(MAX(P[0],P[1]),P[2]);
middle=(M+m)/2;
for (k=0; k<3; k++)
if (P[k]!=m && P[k]!=M) middle=P[k];
for (k=0; k<3; k++)
if (M!=m)
if (P[k] == M)
P[k] = MAX(P[k]+Current.satAdj[JudgeBy][Intensity],middle);
else if (P[k] == m)
P[k] = MIN(P[k]-Current.satAdj[JudgeBy][Intensity],middle);
P[0] += Current.redAdj[JudgeBy][Intensity];
P[1] += Current.greenAdj[JudgeBy][Intensity];
P[2] += Current.blueAdj[JudgeBy][Intensity];
P[0] = MAX(0,MIN(255, P[0]));
P[1] = MAX(0,MIN(255, P[1]));
P[2] = MAX(0,MIN(255, P[2]));
}
dest_row[col*bytes + 0] = P[0];
dest_row[col*bytes + 1] = P[1];
dest_row[col*bytes + 2] = P[2];
if (bytes>3)
for (bytenum = 3; bytenum<bytes; bytenum++)
dest_row[col*bytes+bytenum] = src_row[col*bytes+bytenum];
}
}
void fp (GDrawable *drawable)
{
GPixelRgn srcPR, destPR;
gint width, height;
gint bytes;
guchar *src_row, *dest_row;
gint row;
gint x1, y1, x2, y2;
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
width = drawable->width;
height = drawable->height;
bytes = drawable->bpp;
src_row = (guchar *) malloc ((x2 - x1) * bytes);
dest_row = (guchar *) malloc ((x2 - x1) * bytes);
gimp_pixel_rgn_init (&srcPR, drawable, 0, 0, width, height, FALSE, FALSE);
gimp_pixel_rgn_init (&destPR, drawable, 0, 0, width, height, TRUE, TRUE);
for (row = y1; row < y2; row++)
{
gimp_pixel_rgn_get_row (&srcPR, src_row, x1, row, (x2 - x1));
fp_row (src_row,
dest_row,
row,
(x2 - x1),
bytes
);
gimp_pixel_rgn_set_row (&destPR, dest_row, x1, row, (x2 - x1));
if ((row % 10) == 0)
gimp_progress_update ((double) row / (double) (y2 - y1));
}
/* update the processed region */
gimp_drawable_flush (drawable);
gimp_drawable_merge_shadow (drawable->id, TRUE);
gimp_drawable_update (drawable->id, x1, y1, (x2 - x1), (y2 - y1));
free (src_row);
free (dest_row);
}
void
ErrorMessage(guchar *message)
{
GtkWidget *window, *label, *button,*table;
gchar **argv=g_new (gchar *, 1);
gint argc=1;
argv[0] = g_strdup ("fp");
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc());
window=gtk_dialog_new();
gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
gtk_window_set_title(GTK_WINDOW(window),"Filter Pack Simulation Message");
gtk_signal_connect (GTK_OBJECT (window), "destroy",
(GtkSignalFunc) fp_close_callback,
NULL);
button = gtk_button_new_with_label ("Got It!");
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) fp_ok_callback,
window);
gtk_widget_grab_default (button);
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0);
table=gtk_table_new(2,2,FALSE);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),table,TRUE,TRUE,0);
gtk_widget_show(table);
label=gtk_label_new("");
gtk_label_set(GTK_LABEL(label),message);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table),label,0,1,0,1,
GTK_FILL|GTK_EXPAND,GTK_FILL|GTK_EXPAND,15,15);
gtk_widget_show(window);
gtk_main ();
}
......@@ -34,10 +34,13 @@
#include <math.h>
#include <libgimp/gimp.h>
#include <gtk/gtk.h>
#include <plug-ins/megawidget/megawidget.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
static mw_preview_t nlfilt_do_preview;
struct Grgb {
......
......@@ -50,6 +50,10 @@ static char ident[] = "@(#) GIMP PostScript/PDF file-plugin v1.04 20-Dec-97";
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define STR_LENGTH 64
/* Load info */
......
......@@ -50,6 +50,10 @@ static char ident[] = "@(#) GIMP PostScript/PDF file-plugin v1.04 20-Dec-97";
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define STR_LENGTH 64
/* Load info */
......
......@@ -74,8 +74,8 @@
#include "gtk/gtk.h"
#include <plug-ins/gpc/gpc.h>
#if ! defined(__GNUC__)
# define inline
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/*********************************
......
......@@ -16,6 +16,10 @@
#include "libgimp/gimp.h"
#include "gtk/gtk.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* Declare local functions. */
static void query(void);
static void run(char *name,
......
......@@ -502,7 +502,8 @@ dialog_search_callback (GtkWidget *widget,
int num_procs;
int i, j;
dbbrowser_t* dbbrowser = data;
gchar *func_name, *label;
gchar *func_name, *label, *query_text;
GString *query;
gtk_clist_freeze(GTK_CLIST(dbbrowser->clist));
gtk_clist_clear(GTK_CLIST(dbbrowser->clist));
......@@ -513,9 +514,25 @@ dialog_search_callback (GtkWidget *widget,
{
gtk_window_set_title (GTK_WINDOW (dbbrowser->dlg),
"DB Browser (by name - please wait)");
gimp_query_database (gtk_entry_get_text( GTK_ENTRY(dbbrowser->search_entry) ),
query = g_string_new ("");
query_text = gtk_entry_get_text(GTK_ENTRY(dbbrowser->search_entry));
while (*query_text)
{
if ((*query_text == '_') || (*query_text == '-'))
g_string_append (query, "[-_]");
else
g_string_append_c (query, *query_text);
query_text++;
}
gimp_query_database (query->str,
".*", ".*", ".*", ".*", ".*", ".*",
&num_procs, &proc_list);
g_string_free (query, TRUE);
}
else if ( widget == (dbbrowser->blurb_button) )
{
......
......@@ -502,7 +502,8 @@ dialog_search_callback (GtkWidget *widget,
int num_procs;
int i, j;
dbbrowser_t* dbbrowser = data;
gchar *func_name, *label;
gchar *func_name, *label, *query_text;
GString *query;
gtk_clist_freeze(GTK_CLIST(dbbrowser->clist));
gtk_clist_clear(GTK_CLIST(dbbrowser->clist));
......@@ -513,9 +514,25 @@ dialog_search_callback (GtkWidget *widget,
{
gtk_window_set_title (GTK_WINDOW (dbbrowser->dlg),
"DB Browser (by name - please wait)");
gimp_query_database (gtk_entry_get_text( GTK_ENTRY(dbbrowser->search_entry) ),
query = g_string_new ("");
query_text = gtk_entry_get_text(GTK_ENTRY(dbbrowser->search_entry));
while (*query_text)
{
if ((*query_text == '_') || (*query_text == '-'))
g_string_append (query, "[-_]");
else
g_string_append_c (query, *query_text);
query_text++;
}
gimp_query_database (query->str,
".*", ".*", ".*", ".*", ".*", ".*",
&num_procs, &proc_list);
g_string_free (query, TRUE);
}
else if ( widget == (dbbrowser->blurb_button) )
{
......
......@@ -502,7 +502,8 @@ dialog_search_callback (GtkWidget *widget,
int num_procs;
int i, j;
dbbrowser_t* dbbrowser = data;
gchar *func_name, *label;
gchar *func_name, *label, *query_text;
GString *query;
gtk_clist_freeze(GTK_CLIST(dbbrowser->clist));
gtk_clist_clear(GTK_CLIST(dbbrowser->clist));
......@@ -513,9 +514,25 @@ dialog_search_callback (GtkWidget *widget,
{
gtk_window_set_title (GTK_WINDOW (dbbrowser->dlg),
"DB Browser (by name - please wait)");
gimp_query_database (gtk_entry_get_text( GTK_ENTRY(dbbrowser->search_entry) ),
query = g_string_new ("");
query_text = gtk_entry_get_text(GTK_ENTRY(dbbrowser->search_entry));
while (*query_text)
{
if ((*query_text == '_') || (*query_text == '-'))
g_string_append (query, "[-_]");
else
g_string_append_c (query, *query_text);
query_text++;
}
gimp_query_database (query->str,
".*", ".*", ".*", ".*", ".*", ".*",
&num_procs, &proc_list);
g_string_free (query, TRUE);
}
else if ( widget == (dbbrowser->blurb_button) )
{
......
......@@ -50,6 +50,10 @@
#include <libgimp/gimpui.h>