configure.in plug-ins/Makefile.am removed.
2000-01-11 Michael Natterer <mitch@gimp.org> * configure.in * plug-ins/Makefile.am * plug-ins/gpc/*: removed. * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/common/blur.c * plug-ins/common/randomize.c: removed all calls to gpc functions. * plug-ins/common/edge.c: applied standard ui stuff.
This commit is contained in:

committed by
Michael Natterer

parent
a62cf4284f
commit
f10b06a3b2
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
2000-01-11 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* configure.in
|
||||
* plug-ins/Makefile.am
|
||||
* plug-ins/gpc/*: removed.
|
||||
|
||||
* plug-ins/common/Makefile.am
|
||||
* plug-ins/common/plugin-defs.pl
|
||||
* plug-ins/common/blur.c
|
||||
* plug-ins/common/randomize.c: removed all calls to gpc functions.
|
||||
|
||||
* plug-ins/common/edge.c: applied standard ui stuff.
|
||||
|
||||
Tue Jan 11 19:31:30 CET 2000 Stanislav Brabec <utx@penguin.cz>
|
||||
|
||||
* tips/Makefile.am: Czech added.
|
||||
|
@ -692,7 +692,6 @@ plug-ins/perl/config.pl
|
||||
plug-ins/libgck/Makefile
|
||||
plug-ins/libgck/gck/Makefile
|
||||
plug-ins/megawidget/Makefile
|
||||
plug-ins/gpc/Makefile
|
||||
plug-ins/dbbrowser/Makefile
|
||||
plug-ins/script-fu/Makefile
|
||||
plug-ins/script-fu/scripts/Makefile
|
||||
|
@ -30,7 +30,6 @@ endif
|
||||
SUBDIRS = \
|
||||
libgck \
|
||||
megawidget \
|
||||
gpc \
|
||||
dbbrowser \
|
||||
script-fu \
|
||||
$(GIMP_PERL) \
|
||||
|
@ -248,7 +248,6 @@ blur_SOURCES = \
|
||||
blur.c
|
||||
|
||||
blur_LDADD = \
|
||||
$(top_builddir)/plug-ins/gpc/libgpc.a \
|
||||
$(top_builddir)/libgimp/libgimpui.la \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(GTK_LIBS) \
|
||||
@ -924,7 +923,6 @@ randomize_SOURCES = \
|
||||
randomize.c
|
||||
|
||||
randomize_LDADD = \
|
||||
$(top_builddir)/plug-ins/gpc/libgpc.a \
|
||||
$(top_builddir)/libgimp/libgimpui.la \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(GTK_LIBS) \
|
||||
|
@ -65,8 +65,6 @@
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include <plug-ins/gpc/gpc.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
/*********************************
|
||||
@ -96,26 +94,30 @@
|
||||
*
|
||||
********************************/
|
||||
|
||||
typedef struct {
|
||||
gdouble blur_pct; /* likelihood of randomization (as %age) */
|
||||
gdouble blur_rcount; /* repeat count */
|
||||
gint seed_type; /* seed init. type - current time or user value */
|
||||
gint blur_seed; /* seed value for rand() function */
|
||||
typedef struct
|
||||
{
|
||||
gdouble blur_pct; /* likelihood of randomization (as %age) */
|
||||
gdouble blur_rcount; /* repeat count */
|
||||
gint seed_type; /* seed init. type - current time or user value */
|
||||
gint blur_seed; /* seed value for rand() function */
|
||||
} BlurVals;
|
||||
|
||||
static BlurVals pivals = {
|
||||
100.0,
|
||||
1.0,
|
||||
SEED_TIME,
|
||||
0,
|
||||
static BlurVals pivals =
|
||||
{
|
||||
100.0,
|
||||
1.0,
|
||||
SEED_TIME,
|
||||
0,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
gint run;
|
||||
typedef struct
|
||||
{
|
||||
gint run;
|
||||
} BlurInterface;
|
||||
|
||||
static BlurInterface blur_int = {
|
||||
FALSE /* have we run? */
|
||||
static BlurInterface blur_int =
|
||||
{
|
||||
FALSE /* have we run? */
|
||||
};
|
||||
|
||||
|
||||
@ -126,10 +128,10 @@ static BlurInterface blur_int = {
|
||||
********************************/
|
||||
|
||||
static void query (void);
|
||||
static void run (char *name,
|
||||
int nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
static void run (gchar *name,
|
||||
gint nparams,
|
||||
GParam *param,
|
||||
gint *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
|
||||
GPlugInInfo PLUG_IN_INFO =
|
||||
@ -148,11 +150,16 @@ static inline void blur_prepare_row (GPixelRgn *pixel_rgn,
|
||||
int y,
|
||||
int w);
|
||||
|
||||
static gint blur_dialog (void);
|
||||
|
||||
static void blur_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static gint blur_dialog (void);
|
||||
|
||||
static void blur_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void blur_text_update (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void blur_toggle_update (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void blur_scale_update (GtkAdjustment *adjustment,
|
||||
gdouble *scale_val);
|
||||
|
||||
/************************************ Guts ***********************************/
|
||||
|
||||
@ -235,10 +242,10 @@ query (void)
|
||||
********************************/
|
||||
|
||||
static void
|
||||
run (char *name,
|
||||
int nparams,
|
||||
run (gchar *name,
|
||||
gint nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
gint *nreturn_vals,
|
||||
GParam **return_vals)
|
||||
{
|
||||
GDrawable *drawable;
|
||||
@ -458,10 +465,10 @@ blur (GDrawable *drawable)
|
||||
/*
|
||||
* allocate row buffers
|
||||
*/
|
||||
prev_row = (guchar *) malloc((x2 - x1 + 2) * bytes);
|
||||
cur_row = (guchar *) malloc((x2 - x1 + 2) * bytes);
|
||||
next_row = (guchar *) malloc((x2 - x1 + 2) * bytes);
|
||||
dest = (guchar *) malloc((x2 - x1) * bytes);
|
||||
prev_row = g_new (guchar, (x2 - x1 + 2) * bytes);
|
||||
cur_row = g_new (guchar, (x2 - x1 + 2) * bytes);
|
||||
next_row = g_new (guchar, (x2 - x1 + 2) * bytes);
|
||||
dest = g_new (guchar, (x2 - x1) * bytes);
|
||||
|
||||
/*
|
||||
* initialize the pixel regions
|
||||
@ -592,10 +599,10 @@ blur (GDrawable *drawable)
|
||||
/*
|
||||
* clean up after ourselves.
|
||||
*/
|
||||
free(prev_row);
|
||||
free(cur_row);
|
||||
free(next_row);
|
||||
free(dest);
|
||||
g_free (prev_row);
|
||||
g_free (cur_row);
|
||||
g_free (next_row);
|
||||
g_free (dest);
|
||||
}
|
||||
|
||||
/*********************************
|
||||
@ -612,7 +619,10 @@ blur_dialog (void)
|
||||
GtkWidget *seed_hbox;
|
||||
GtkWidget *seed_vbox;
|
||||
GtkWidget *table;
|
||||
GSList *seed_group = NULL;
|
||||
GtkWidget *scale;
|
||||
GtkObject *scale_data;
|
||||
GtkWidget *radio_button;
|
||||
GSList *group = NULL;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
gchar buffer[10];
|
||||
@ -659,7 +669,7 @@ blur_dialog (void)
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
gtk_widget_show (table);
|
||||
|
||||
gpc_setup_tooltips (table);
|
||||
gimp_help_init ();
|
||||
|
||||
label = gtk_label_new (_("Randomization Seed:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
@ -672,37 +682,58 @@ blur_dialog (void)
|
||||
seed_vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_table_attach (GTK_TABLE (table), seed_vbox, 1, 2, 1, 2,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
||||
gtk_widget_show (seed_vbox);
|
||||
/*
|
||||
* Time button
|
||||
*/
|
||||
gpc_add_radio_button (&seed_group, _("Current Time"), seed_vbox, &do_time,
|
||||
_("Seed random number generator from the current "
|
||||
"time - this guarantees a reasonable randomization"));
|
||||
radio_button = gtk_radio_button_new_with_label (NULL, _("Current Time"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
|
||||
gtk_box_pack_start (GTK_BOX (seed_vbox), radio_button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
|
||||
GTK_SIGNAL_FUNC (blur_toggle_update),
|
||||
&do_time);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), do_time);
|
||||
gtk_widget_show (radio_button);
|
||||
gimp_help_set_help_data (radio_button,
|
||||
_("Seed random number generator from the current "
|
||||
"time - this guarantees a reasonable "
|
||||
"randomization"), NULL);
|
||||
/*
|
||||
* Box to hold seed user initialization controls
|
||||
*/
|
||||
seed_hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (seed_vbox), seed_hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (seed_hbox);
|
||||
/*
|
||||
* User button
|
||||
*/
|
||||
gpc_add_radio_button (&seed_group, _("Other Value"), seed_hbox, &do_user,
|
||||
_("Enable user-entered value for random number "
|
||||
"generator seed - this allows you to repeat a "
|
||||
"given \"random\" operation"));
|
||||
radio_button = gtk_radio_button_new_with_label (group, _("Other Value"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
|
||||
gtk_box_pack_start (GTK_BOX (seed_hbox), radio_button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
|
||||
GTK_SIGNAL_FUNC (blur_toggle_update),
|
||||
&do_user);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), do_user);
|
||||
gtk_widget_show (radio_button);
|
||||
gimp_help_set_help_data (radio_button,
|
||||
_("Enable user-entered value for random number "
|
||||
"generator seed - this allows you to repeat a "
|
||||
"given \"random\" operation"), NULL);
|
||||
/*
|
||||
* Randomization seed number (text)
|
||||
*/
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_usize (entry, ENTRY_WIDTH, 0);
|
||||
gtk_box_pack_start(GTK_BOX(seed_hbox), entry, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX (seed_hbox), entry, FALSE, FALSE, 0);
|
||||
g_snprintf (buffer, sizeof (buffer), "%d", pivals.blur_seed);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), buffer);
|
||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||
(GtkSignalFunc) gpc_text_update,
|
||||
GTK_SIGNAL_FUNC (blur_text_update),
|
||||
&pivals.blur_seed);
|
||||
gtk_widget_show (entry);
|
||||
gpc_set_tooltip (entry, _("Value for seeding the random number generator"));
|
||||
gimp_help_set_help_data (entry,
|
||||
_("Value for seeding the random number generator"),
|
||||
NULL);
|
||||
gtk_widget_show (seed_hbox);
|
||||
/*
|
||||
* Randomization percentage label & scale (1 to 100)
|
||||
@ -712,10 +743,20 @@ blur_dialog (void)
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gpc_add_hscale (table, SCALE_WIDTH,
|
||||
1.0, 100.0, &pivals.blur_pct, 1, 2, 2, 3,
|
||||
_("Percentage of pixels to be filtered"));
|
||||
|
||||
scale_data = gtk_adjustment_new (pivals.blur_pct, 1.0, 100.0, 1.0, 1.0, 0.0);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (scale_data));
|
||||
gtk_widget_set_usize (scale, SCALE_WIDTH, -1);
|
||||
gtk_table_attach (GTK_TABLE (table), scale, 1, 2, 2, 3,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
||||
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
||||
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
||||
gtk_signal_connect (GTK_OBJECT (scale_data), "value_changed",
|
||||
GTK_SIGNAL_FUNC (blur_scale_update),
|
||||
&pivals.blur_pct);
|
||||
gtk_widget_show (scale);
|
||||
gimp_help_set_help_data (scale,
|
||||
_("Percentage of pixels to be filtered"), NULL);
|
||||
/*
|
||||
* Repeat count label & scale (1 to 100)
|
||||
*/
|
||||
@ -724,10 +765,20 @@ blur_dialog (void)
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gpc_add_hscale (table, SCALE_WIDTH,
|
||||
1.0, 100.0, &pivals.blur_rcount, 1, 2, 3, 4,
|
||||
_("Number of times to apply filter"));
|
||||
|
||||
scale_data = gtk_adjustment_new (pivals.blur_rcount, 1.0, 100.0,
|
||||
1.0, 1.0, 0.0);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (scale_data));
|
||||
gtk_widget_set_usize (scale, SCALE_WIDTH, -1);
|
||||
gtk_table_attach (GTK_TABLE (table), scale, 1, 2, 3, 4,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
||||
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
||||
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
||||
gtk_signal_connect (GTK_OBJECT (scale_data), "value_changed",
|
||||
GTK_SIGNAL_FUNC (blur_scale_update),
|
||||
&pivals.blur_rcount);
|
||||
gtk_widget_show (scale);
|
||||
gimp_help_set_help_data (scale, _("Number of times to apply filter"), NULL);
|
||||
/*
|
||||
* Display everything.
|
||||
*/
|
||||
@ -735,6 +786,7 @@ blur_dialog (void)
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
gtk_main ();
|
||||
gimp_help_free ();
|
||||
gdk_flush ();
|
||||
|
||||
/*
|
||||
@ -761,3 +813,35 @@ blur_ok_callback (GtkWidget *widget,
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (data));
|
||||
}
|
||||
|
||||
static void
|
||||
blur_text_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gint *text_val;
|
||||
|
||||
text_val = (gint *) data;
|
||||
|
||||
*text_val = atoi (gtk_entry_get_text (GTK_ENTRY (widget)));
|
||||
}
|
||||
|
||||
static void
|
||||
blur_toggle_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gint *toggle_val;
|
||||
|
||||
toggle_val = (gint *) data;
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
*toggle_val = TRUE;
|
||||
else
|
||||
*toggle_val = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
blur_scale_update (GtkAdjustment *adjustment,
|
||||
gdouble *scale_val)
|
||||
{
|
||||
*scale_val = adjustment->value;
|
||||
}
|
||||
|
@ -50,12 +50,13 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimp/gimp.h"
|
||||
#include "libgimp/gimpui.h"
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
#ifdef RCSID
|
||||
static char rcsid[] = "$Id$";
|
||||
static gchar rcsid[] = "$Id$";
|
||||
#endif
|
||||
|
||||
/* Some useful macros */
|
||||
@ -619,24 +620,23 @@ edge_dialog (GDrawable *drawable)
|
||||
GtkWidget *frame;
|
||||
GtkWidget *table;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *hbbox;
|
||||
GtkWidget *button;
|
||||
GtkWidget *toggle;
|
||||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
GtkObject *scale_data;
|
||||
GtkWidget *entry;
|
||||
gchar buffer[256];
|
||||
GSList *group = NULL;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
gint use_wrap = (evals.wrapmode == WRAP);
|
||||
gint use_smear = (evals.wrapmode == SMEAR);
|
||||
gint use_black = (evals.wrapmode == BLACK);
|
||||
gdouble init_val;
|
||||
gchar buffer[256];
|
||||
GSList *group = NULL;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
gint use_wrap = (evals.wrapmode == WRAP);
|
||||
gint use_smear = (evals.wrapmode == SMEAR);
|
||||
gint use_black = (evals.wrapmode == BLACK);
|
||||
gdouble init_val;
|
||||
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
argv[0] = g_strdup ("edge");
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
@ -659,21 +659,21 @@ edge_dialog (GDrawable *drawable)
|
||||
NULL);
|
||||
|
||||
/* parameter settings */
|
||||
frame = gtk_frame_new ( _("Edge Detection Options"));
|
||||
frame = gtk_frame_new (_("Parameter Settings"));
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_container_border_width (GTK_CONTAINER (frame), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
table = gtk_table_new (2, 3, FALSE);
|
||||
gtk_container_border_width (GTK_CONTAINER (table), 5);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
|
||||
/*
|
||||
Label, scale, entry for evals.amount
|
||||
*/
|
||||
/* Label, scale, entry for evals.amount */
|
||||
|
||||
label = gtk_label_new ( _("Amount:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
label = gtk_label_new (_("Amount:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* This prevents annoying change of adjustment */
|
||||
@ -697,16 +697,16 @@ edge_dialog (GDrawable *drawable)
|
||||
gtk_widget_show (entry);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_FILL, 0, 5, 0);
|
||||
GTK_FILL, 0, 0, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), scale, 2, 3, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, 0, 5, 0);
|
||||
GTK_EXPAND | GTK_FILL, 0, 0, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
|
||||
GTK_FILL, 0, 0, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (scale_data), "value_changed",
|
||||
(GtkSignalFunc) edge_scale_update,
|
||||
&evals.amount);
|
||||
sprintf (buffer, "%0.1f", evals.amount);
|
||||
g_snprintf (buffer, sizeof (buffer), "%0.1f", evals.amount);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), buffer);
|
||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||
(GtkSignalFunc) edge_entry_update,
|
||||
@ -714,14 +714,10 @@ edge_dialog (GDrawable *drawable)
|
||||
|
||||
gtk_object_set_user_data (GTK_OBJECT (entry), scale_data);
|
||||
gtk_object_set_user_data (scale_data, entry);
|
||||
|
||||
|
||||
/*
|
||||
Radio buttons WRAP, SMEAR, BLACK ...
|
||||
*/
|
||||
/* Radio buttons WRAP, SMEAR, BLACK */
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 5);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_table_attach (GTK_TABLE (table), hbox, 0, 3, 1, 2,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
'autocrop' => { libdep => 'glib' },
|
||||
'autostretch_hsv' => { libdep => 'glib' },
|
||||
'blinds' => { libdep => 'gtk', ui => 1 },
|
||||
'blur' => { libdep => 'gtk', ui => 1, libsupp => 'gpc' },
|
||||
'blur' => { libdep => 'gtk', ui => 1 },
|
||||
'bumpmap' => { libdep => 'gtk', ui => 1 },
|
||||
'bz2' => { libdep => 'glib' },
|
||||
'c_astretch' => { libdep => 'glib' },
|
||||
@ -84,7 +84,7 @@
|
||||
'ps' => { libdep => 'gtk', ui => 1 },
|
||||
'psd' => { libdep => 'glib' },
|
||||
'psp' => { libdep => 'gtk', ui => 1, optional => 1, libopt => 'z' },
|
||||
'randomize' => { libdep => 'gtk', libsupp => 'gpc', ui => 1 },
|
||||
'randomize' => { libdep => 'gtk', ui => 1 },
|
||||
'ripple' => { libdep => 'gtk', ui => 1 },
|
||||
'rotate' => { libdep => 'glib' },
|
||||
'sample_colorize' => { libdep => 'gtk', ui => 1 },
|
||||
|
@ -81,8 +81,6 @@
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include <plug-ins/gpc/gpc.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
/*********************************
|
||||
@ -91,18 +89,20 @@
|
||||
*
|
||||
********************************/
|
||||
|
||||
|
||||
/*
|
||||
* progress meter update frequency
|
||||
*/
|
||||
#define PROG_UPDATE_TIME ((row % 10) == 0)
|
||||
|
||||
char *PLUG_IN_NAME[] = {
|
||||
"plug_in_randomize_hurl",
|
||||
"plug_in_randomize_pick",
|
||||
"plug_in_randomize_slur",
|
||||
gchar *PLUG_IN_NAME[] =
|
||||
{
|
||||
"plug_in_randomize_hurl",
|
||||
"plug_in_randomize_pick",
|
||||
"plug_in_randomize_slur",
|
||||
};
|
||||
char *RNDM_VERSION[] = {
|
||||
|
||||
gchar *RNDM_VERSION[] =
|
||||
{
|
||||
N_("Random Hurl 1.7"),
|
||||
N_("Random Pick 1.7"),
|
||||
N_("Random Slur 1.7"),
|
||||
@ -126,26 +126,30 @@ gint rndm_type = RNDM_HURL; /* hurl, pick, etc. */
|
||||
*
|
||||
********************************/
|
||||
|
||||
typedef struct {
|
||||
gdouble rndm_pct; /* likelihood of randomization (as %age) */
|
||||
gdouble rndm_rcount; /* repeat count */
|
||||
gint seed_type; /* seed init. type - current time or user value */
|
||||
gint rndm_seed; /* seed value for rand() function */
|
||||
typedef struct
|
||||
{
|
||||
gdouble rndm_pct; /* likelihood of randomization (as %age) */
|
||||
gdouble rndm_rcount; /* repeat count */
|
||||
gint seed_type; /* seed init. type - current time or user value */
|
||||
gint rndm_seed; /* seed value for rand() function */
|
||||
} RandomizeVals;
|
||||
|
||||
static RandomizeVals pivals = {
|
||||
50.0,
|
||||
1.0,
|
||||
SEED_TIME,
|
||||
0,
|
||||
static RandomizeVals pivals =
|
||||
{
|
||||
50.0,
|
||||
1.0,
|
||||
SEED_TIME,
|
||||
0,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
gint run;
|
||||
typedef struct
|
||||
{
|
||||
gint run;
|
||||
} RandomizeInterface;
|
||||
|
||||
static RandomizeInterface rndm_int = {
|
||||
FALSE /* have we run? */
|
||||
static RandomizeInterface rndm_int =
|
||||
{
|
||||
FALSE /* have we run? */
|
||||
};
|
||||
|
||||
|
||||
@ -156,17 +160,18 @@ static RandomizeInterface rndm_int = {
|
||||
********************************/
|
||||
|
||||
static void query (void);
|
||||
static void run (char *name,
|
||||
int nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
static void run (gchar *name,
|
||||
gint nparams,
|
||||
GParam *param,
|
||||
gint *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
|
||||
GPlugInInfo PLUG_IN_INFO = {
|
||||
NULL, /* init_proc */
|
||||
NULL, /* quit_proc */
|
||||
query, /* query_proc */
|
||||
run, /* run_proc */
|
||||
GPlugInInfo PLUG_IN_INFO =
|
||||
{
|
||||
NULL, /* init_proc */
|
||||
NULL, /* quit_proc */
|
||||
query, /* query_proc */
|
||||
run, /* run_proc */
|
||||
};
|
||||
|
||||
static void randomize (GDrawable *drawable);
|
||||
@ -177,11 +182,16 @@ static inline void randomize_prepare_row (GPixelRgn *pixel_rgn,
|
||||
int y,
|
||||
int w);
|
||||
|
||||
static gint randomize_dialog (void);
|
||||
|
||||
static void randomize_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static gint randomize_dialog (void);
|
||||
|
||||
static void randomize_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void randomize_text_update (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void randomize_toggle_update (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void randomize_scale_update (GtkAdjustment *adjustment,
|
||||
gdouble *scale_val);
|
||||
|
||||
/************************************ Guts ***********************************/
|
||||
|
||||
@ -209,35 +219,35 @@ query (void)
|
||||
{ PARAM_INT32, "rndm_seed", "Seed value (used only if seed type is 11)" },
|
||||
};
|
||||
static GParamDef *return_vals = NULL;
|
||||
static int nargs = sizeof(args) / sizeof (args[0]);
|
||||
static int nreturn_vals = 0;
|
||||
static gint nargs = sizeof(args) / sizeof (args[0]);
|
||||
static gint nreturn_vals = 0;
|
||||
|
||||
const char *hurl_blurb =
|
||||
const gchar *hurl_blurb =
|
||||
_("Add a random factor to the image by hurling random data at it.");
|
||||
const char *pick_blurb =
|
||||
const gchar *pick_blurb =
|
||||
_("Add a random factor to the image by picking a random adjacent pixel.");
|
||||
const char *slur_blurb =
|
||||
const gchar *slur_blurb =
|
||||
_("Add a random factor to the image by slurring (similar to melting).");
|
||||
|
||||
const char *hurl_help =
|
||||
const gchar *hurl_help =
|
||||
_("This plug-in ``hurls'' randomly-valued pixels onto the selection or image. You may select the percentage of pixels to modify and the number of times to repeat the process.");
|
||||
const char *pick_help =
|
||||
const gchar *pick_help =
|
||||
_("This plug-in replaces a pixel with a random adjacent pixel. You may select the percentage of pixels to modify and the number of times to repeat the process.");
|
||||
const char *slur_help =
|
||||
const gchar *slur_help =
|
||||
_("This plug-in slurs (melts like a bunch of icicles) an image. You may select the percentage of pixels to modify and the number of times to repeat the process.");
|
||||
|
||||
const char *author = "Miles O'Neal <meo@rru.com> http://www.rru.com/~meo/";
|
||||
const char *copyrights = "Miles O'Neal, Spencer Kimball, Peter Mattis, Torsten Martinsen, Brian Degenhardt, Federico Mena Quintero, Stephen Norris, Daniel Cotting";
|
||||
const char *copyright_date = "1995-1998";
|
||||
const gchar *author = "Miles O'Neal <meo@rru.com> http://www.rru.com/~meo/";
|
||||
const gchar *copyrights = "Miles O'Neal, Spencer Kimball, Peter Mattis, Torsten Martinsen, Brian Degenhardt, Federico Mena Quintero, Stephen Norris, Daniel Cotting";
|
||||
const gchar *copyright_date = "1995-1998";
|
||||
|
||||
INIT_I18N();
|
||||
|
||||
gimp_install_procedure (PLUG_IN_NAME[0],
|
||||
(char *) hurl_blurb,
|
||||
(char *) hurl_help,
|
||||
(char *) author,
|
||||
(char *) copyrights,
|
||||
(char *) copyright_date,
|
||||
(gchar *) hurl_blurb,
|
||||
(gchar *) hurl_help,
|
||||
(gchar *) author,
|
||||
(gchar *) copyrights,
|
||||
(gchar *) copyright_date,
|
||||
N_("<Image>/Filters/Noise/Hurl..."),
|
||||
"RGB*, GRAY*, INDEXED*",
|
||||
PROC_PLUG_IN,
|
||||
@ -245,11 +255,11 @@ query (void)
|
||||
args, return_vals);
|
||||
|
||||
gimp_install_procedure (PLUG_IN_NAME[1],
|
||||
(char *) pick_blurb,
|
||||
(char *) pick_help,
|
||||
(char *) author,
|
||||
(char *) copyrights,
|
||||
(char *) copyright_date,
|
||||
(gchar *) pick_blurb,
|
||||
(gchar *) pick_help,
|
||||
(gchar *) author,
|
||||
(gchar *) copyrights,
|
||||
(gchar *) copyright_date,
|
||||
N_("<Image>/Filters/Noise/Pick..."),
|
||||
"RGB*, GRAY*, INDEXED*",
|
||||
PROC_PLUG_IN,
|
||||
@ -257,11 +267,11 @@ query (void)
|
||||
args, return_vals);
|
||||
|
||||
gimp_install_procedure (PLUG_IN_NAME[2],
|
||||
(char *) slur_blurb,
|
||||
(char *) slur_help,
|
||||
(char *) author,
|
||||
(char *) copyrights,
|
||||
(char *) copyright_date,
|
||||
(gchar *) slur_blurb,
|
||||
(gchar *) slur_help,
|
||||
(gchar *) author,
|
||||
(gchar *) copyrights,
|
||||
(gchar *) copyright_date,
|
||||
N_("<Image>/Filters/Noise/Slur..."),
|
||||
"RGB*, GRAY*, INDEXED*",
|
||||
PROC_PLUG_IN,
|
||||
@ -269,7 +279,6 @@ query (void)
|
||||
args, return_vals);
|
||||
}
|
||||
|
||||
|
||||
/*********************************
|
||||
*
|
||||
* run() - main routine
|
||||
@ -280,17 +289,17 @@ query (void)
|
||||
********************************/
|
||||
|
||||
static void
|
||||
run (char *name,
|
||||
int nparams,
|
||||
run (gchar *name,
|
||||
gint nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
gint *nreturn_vals,
|
||||
GParam **return_vals)
|
||||
{
|
||||
GDrawable *drawable;
|
||||
GRunModeType run_mode;
|
||||
GStatusType status = STATUS_SUCCESS; /* assume the best! */
|
||||
char *rndm_type_str = '\0';
|
||||
char prog_label[32];
|
||||
gchar *rndm_type_str = '\0';
|
||||
gchar prog_label[32];
|
||||
static GParam values[1];
|
||||
/*
|
||||
* Get the specified drawable, do standard initialization.
|
||||
@ -509,10 +518,10 @@ randomize (GDrawable *drawable)
|
||||
/*
|
||||
* allocate row buffers
|
||||
*/
|
||||
prev_row = (guchar *) malloc((x2 - x1 + 2) * bytes);
|
||||
cur_row = (guchar *) malloc((x2 - x1 + 2) * bytes);
|
||||
next_row = (guchar *) malloc((x2 - x1 + 2) * bytes);
|
||||
dest = (guchar *) malloc((x2 - x1) * bytes);
|
||||
prev_row = g_new (guchar, (x2 - x1 + 2) * bytes);
|
||||
cur_row = g_new (guchar, (x2 - x1 + 2) * bytes);
|
||||
next_row = g_new (guchar, (x2 - x1 + 2) * bytes);
|
||||
dest = g_new (guchar, (x2 - x1) * bytes);
|
||||
|
||||
/*
|
||||
* initialize the pixel regions
|
||||
@ -668,10 +677,10 @@ randomize (GDrawable *drawable)
|
||||
/*
|
||||
* clean up after ourselves.
|
||||
*/
|
||||
free(prev_row);
|
||||
free(cur_row);
|
||||
free(next_row);
|
||||
free(dest);
|
||||
g_free (prev_row);
|
||||
g_free (cur_row);
|
||||
g_free (next_row);
|
||||
g_free (dest);
|
||||
}
|
||||
|
||||
/*********************************
|
||||
@ -697,7 +706,10 @@ randomize_dialog (void)
|
||||
GtkWidget *seed_vbox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GSList *seed_group = NULL;
|
||||
GtkWidget *scale;
|
||||
GtkObject *scale_data;
|
||||
GtkWidget *radio_button;
|
||||
GSList *group = NULL;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
gchar buffer[10];
|
||||
@ -747,7 +759,8 @@ randomize_dialog (void)
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
gtk_widget_show(table);
|
||||
gpc_setup_tooltips (table);
|
||||
|
||||
gimp_help_init ();
|
||||
|
||||
/*
|
||||
* Randomization seed initialization controls
|
||||
@ -762,24 +775,43 @@ randomize_dialog (void)
|
||||
seed_vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_table_attach (GTK_TABLE (table), seed_vbox, 1, 2, 1, 2,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 5, 0);
|
||||
gtk_widget_show (seed_vbox);
|
||||
/*
|
||||
* Time button
|
||||
*/
|
||||
gpc_add_radio_button (&seed_group, _("Current Time"), seed_vbox, &do_time,
|
||||
_("Seed random number generator from the current time "
|
||||
"- this guarantees a reasonable randomization"));
|
||||
radio_button = gtk_radio_button_new_with_label (NULL, _("Current Time"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
|
||||
gtk_box_pack_start (GTK_BOX (seed_vbox), radio_button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
|
||||
GTK_SIGNAL_FUNC (randomize_toggle_update),
|
||||
&do_time);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), do_time);
|
||||
gtk_widget_show (radio_button);
|
||||
gimp_help_set_help_data (radio_button,
|
||||
_("Seed random number generator from the current "
|
||||
"time - this guarantees a reasonable "
|
||||
"randomization"), NULL);
|
||||
/*
|
||||
* Box to hold seed user initialization controls
|
||||
*/
|
||||
seed_hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (seed_vbox), seed_hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (seed_hbox);
|
||||
/*
|
||||
* User button
|
||||
*/
|
||||
gpc_add_radio_button (&seed_group, _("Other Value"), seed_hbox, &do_user,
|
||||
_("Enable user-entered value for random number "
|
||||
"generator seed - this allows you to repeat a "
|
||||
"given \"random\" operation"));
|
||||
radio_button = gtk_radio_button_new_with_label (group, _("Other Value"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
|
||||
gtk_box_pack_start (GTK_BOX (seed_hbox), radio_button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
|
||||
GTK_SIGNAL_FUNC (randomize_toggle_update),
|
||||
&do_user);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), do_user);
|
||||
gtk_widget_show (radio_button);
|
||||
gimp_help_set_help_data (radio_button,
|
||||
_("Enable user-entered value for random number "
|
||||
"generator seed - this allows you to repeat a "
|
||||
"given \"random\" operation"), NULL);
|
||||
/*
|
||||
* Randomization seed number (text)
|
||||
*/
|
||||
@ -789,10 +821,12 @@ randomize_dialog (void)
|
||||
g_snprintf (buffer, sizeof (buffer), "%d", pivals.rndm_seed);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), buffer);
|
||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||
(GtkSignalFunc) gpc_text_update,
|
||||
GTK_SIGNAL_FUNC (randomize_text_update),
|
||||
&pivals.rndm_seed);
|
||||
gtk_widget_show (entry);
|
||||
gpc_set_tooltip (entry, _("Value for seeding the random number generator"));
|
||||
gimp_help_set_help_data (entry,
|
||||
_("Value for seeding the random number generator"),
|
||||
NULL);
|
||||
gtk_widget_show (seed_hbox);
|
||||
/*
|
||||
* Randomization percentage label & scale (1 to 100)
|
||||
@ -802,10 +836,20 @@ randomize_dialog (void)
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gpc_add_hscale (table, SCALE_WIDTH,
|
||||
1.0, 100.0, &pivals.rndm_pct, 1, 2, 2, 3,
|
||||
_("Percentage of pixels to be filtered"));
|
||||
|
||||
scale_data = gtk_adjustment_new (pivals.rndm_pct, 1.0, 100.0, 1.0, 1.0, 0.0);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (scale_data));
|
||||
gtk_widget_set_usize (scale, SCALE_WIDTH, -1);
|
||||
gtk_table_attach (GTK_TABLE (table), scale, 1, 2, 2, 3,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
||||
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
||||
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
||||
gtk_signal_connect (GTK_OBJECT (scale_data), "value_changed",
|
||||
GTK_SIGNAL_FUNC (randomize_scale_update),
|
||||
&pivals.rndm_pct);
|
||||
gtk_widget_show (scale);
|
||||
gimp_help_set_help_data (scale,
|
||||
_("Percentage of pixels to be filtered"), NULL);
|
||||
/*
|
||||
* Repeat count label & scale (1 to 100)
|
||||
*/
|
||||
@ -814,10 +858,20 @@ randomize_dialog (void)
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gpc_add_hscale (table, SCALE_WIDTH,
|
||||
1.0, 100.0, &pivals.rndm_rcount, 1, 2, 3, 4,
|
||||
_("Number of times to apply filter"));
|
||||
|
||||
scale_data = gtk_adjustment_new (pivals.rndm_rcount, 1.0, 100.0,
|
||||
1.0, 1.0, 0.0);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (scale_data));
|
||||
gtk_widget_set_usize (scale, SCALE_WIDTH, -1);
|
||||
gtk_table_attach (GTK_TABLE (table), scale, 1, 2, 3, 4,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
||||
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
||||
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
||||
gtk_signal_connect (GTK_OBJECT (scale_data), "value_changed",
|
||||
GTK_SIGNAL_FUNC (randomize_scale_update),
|
||||
&pivals.rndm_rcount);
|
||||
gtk_widget_show (scale);
|
||||
gimp_help_set_help_data (scale, _("Number of times to apply filter"), NULL);
|
||||
/*
|
||||
* Display everything.
|
||||
*/
|
||||
@ -825,6 +879,7 @@ randomize_dialog (void)
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
gtk_main ();
|
||||
gimp_help_free ();
|
||||
gdk_flush ();
|
||||
/*
|
||||
* Figure out which type of seed initialization to apply.
|
||||
@ -849,3 +904,35 @@ randomize_ok_callback (GtkWidget *widget,
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (data));
|
||||
}
|
||||
|
||||
void
|
||||
randomize_text_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gint *text_val;
|
||||
|
||||
text_val = (gint *) data;
|
||||
|
||||
*text_val = atoi (gtk_entry_get_text (GTK_ENTRY (widget)));
|
||||
}
|
||||
|
||||
static void
|
||||
randomize_toggle_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gint *toggle_val;
|
||||
|
||||
toggle_val = (gint *) data;
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
*toggle_val = TRUE;
|
||||
else
|
||||
*toggle_val = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
randomize_scale_update (GtkAdjustment *adjustment,
|
||||
gdouble *scale_val)
|
||||
{
|
||||
*scale_val = adjustment->value;
|
||||
}
|
||||
|
@ -1,6 +0,0 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
.deps
|
||||
_libs
|
||||
.libs
|
||||
gpc
|
@ -1,28 +0,0 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
lib_LIBRARIES = libgpc.a
|
||||
|
||||
libgpc_a_SOURCES = \
|
||||
gpc.c \
|
||||
gpc.h
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
$(GTK_CFLAGS) \
|
||||
-I$(includedir)
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(GTK_LIBS) \
|
||||
$(INTLLIBS)
|
||||
|
||||
EXTRA_DIST = gpc.3 gpc.man
|
||||
|
||||
man_MANS = gpc.3
|
||||
|
||||
.PHONY: files
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
@ -1,293 +0,0 @@
|
||||
.TH gpc 3 "30 Apr 1998" "Roadkills-R-Us" "Gimp Plug-ins"
|
||||
.\"Copyright 1997-8, Roadkills-R-Us, Austin, TX, USA. All rights reserved.
|
||||
.\"
|
||||
.\" gpc version 1.4
|
||||
.de Ss
|
||||
.sp
|
||||
.ft CW
|
||||
.nf
|
||||
..
|
||||
.de Se
|
||||
.fi
|
||||
.ft P
|
||||
.sp
|
||||
..
|
||||
|
||||
.SH NAME
|
||||
GPC \- GTK Plug-in Convenience library
|
||||
|
||||
.SH SYNOPSIS
|
||||
.Ss
|
||||
#include <plug-ins/gpc/gpc.h>
|
||||
.Se
|
||||
.Ss
|
||||
void gpc_setup_tooltips(GtkWidget *parent);
|
||||
.Se
|
||||
Initialize tooltips interface, set colors.
|
||||
.Ss
|
||||
void gpc_set_tooltip(GtkWidget *widget, const char *tip);
|
||||
.Se
|
||||
Set tooltip for a widget (if tip is non-null).
|
||||
|
||||
.Ss
|
||||
void gpc_add_action_button(char *label,
|
||||
GtkSignalFunc callback, GtkWidget *dialog, char *tip);
|
||||
.Se
|
||||
Add action button (with tooltip) to a dialog.
|
||||
.Ss
|
||||
void gpc_add_radio_button(GSList **group, char *label,
|
||||
GtkWidget *box, gint *value, char *tip);
|
||||
.Se
|
||||
Add radio button (with tooltip) to a dialog.
|
||||
.Ss
|
||||
void gpc_add_hscale(GtkWidget *table, int width,
|
||||
float low, float high, gdouble *val,
|
||||
int left, int right, int top, int bottom, char *tip);
|
||||
.Se
|
||||
Add horizontal scale widget (with tooltip) to a dialog at given location.
|
||||
.Ss
|
||||
void gpc_add_label(char *value, GtkWidget *parent,
|
||||
int left, int right, int top, int bottom);
|
||||
.Se
|
||||
Add label widget (no tooltip) to a dialog at given location.
|
||||
|
||||
.Ss
|
||||
void gpc_close_callback(GtkWidget *widget, gpointer data);
|
||||
.Se
|
||||
Destroy callback - quit this plug-in.
|
||||
.Ss
|
||||
void gpc_cancel_callback(GtkWidget *widget, gpointer data);
|
||||
.Se
|
||||
Cancel button callback - go away without saving state, etc.
|
||||
.Ss
|
||||
void gpc_scale_update(GtkAdjustment *adjustment, double *scale_val);
|
||||
.Se
|
||||
Scale update callback - update the SCALE widget's data.
|
||||
.Ss
|
||||
void gpc_text_update(GtkWidget *widget, gpointer data);
|
||||
.Se
|
||||
Text update callback - update the TEXT widget's data.
|
||||
|
||||
.SH DESCRIPTION
|
||||
This is a set of routines to make life easier on plug-in writers.
|
||||
It helps keep the GUI code short and sweet. (In the plug-in for
|
||||
which it was originally designed, it cut the GUI code in half.)
|
||||
It's somewhat arbitrary in what it includes so far, because I
|
||||
haven't needed everything in GTK. Feel free to contribute more
|
||||
to it.
|
||||
|
||||
.SS TOOLTIPS ROUTINES
|
||||
|
||||
.B gpc_setup_tooltips()
|
||||
must be called first. This initializes internal data
|
||||
structures and sets the tooltip colors. It can be called
|
||||
with any widget high enough in the hierarchy to contain
|
||||
all the widgets needing tooltips. Typically this will be
|
||||
the container widget under the top-level frame:
|
||||
|
||||
.nf
|
||||
Example:
|
||||
frame = gtk_frame_new("Parameter Settings");
|
||||
:
|
||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox),
|
||||
frame, TRUE, TRUE, 0);
|
||||
table = gtk_table_new(4, 2, FALSE);
|
||||
:
|
||||
gtk_widget_show(table);
|
||||
gpc_setup_tooltips(table);
|
||||
.fi
|
||||
|
||||
.PP
|
||||
.B gpc_set_tooltip()
|
||||
may be called directly, but is usually called inside other convenience
|
||||
functions. If called directly, it must still be after the call to
|
||||
gpc_setup_tooltips(). It hides a lot of detail of the GTK tooltips:
|
||||
|
||||
.nf
|
||||
Example:
|
||||
gtk_widget_show(button);
|
||||
gpc_set_tooltip(button, tip);
|
||||
.fi
|
||||
|
||||
|
||||
|
||||
.SS USER INTERFACE ROUTINES
|
||||
|
||||
These routines all hide implementation details to make it
|
||||
easier to lay out a GUI with a consitent, gimp-style interface,
|
||||
while keeping the plug-in code cleaner.
|
||||
|
||||
.PP
|
||||
.B gpc_add_action_button()
|
||||
adds an action button (such as [Cancel]
|
||||
or [OK] to the action button area of a frame. The
|
||||
.I callback
|
||||
argument has the standard GTK callback interface. A standard
|
||||
callback is provided for [Cancel] buttons if you wish to use it.
|
||||
|
||||
.PP
|
||||
Usage:
|
||||
.nf
|
||||
void
|
||||
gpc_add_action_button(
|
||||
char *label, /* text for action button */
|
||||
GtkSignalFunc callback, /* callback function address */
|
||||
GtkWidget *dialog, /* dialog widget to contain button */
|
||||
char *tip /* tooltip text */
|
||||
)
|
||||
|
||||
Example:
|
||||
static void
|
||||
randomize_ok_callback(GtkWidget *widget, gpointer data) {
|
||||
rndm_int.run = TRUE;
|
||||
gtk_widget_destroy(GTK_WIDGET(data));
|
||||
}
|
||||
:
|
||||
gpc_add_action_button("OK",
|
||||
(GtkSignalFunc) randomize_ok_callback, dlg,
|
||||
"Accept settings and apply filter to image");
|
||||
gpc_add_action_button("Cancel",
|
||||
(GtkSignalFunc) gpc_cancel_callback, dlg,
|
||||
"Close plug-in without making any changes");
|
||||
.fi
|
||||
|
||||
.PP
|
||||
.B gpc_add_radio_button()
|
||||
adds a radio button. If the radio group does not exist,
|
||||
it will be created and passed back in the
|
||||
.I group
|
||||
argument. A standard callback will be attached to the radio
|
||||
button, requiring a state variable which you provide via the
|
||||
.I value
|
||||
argument.
|
||||
|
||||
.nf
|
||||
Usage:
|
||||
void
|
||||
gpc_add_radio_button(
|
||||
GSList **group, /* address of radio group */
|
||||
char *label, /* label for new radio button */
|
||||
GtkWidget *box, /* radio box for this radio button */
|
||||
gint *value, /* address of state variable */
|
||||
char *tip /* tooltip text */
|
||||
)
|
||||
|
||||
Example:
|
||||
GSList *type_group = NULL;
|
||||
:
|
||||
gpc_add_label("Randomization Type:", table, 0, 1, 0, 1);
|
||||
|
||||
toggle_hbox = gtk_hbox_new(FALSE, 5);
|
||||
gtk_container_border_width(GTK_CONTAINER(toggle_hbox), 5);
|
||||
gtk_table_attach(GTK_TABLE(table), toggle_hbox, 1, 2, 0, 1,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 5, 0);
|
||||
|
||||
gpc_add_radio_button(&type_group,
|
||||
"Hurl", toggle_hbox, &do_hurl,
|
||||
"Hurl random colors onto pixels");
|
||||
gpc_add_radio_button(&type_group,
|
||||
"Pick", toggle_hbox, &do_pick,
|
||||
"Pick at random from neighboring pixels");
|
||||
gpc_add_radio_button(&type_group,
|
||||
"Slur", toggle_hbox, &do_slur,
|
||||
"Simplistic melt");
|
||||
.fi
|
||||
|
||||
|
||||
.PP
|
||||
.B gpc_add_hscale()
|
||||
adds a horizontal scale to a table container at the designated coordinates.
|
||||
A standard callback will be attached to the scale,
|
||||
requiring a state variable which you provide via the
|
||||
.I value
|
||||
argument.
|
||||
|
||||
.nf
|
||||
Usage:
|
||||
void
|
||||
gpc_add_hscale(
|
||||
GtkWidget *table, /* table widget to hold scale */
|
||||
int width, /* width (in pixels) of scale */
|
||||
float low, /* low value for scale */
|
||||
float high, /* high value for scale */
|
||||
gdouble *value, /* pointer to current value */
|
||||
int left, /* left table position info */
|
||||
int right, /* right table position info */
|
||||
int top, /* top table position info */
|
||||
int bottom, /* bottom table position info */
|
||||
char *tip /* tooltip text */
|
||||
)
|
||||
|
||||
Example:
|
||||
gpc_add_label("Randomization %:", table, 0, 1, 2, 3);
|
||||
gpc_add_hscale(table, SCALE_WIDTH,
|
||||
1.0, 100.0, &pivals.rndm_pct, 1, 2, 2, 3,
|
||||
"Percentage of pixels to be filtered");
|
||||
.fi
|
||||
|
||||
.PP
|
||||
.B gpc_add_label()
|
||||
simply adds a label at the designated coordinates in the table.
|
||||
Labels don't get tooltips.
|
||||
|
||||
.nf
|
||||
Usage:
|
||||
void
|
||||
gpc_add_label(
|
||||
char *value, /* text for new label */
|
||||
GtkWidget *table, /* table widget to hold label */
|
||||
int left, /* left table position info */
|
||||
int right, /* right table position info */
|
||||
int top, /* top table position info */
|
||||
int bottom /* bottom table position info */
|
||||
)
|
||||
|
||||
Example:
|
||||
gpc_add_label("Randomization %:", table, 0, 1, 2, 3);
|
||||
.fi
|
||||
|
||||
.SS CALLBACKS:
|
||||
|
||||
.B gpc_close_callback()
|
||||
is used in OK callbacks, and anywhere else
|
||||
you need a callback to destroy widgets.
|
||||
The default cancel callback,
|
||||
.B gpc_cancel_callback()
|
||||
simply closes (destroys) the current panel.
|
||||
The
|
||||
.B gpc_scale_update()
|
||||
and
|
||||
.B gpc_text_update()
|
||||
callbacks update the appropriate widget's data from
|
||||
that widget.
|
||||
|
||||
.DIAGNOSTICS
|
||||
|
||||
No special diagnostics are provided.
|
||||
|
||||
.SH BUGS
|
||||
|
||||
This software should be 100% Bug-Free [tm].
|
||||
|
||||
.SH AUTHOR
|
||||
|
||||
Miles O'Neal
|
||||
.br
|
||||
<meo@rru.com>
|
||||
.br
|
||||
http://www.rru.com/~meo/
|
||||
.br
|
||||
Leander, TX
|
||||
.br
|
||||
Additionally, some of the code may have been distilled from
|
||||
the following plug-ins:
|
||||
.I alienmap
|
||||
(Copyright (C) 1996, 1997 Daniel Cotting)
|
||||
.I plasma
|
||||
(Copyright (C) 1996 Stephen Norris),
|
||||
.I oilify
|
||||
(Copyright (C) 1996 Torsten Martinsen),
|
||||
.I ripple
|
||||
(Copyright (C) 1997 Brian Degenhardt) and
|
||||
.I whirl
|
||||
(Copyright (C) 1997 Federico Mena Quintero).
|
@ -1,181 +0,0 @@
|
||||
/****************************************************************************
|
||||
* This is a convenience library for plugins for the GIMP v 0.99.8 or later.
|
||||
* Documentation is available at http://www.rru.com/~meo/gimp/ .
|
||||
*
|
||||
* Copyright (C) 1997, 1998 Miles O'Neal <meo@rru.com> http://www.rru.com/~meo/
|
||||
* GUI may include GTK code from:
|
||||
* alienmap (Copyright (C) 1996, 1997 Daniel Cotting)
|
||||
* plasma (Copyright (C) 1996 Stephen Norris),
|
||||
* oilify (Copyright (C) 1996 Torsten Martinsen),
|
||||
* ripple (Copyright (C) 1997 Brian Degenhardt) and
|
||||
* whirl (Copyright (C) 1997 Federico Mena Quintero).
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* gpc: GTK Plug-in Convenience library
|
||||
*
|
||||
* history
|
||||
* 1.4 - 30 Apr 1998 MEO
|
||||
* added man page
|
||||
* 1.3 - 29 Apr 1998 MEO
|
||||
* GTK 1.0 port (minor tooltips change)
|
||||
* restored tooltips to action buttons
|
||||
* 1.2 - 11 Feb 1998 MEO
|
||||
* added basic comments
|
||||
* 1.1 - 3 Feb 1998 MEO
|
||||
* removed tooltips from action buttons
|
||||
* 1.0 - 2 Feb 1998 MEO
|
||||
* FCS
|
||||
*
|
||||
* Please send any patches or suggestions to the author: meo@rru.com .
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "libgimp/gimp.h"
|
||||
#include "gtk/gtk.h"
|
||||
|
||||
|
||||
/*
|
||||
* TOGGLE UPDATE callback - toggles the TOGGLE widget's data
|
||||
*/
|
||||
static void
|
||||
gpc_toggle_update(GtkWidget *widget, gpointer data) {
|
||||
int *toggle_val;
|
||||
|
||||
toggle_val = (int *) data;
|
||||
|
||||
if (GTK_TOGGLE_BUTTON(widget)->active)
|
||||
*toggle_val = TRUE;
|
||||
else
|
||||
*toggle_val = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* SCALE UPDATE callback - update the SCALE widget's data
|
||||
*/
|
||||
void
|
||||
gpc_scale_update(GtkAdjustment *adjustment, double *scale_val) {
|
||||
*scale_val = adjustment->value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* TEXT UPDATE callback - update the TEXT widget's data
|
||||
*/
|
||||
void
|
||||
gpc_text_update(GtkWidget *widget, gpointer data) {
|
||||
gint *text_val;
|
||||
|
||||
text_val = (gint *) data;
|
||||
|
||||
*text_val = atoi(gtk_entry_get_text(GTK_ENTRY(widget)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* TOOLTIPS ROUTINES
|
||||
*/
|
||||
static GtkTooltips *tips;
|
||||
|
||||
|
||||
/*
|
||||
* TOOLTIP INITIALIZATION
|
||||
*/
|
||||
void
|
||||
gpc_setup_tooltips(GtkWidget *parent)
|
||||
{
|
||||
static GdkColor tips_fg, tips_bg;
|
||||
|
||||
tips = gtk_tooltips_new();
|
||||
|
||||
/* black as foreground: */
|
||||
|
||||
tips_fg.red = 0;
|
||||
tips_fg.green = 0;
|
||||
tips_fg.blue = 0;
|
||||
gdk_color_alloc(gtk_widget_get_colormap(parent), &tips_fg);
|
||||
|
||||
/* postit yellow (khaki) as background: */
|
||||
|
||||
tips_bg.red = 61669;
|
||||
tips_bg.green = 59113;
|
||||
tips_bg.blue = 35979;
|
||||
gdk_color_alloc(gtk_widget_get_colormap(parent), &tips_bg);
|
||||
|
||||
gtk_tooltips_set_colors(tips, &tips_bg, &tips_fg);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SET TOOLTIP for a widget
|
||||
*/
|
||||
void
|
||||
gpc_set_tooltip(GtkWidget *widget, const char *tip)
|
||||
{
|
||||
if (tip && tip[0])
|
||||
gtk_tooltips_set_tip(tips, widget, (char *) tip, NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ADD RADIO BUTTON to a dialog
|
||||
*/
|
||||
void
|
||||
gpc_add_radio_button(GSList **group, char *label, GtkWidget *box,
|
||||
gint *value, char *tip)
|
||||
{
|
||||
GtkWidget *toggle;
|
||||
|
||||
toggle = gtk_radio_button_new_with_label(*group, label);
|
||||
*group = gtk_radio_button_group(GTK_RADIO_BUTTON(toggle));
|
||||
gtk_box_pack_start(GTK_BOX(box), toggle, FALSE, FALSE, 0);
|
||||
gtk_signal_connect(GTK_OBJECT(toggle), "toggled",
|
||||
(GtkSignalFunc) gpc_toggle_update, value);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), *value);
|
||||
gtk_widget_show(toggle);
|
||||
gtk_widget_show(box);
|
||||
gpc_set_tooltip(toggle, tip);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ADD HORIZONTAL SCALE widget to a dialog at given location
|
||||
*/
|
||||
void
|
||||
gpc_add_hscale(GtkWidget *table, int width, float low, float high,
|
||||
gdouble *val, int left, int right, int top, int bottom, char *tip)
|
||||
{
|
||||
GtkWidget *scale;
|
||||
GtkObject *scale_data;
|
||||
|
||||
scale_data = gtk_adjustment_new(*val, low, high, 1.0, 1.0, 0.0);
|
||||
scale = gtk_hscale_new(GTK_ADJUSTMENT(scale_data));
|
||||
gtk_widget_set_usize(scale, width, 0);
|
||||
gtk_table_attach(GTK_TABLE(table), scale, left, right, top, bottom,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
||||
gtk_scale_set_value_pos(GTK_SCALE(scale), GTK_POS_TOP);
|
||||
gtk_scale_set_digits(GTK_SCALE(scale), 0);
|
||||
gtk_range_set_update_policy(GTK_RANGE(scale), GTK_UPDATE_DELAYED);
|
||||
gtk_signal_connect(GTK_OBJECT(scale_data), "value_changed",
|
||||
(GtkSignalFunc) gpc_scale_update, val);
|
||||
gtk_widget_show(scale);
|
||||
gpc_set_tooltip(scale, tip);
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
/****************************************************************************
|
||||
* This is a convenience library for plugins for the GIMP v 0.99.8 or later.
|
||||
* Documentation is available at http://www.rru.com/~meo/gimp/ .
|
||||
*
|
||||
* Copyright (C) 1997, 1998 Miles O'Neal <meo@rru.com> http://www.rru.com/~meo/
|
||||
* GUI may include GTK code from:
|
||||
* alienmap (Copyright (C) 1996, 1997 Daniel Cotting)
|
||||
* plasma (Copyright (C) 1996 Stephen Norris),
|
||||
* oilify (Copyright (C) 1996 Torsten Martinsen),
|
||||
* ripple (Copyright (C) 1997 Brian Degenhardt) and
|
||||
* whirl (Copyright (C) 1997 Federico Mena Quintero).
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* gpc: GTK Plug-in Convenience library
|
||||
*
|
||||
* history
|
||||
* 1.4 - 30 Apr 1998 MEO
|
||||
* added man page
|
||||
* 1.3 - 29 Apr 1998 MEO
|
||||
* GTK 1.0 port (minor tooltips change)
|
||||
* restored tooltips to action buttons
|
||||
* 1.2 - 11 Feb 1998 MEO
|
||||
* added basic comments
|
||||
* 1.1 - 3 Feb 1998 MEO
|
||||
* removed tooltips from action buttons
|
||||
* 1.0 - 2 Feb 1998 MEO
|
||||
* FCS
|
||||
*
|
||||
* Please send any patches or suggestions to the author: meo@rru.com .
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void
|
||||
gpc_scale_update(GtkAdjustment *adjustment, double *scale_val);
|
||||
|
||||
void
|
||||
gpc_text_update(GtkWidget *widget, gpointer data);
|
||||
|
||||
void
|
||||
gpc_setup_tooltips(GtkWidget *parent);
|
||||
|
||||
void
|
||||
gpc_set_tooltip(GtkWidget *widget, const char *tip);
|
||||
|
||||
void
|
||||
gpc_add_radio_button(GSList **group, char *label, GtkWidget *box,
|
||||
gint *value, char *tip);
|
||||
|
||||
void
|
||||
gpc_add_hscale(GtkWidget *table, int width, float low, float high,
|
||||
gdouble *val, int left, int right, int top, int bottom, char *tip);
|
@ -1,330 +0,0 @@
|
||||
|
||||
|
||||
|
||||
gpc(3) Gimp Plug-ins gpc(3)
|
||||
|
||||
|
||||
NAME
|
||||
GPC - GTK Plug-in Convenience library
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
#include <plug-ins/gpc/gpc.h>
|
||||
|
||||
|
||||
void gpc_setup_tooltips(GtkWidget *parent);
|
||||
|
||||
Initialize tooltips interface, set colors.
|
||||
|
||||
void gpc_set_tooltip(GtkWidget *widget, const char *tip);
|
||||
|
||||
Set tooltip for a widget (if tip is non-null).
|
||||
|
||||
|
||||
void gpc_add_action_button(char *label,
|
||||
GtkSignalFunc callback, GtkWidget *dialog, char *tip);
|
||||
|
||||
Add action button (with tooltip) to a dialog.
|
||||
|
||||
void gpc_add_radio_button(GSList **group, char *label,
|
||||
GtkWidget *box, gint *value, char *tip);
|
||||
|
||||
Add radio button (with tooltip) to a dialog.
|
||||
|
||||
void gpc_add_hscale(GtkWidget *table, int width,
|
||||
float low, float high, gdouble *val,
|
||||
int left, int right, int top, int bottom, char *tip);
|
||||
|
||||
Add horizontal scale widget (with tooltip) to a dialog at
|
||||
given location.
|
||||
|
||||
void gpc_add_label(char *value, GtkWidget *parent,
|
||||
int left, int right, int top, int bottom);
|
||||
|
||||
Add label widget (no tooltip) to a dialog at given loca-
|
||||
tion.
|
||||
|
||||
|
||||
void gpc_close_callback(GtkWidget *widget, gpointer data);
|
||||
|
||||
Destroy callback - quit this plug-in.
|
||||
|
||||
void gpc_cancel_callback(GtkWidget *widget, gpointer data);
|
||||
|
||||
Cancel button callback - go away without saving state,
|
||||
etc.
|
||||
|
||||
void gpc_scale_update(GtkAdjustment *adjustment, double *scale_val);
|
||||
|
||||
Scale update callback - update the SCALE widget's data.
|
||||
|
||||
|
||||
|
||||
|
||||
Roadkills-R-Us 30 Apr 1998 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gpc(3) Gimp Plug-ins gpc(3)
|
||||
|
||||
|
||||
void gpc_text_update(GtkWidget *widget, gpointer data);
|
||||
|
||||
Text update callback - update the TEXT widget's data.
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
This is a set of routines to make life easier on plug-in
|
||||
writers. It helps keep the GUI code short and sweet. (In
|
||||
the plug-in for which it was originally designed, it cut
|
||||
the GUI code in half.) It's somewhat arbitrary in what it
|
||||
includes so far, because I haven't needed everything in
|
||||
GTK. Feel free to contribute more to it.
|
||||
|
||||
|
||||
TOOLTIPS ROUTINES
|
||||
gpc_setup_tooltips() must be called first. This initial-
|
||||
izes internal data structures and sets the tooltip colors.
|
||||
It can be called with any widget high enough in the hier-
|
||||
archy to contain all the widgets needing tooltips. Typi-
|
||||
cally this will be the container widget under the top-
|
||||
level frame:
|
||||
|
||||
Example:
|
||||
frame = gtk_frame_new("Parameter Settings");
|
||||
:
|
||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox),
|
||||
frame, TRUE, TRUE, 0);
|
||||
table = gtk_table_new(4, 2, FALSE);
|
||||
:
|
||||
gtk_widget_show(table);
|
||||
gpc_setup_tooltips(table);
|
||||
|
||||
|
||||
gpc_set_tooltip() may be called directly, but is usually
|
||||
called inside other convenience functions. If called
|
||||
directly, it must still be after the call to
|
||||
gpc_setup_tooltips(). It hides a lot of detail of the GTK
|
||||
tooltips:
|
||||
|
||||
Example:
|
||||
gtk_widget_show(button);
|
||||
gpc_set_tooltip(button, tip);
|
||||
|
||||
|
||||
|
||||
|
||||
USER INTERFACE ROUTINES
|
||||
These routines all hide implementation details to make it
|
||||
easier to lay out a GUI with a consitent, gimp-style
|
||||
interface, while keeping the plug-in code cleaner.
|
||||
|
||||
|
||||
gpc_add_action_button() adds an action button (such as
|
||||
[Cancel] or [OK] to the action button area of a frame.
|
||||
|
||||
|
||||
|
||||
Roadkills-R-Us 30 Apr 1998 2
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gpc(3) Gimp Plug-ins gpc(3)
|
||||
|
||||
|
||||
The callback argument has the standard GTK callback inter-
|
||||
face. A standard callback is provided for [Cancel] but-
|
||||
tons if you wish to use it.
|
||||
|
||||
|
||||
Usage:
|
||||
void
|
||||
gpc_add_action_button(
|
||||
char *label, /* text for action button */
|
||||
GtkSignalFunc callback, /* callback function address */
|
||||
GtkWidget *dialog, /* dialog widget to contain button */
|
||||
char *tip /* tooltip text */
|
||||
)
|
||||
|
||||
Example:
|
||||
static void
|
||||
randomize_ok_callback(GtkWidget *widget, gpointer data) {
|
||||
rndm_int.run = TRUE;
|
||||
gtk_widget_destroy(GTK_WIDGET(data));
|
||||
}
|
||||
:
|
||||
gpc_add_action_button("OK",
|
||||
(GtkSignalFunc) randomize_ok_callback, dlg,
|
||||
"Accept settings and apply filter to image");
|
||||
gpc_add_action_button("Cancel",
|
||||
(GtkSignalFunc) gpc_cancel_callback, dlg,
|
||||
"Close plug-in without making any changes");
|
||||
|
||||
|
||||
gpc_add_radio_button() adds a radio button. If the radio
|
||||
group does not exist, it will be created and passed back
|
||||
in the group argument. A standard callback will be
|
||||
attached to the radio button, requiring a state variable
|
||||
which you provide via the value argument.
|
||||
|
||||
Usage:
|
||||
void
|
||||
gpc_add_radio_button(
|
||||
GSList **group, /* address of radio group */
|
||||
char *label, /* label for new radio button */
|
||||
GtkWidget *box, /* radio box for this radio button */
|
||||
gint *value, /* address of state variable */
|
||||
char *tip /* tooltip text */
|
||||
)
|
||||
|
||||
Example:
|
||||
GSList *type_group = NULL;
|
||||
:
|
||||
gpc_add_label("Randomization Type:", table, 0, 1, 0, 1);
|
||||
|
||||
toggle_hbox = gtk_hbox_new(FALSE, 5);
|
||||
gtk_container_border_width(GTK_CONTAINER(toggle_hbox), 5);
|
||||
gtk_table_attach(GTK_TABLE(table), toggle_hbox, 1, 2, 0, 1,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 5, 0);
|
||||
|
||||
|
||||
|
||||
Roadkills-R-Us 30 Apr 1998 3
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gpc(3) Gimp Plug-ins gpc(3)
|
||||
|
||||
|
||||
gpc_add_radio_button(&type_group,
|
||||
"Hurl", toggle_hbox, &do_hurl,
|
||||
"Hurl random colors onto pixels");
|
||||
gpc_add_radio_button(&type_group,
|
||||
"Pick", toggle_hbox, &do_pick,
|
||||
"Pick at random from neighboring pixels");
|
||||
gpc_add_radio_button(&type_group,
|
||||
"Slur", toggle_hbox, &do_slur,
|
||||
"Simplistic melt");
|
||||
|
||||
|
||||
|
||||
gpc_add_hscale() adds a horizontal scale to a table con-
|
||||
tainer at the designated coordinates. A standard callback
|
||||
will be attached to the scale, requiring a state variable
|
||||
which you provide via the value argument.
|
||||
|
||||
Usage:
|
||||
void
|
||||
gpc_add_hscale(
|
||||
GtkWidget *table, /* table widget to hold scale */
|
||||
int width, /* width (in pixels) of scale */
|
||||
float low, /* low value for scale */
|
||||
float high, /* high value for scale */
|
||||
gdouble *value, /* pointer to current value */
|
||||
int left, /* left table position info */
|
||||
int right, /* right table position info */
|
||||
int top, /* top table position info */
|
||||
int bottom, /* bottom table position info */
|
||||
char *tip /* tooltip text */
|
||||
)
|
||||
|
||||
Example:
|
||||
gpc_add_label("Randomization %:", table, 0, 1, 2, 3);
|
||||
gpc_add_hscale(table, SCALE_WIDTH,
|
||||
1.0, 100.0, &pivals.rndm_pct, 1, 2, 2, 3,
|
||||
"Percentage of pixels to be filtered");
|
||||
|
||||
|
||||
gpc_add_label() simply adds a label at the designated
|
||||
coordinates in the table. Labels don't get tooltips.
|
||||
|
||||
Usage:
|
||||
void
|
||||
gpc_add_label(
|
||||
char *value, /* text for new label */
|
||||
GtkWidget *table, /* table widget to hold label */
|
||||
int left, /* left table position info */
|
||||
int right, /* right table position info */
|
||||
int top, /* top table position info */
|
||||
int bottom /* bottom table position info */
|
||||
)
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
|
||||
Roadkills-R-Us 30 Apr 1998 4
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gpc(3) Gimp Plug-ins gpc(3)
|
||||
|
||||
|
||||
gpc_add_label("Randomization %:", table, 0, 1, 2, 3);
|
||||
|
||||
|
||||
CALLBACKS:
|
||||
gpc_close_callback() is used in OK callbacks, and anywhere
|
||||
else you need a callback to destroy widgets. The default
|
||||
cancel callback, gpc_cancel_callback() simply closes
|
||||
(destroys) the current panel. The gpc_scale_update() and
|
||||
gpc_text_update() callbacks update the appropriate wid-
|
||||
get's data from that widget.
|
||||
|
||||
|
||||
No special diagnostics are provided.
|
||||
|
||||
|
||||
BUGS
|
||||
This software should be 100% Bug-Free [tm].
|
||||
|
||||
|
||||
AUTHOR
|
||||
Miles O'Neal
|
||||
<meo@rru.com>
|
||||
http://www.rru.com/~meo/
|
||||
Leander, TX
|
||||
Additionally, some of the code may have been distilled
|
||||
from the following plug-ins: alienmap (Copyright (C) 1996,
|
||||
1997 Daniel Cotting) plasma (Copyright (C) 1996 Stephen
|
||||
Norris), oilify (Copyright (C) 1996 Torsten Martinsen),
|
||||
ripple (Copyright (C) 1997 Brian Degenhardt) and whirl
|
||||
(Copyright (C) 1997 Federico Mena Quintero).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Roadkills-R-Us 30 Apr 1998 5
|
||||
|
||||
|
Reference in New Issue
Block a user