Commit 401690a4 authored by Manish Singh's avatar Manish Singh

updated randomize and blur plugins, split out libgpc into it's own dir

-Yosh
parent 38d2f7ee
Thu Apr 30 16:38:59 PDT 1998 Manish Singh <yosh@gimp.org>
* updated randomize and blur plugins, split out libgpc into
it's own dir
Thu Apr 30 14:32:16 PDT 1998 Manish Singh <yosh@gimp.org>
* upgraded to libtool 1.2
......
......@@ -14,7 +14,7 @@ DIE=0
(libtool --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have libtool installed to compile GIMP."
echo "Get ftp://alpha.gnu.org/gnu/libtool-1.0h.tar.gz"
echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
......@@ -22,7 +22,7 @@ DIE=0
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have automake installed to compile GIMP."
echo "Get ftp://ftp.cygnus.com/pub/home/tromey/automake-1.2f.tar.gz"
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
......
......@@ -548,6 +548,7 @@ plug-ins/gfig/gfig-examples/Makefile
plug-ins/screenshot/Makefile
plug-ins/sharpen/Makefile
plug-ins/psd/Makefile
plug-ins/gpc/Makefile
app/Makefile
docs/Makefile
data/Makefile
......
......@@ -3,6 +3,7 @@
SUBDIRS = \
libgck \
megawidget \
gpc \
MapObject \
AlienMap \
dbbrowser \
......
......@@ -5,7 +5,7 @@ pluginlibdir = $(gimpplugindir)/plug-ins
pluginlib_PROGRAMS = blur
blur_SOURCES = \
blur.c
blur.c $(top_srcdir)/plug-ins/gpc/gpc.h
INCLUDES = \
$(X_CFLAGS) \
......@@ -13,14 +13,15 @@ INCLUDES = \
-I$(includedir)
LDADD = \
$(top_builddir)/plug-ins/gpc/libgpc.a \
$(top_builddir)/libgimp/libgimpui.la \
$(top_builddir)/libgimp/libgimp.la \
$(X_LIBS) \
\
-lc
DEPS = \
$(top_builddir)/libgimp/libgimpui.la \
$(top_builddir)/plug-ins/gpc/libgpc.a \
$(top_builddir)/libgimp/libgimp.la
blur_DEPENDENCIES = $(DEPS)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Makefile.in
Makefile
.deps
_libs
.libs
gpc
## Process this file with automake to produce Makefile.in
pluginlibdir = $(gimpplugindir)/plug-ins
pluginlib_LIBRARIES = libgpc.a
libgpc_a_SOURCES = \
gpc.c gpc.h
INCLUDES = \
$(X_CFLAGS) \
-I$(top_srcdir) \
-I$(includedir)
LDADD = \
$(top_builddir)/libgimp/libgimpui.la \
$(top_builddir)/libgimp/libgimp.la \
$(X_LIBS) \
-lc
DEPS = \
$(top_builddir)/libgimp/libgimpui.la \
$(top_builddir)/libgimp/libgimp.la
libgpc_aDEPENDENCIES = $(DEPS)
man_MANS=gpc.3
.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
.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).
......@@ -2,9 +2,8 @@
* 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 Miles O'Neal <meo@rru.com> http://www.rru.com/~meo/
* Blur code Copyright (C) 1995 Spencer Kimball and Peter Mattis
* GUI based on GTK code from:
* 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),
......@@ -28,10 +27,16 @@
****************************************************************************/
/****************************************************************************
* gpc:
* gpc: GTK Plug-in Convenience library
*
* gpc version 1.1 (3 Feb 1998, MEO)
* 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
......@@ -48,7 +53,7 @@
/*
* TOGGLE UPDATE callback
* TOGGLE UPDATE callback - toggles the TOGGLE widget's data
*/
static void
gpc_toggle_update(GtkWidget *widget, gpointer data) {
......@@ -62,7 +67,7 @@ gpc_toggle_update(GtkWidget *widget, gpointer data) {
*toggle_val = FALSE;
}
/*
* DESTROY callback
* DESTROY callback - quit this plug-in
*/
void
gpc_close_callback(GtkWidget *widget, gpointer data) {
......@@ -70,7 +75,7 @@ gpc_close_callback(GtkWidget *widget, gpointer data) {
}
/*
* CANCEL BUTTON callback
* CANCEL BUTTON callback - go away without saving state, etc.
*/
void
gpc_cancel_callback(GtkWidget *widget, gpointer data) {
......@@ -78,7 +83,7 @@ gpc_cancel_callback(GtkWidget *widget, gpointer data) {
}
/*
* SCALE UPDATE callback
* SCALE UPDATE callback - update the SCALE widget's data
*/
void
gpc_scale_update(GtkAdjustment *adjustment, double *scale_val) {
......@@ -87,7 +92,7 @@ gpc_scale_update(GtkAdjustment *adjustment, double *scale_val) {
/*
* TEXT UPDATE callback
* TEXT UPDATE callback - update the TEXT widget's data
*/
void
gpc_text_update(GtkWidget *widget, gpointer data) {
......@@ -106,6 +111,9 @@ gpc_text_update(GtkWidget *widget, gpointer data) {
static GtkTooltips *tips;
/*
* TOOLTIP INITIALIZATION
*/
void
gpc_setup_tooltips(GtkWidget *parent)
{
......@@ -131,16 +139,23 @@ gpc_setup_tooltips(GtkWidget *parent)
}
/*
* 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);
gtk_tooltips_set_tip(tips, widget, (char *) tip, NULL);
}
/*
* ADD ACTION BUTTON to a dialog
*/
void
gpc_add_action_button(char *label, GtkSignalFunc callback, GtkWidget *dialog
/* , char *tip */ )
gpc_add_action_button(char *label, GtkSignalFunc callback, GtkWidget *dialog,
char *tip)
{
GtkWidget *button;
......@@ -151,9 +166,13 @@ gpc_add_action_button(char *label, GtkSignalFunc callback, GtkWidget *dialog
button, TRUE, TRUE, 0);
gtk_widget_grab_default(button);
gtk_widget_show(button);
/* gpc_set_tooltip(button, tip); */
gpc_set_tooltip(button, tip);
}
/*
* ADD RADIO BUTTON to a dialog
*/
void
gpc_add_radio_button(GSList **group, char *label, GtkWidget *box,
gint *value, char *tip)
......@@ -171,6 +190,10 @@ gpc_add_radio_button(GSList **group, char *label, GtkWidget *box,
gpc_set_tooltip(toggle, tip);
}
/*
* ADD LABEL widget to a dialog at given location
*/
void
gpc_add_label(char *value, GtkWidget *table, int left, int right,
int top, int bottom)
......@@ -184,6 +207,10 @@ gpc_add_label(char *value, GtkWidget *table, int left, int right,
gtk_widget_show(label);
}
/*
* 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)
......
......@@ -2,9 +2,8 @@
* 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 Miles O'Neal <meo@rru.com> http://www.rru.com/~meo/
* Blur code Copyright (C) 1995 Spencer Kimball and Peter Mattis
* GUI based on GTK code from:
* 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),
......@@ -28,10 +27,16 @@
****************************************************************************/
/****************************************************************************
* gpc:
* gpc: GTK Plug-in Convenience library
*
* gpc version 1.1 (3 Feb 1998, MEO)
* 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
......@@ -60,8 +65,8 @@ void
gpc_set_tooltip(GtkWidget *widget, const char *tip);
void
gpc_add_action_button(char *label, GtkSignalFunc callback, GtkWidget *dialog
/* , char *tip */ );
gpc_add_action_button(char *label, GtkSignalFunc callback, GtkWidget *dialog,
char *tip);
void
gpc_add_radio_button(GSList **group, char *label, GtkWidget *box,
......
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