From 6ef23d984ffcb5e2b003ecae446db65e633ae5ce Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 1 Sep 1999 20:30:56 +0000 Subject: [PATCH] app/appenv.h New file. Includes . Move G_PI, RINT(), ROUND() etc 1999-09-01 Tor Lillqvist * app/appenv.h * libgimp/gimpmath.h: New file. Includes . Move G_PI, RINT(), ROUND() etc from app/appenv.h here, so plug-ins can use them, too. Remove some commented-out old stuff in appenv.h. * libgimp/gimp.h: Include gimpmath.h. * libgimp/gimp.c (gimp_main): Win32: Don't install signal handlers, we can't do anything useful in the handler ourselves anyway (it would be nice to print out a backtrace, but that seems pretty hard to do, even if not impossible). Let Windows inform the user about the crash. If the plug-in was compiled with MSVC, and the user also has it, she is offered a chance to start the debugger automatically anyway. * app/*several*.c: Include gimpmath.h for G_PI etc. Don't include , as gimpmath.h includes it. * plug-ins/*/*many*.c: Include config.h. Don't include . Remove all the duplicated definitions of G_PI and rint(). Use RINT() instead of rint(). * app/app_procs.[ch]: app_exit() takes a gboolean. * app/batch.c * app/commands.c * app/interface.c: Call app_exit() with FALSE or TRUE. * app/main.c (on_error): Call gimp_fatal_error. (main): Don't install any signal handler on Win32 here, either. * app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format the message and call MessageBox with it. g_on_error_query doesn't do anything useful on Win32, and printf'ing a message to stdout or stderr doesn't do anything, either, in a windowing application. --- ChangeLog | 39 ++++++ app/actions/help-commands.c | 2 +- app/app_procs.c | 4 +- app/app_procs.h | 2 +- app/appenv.h | 45 ------- app/base/color-balance.c | 5 +- app/base/curves.c | 5 +- app/batch.c | 2 +- app/bezier_select.c | 3 +- app/blend.c | 4 +- app/channel.c | 5 +- app/color_balance.c | 5 +- app/commands.c | 2 +- app/convert.c | 3 +- app/core/gimpbrushgenerated-load.c | 4 +- app/core/gimpbrushgenerated-save.c | 4 +- app/core/gimpbrushgenerated.c | 4 +- app/core/gimpbrushpipe-load.c | 3 +- app/core/gimpbrushpipe.c | 3 +- app/core/gimpchannel-combine.c | 5 +- app/core/gimpchannel.c | 5 +- app/core/gimpdrawable-blend.c | 4 +- app/core/gimpimage-convert.c | 3 +- app/core/gimpprojection.c | 4 + app/curves.c | 5 +- app/display/gimpdisplay.c | 4 + app/display/gimpdisplayshell-draw.c | 2 +- app/display/gimpdisplayshell.c | 2 +- app/dodgeburn.c | 5 +- app/errors.c | 38 ++++-- app/fileops.c | 1 + app/gdisplay.c | 4 + app/gimpbrushgenerated.c | 4 +- app/gimpbrushpipe.c | 3 +- app/gimpchannel.c | 5 +- app/gimpimage-convert.c | 3 +- app/gui/commands.c | 2 +- app/gui/help-commands.c | 2 +- app/gui/paths-dialog.c | 3 +- app/ink.c | 5 +- app/interface.c | 2 +- app/iscissors.c | 4 +- app/main.c | 19 ++- app/measure.c | 4 +- app/paint-funcs/paint-funcs.c | 2 +- app/paint/gimpdodgeburn.c | 5 +- app/paint/gimpink.c | 5 +- app/paint/gimpsmudge.c | 6 +- app/paint_core.c | 5 +- app/paint_funcs.c | 2 +- app/paths_dialog.c | 3 +- app/rotate_tool.c | 4 +- app/smudge.c | 6 +- app/tools/bezier_select.c | 3 +- app/tools/blend.c | 4 +- app/tools/color_balance.c | 5 +- app/tools/curves.c | 5 +- app/tools/dodgeburn.c | 5 +- app/tools/gimpblendtool.c | 4 +- app/tools/gimpcolorbalancetool.c | 5 +- app/tools/gimpcurvestool.c | 5 +- app/tools/gimpdodgeburntool.c | 5 +- app/tools/gimpinktool.c | 5 +- app/tools/gimpiscissorstool.c | 4 +- app/tools/gimpmeasuretool.c | 4 +- app/tools/gimprotatetool.c | 4 +- app/tools/gimpsmudgetool.c | 6 +- app/tools/ink.c | 5 +- app/tools/iscissors.c | 4 +- app/tools/measure.c | 4 +- app/tools/paint_core.c | 5 +- app/tools/rotate_tool.c | 4 +- app/tools/smudge.c | 6 +- app/tools/transform_core.c | 4 +- app/transform_core.c | 4 +- libgimp/gimp.c | 11 ++ libgimp/gimp.h | 1 + plug-ins/common/CML_explorer.c | 17 ++- plug-ins/common/apply_lens.c | 16 +-- plug-ins/common/blinds.c | 10 +- plug-ins/common/bumpmap.c | 11 +- plug-ins/common/cubism.c | 13 +- plug-ins/common/diffraction.c | 13 +- plug-ins/common/emboss.c | 15 +-- plug-ins/common/film.c | 4 +- plug-ins/common/gauss_iir.c | 10 +- plug-ins/common/gee.c | 11 +- plug-ins/common/iwarp.c | 9 +- plug-ins/common/lic.c | 8 +- plug-ins/common/mblur.c | 11 +- plug-ins/common/mosaic.c | 12 +- plug-ins/common/newsprint.c | 21 +--- plug-ins/common/nova.c | 9 +- plug-ins/common/polar.c | 60 +++++----- plug-ins/common/psd.c | 9 +- plug-ins/common/ripple.c | 11 +- plug-ins/common/sparkle.c | 11 +- plug-ins/common/spheredesigner.c | 4 - plug-ins/common/spread.c | 9 +- plug-ins/common/waves.c | 13 +- plug-ins/common/whirlpinch.c | 19 +-- plug-ins/flame/libifs.c | 33 +++-- plug-ins/gfig/gfig.c | 146 ++++++++++------------- plug-ins/gimpressionist/gimpressionist.h | 10 +- plug-ins/gimpressionist/orientmap.c | 16 +-- plug-ins/gimpressionist/ppmtool.c | 2 +- plug-ins/ifscompose/ifscompose.c | 12 +- plug-ins/makefile.cygwin | 10 +- plug-ins/makefile.msc | 10 +- plug-ins/mosaic/mosaic.c | 12 +- plug-ins/pagecurl/pagecurl.c | 12 +- plug-ins/sel2path/math.c | 8 +- plug-ins/sel2path/sel2path.c | 20 ++-- plug-ins/sinus/sinus.c | 38 +++--- po/makefile.msc | 2 +- 115 files changed, 556 insertions(+), 533 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78a4cc257f..85e3f62a34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +1999-09-01 Tor Lillqvist + + * app/appenv.h + * libgimp/gimpmath.h: New file. Includes . Move G_PI, + RINT(), ROUND() etc from app/appenv.h here, so plug-ins can + use them, too. Remove some commented-out old stuff in appenv.h. + + * libgimp/gimp.h: Include gimpmath.h. + + * libgimp/gimp.c (gimp_main): Win32: Don't install signal + handlers, we can't do anything useful in the handler ourselves + anyway (it would be nice to print out a backtrace, but that seems + pretty hard to do, even if not impossible). Let Windows inform the + user about the crash. If the plug-in was compiled with MSVC, and + the user also has it, she is offered a chance to start the + debugger automatically anyway. + + * app/*several*.c: Include gimpmath.h for G_PI etc. Don't include + , as gimpmath.h includes it. + + * plug-ins/*/*many*.c: Include config.h. Don't include . + Remove all the duplicated definitions of G_PI and rint(). Use + RINT() instead of rint(). + + * app/app_procs.[ch]: app_exit() takes a gboolean. + + * app/batch.c + * app/commands.c + * app/interface.c: Call app_exit() with FALSE or TRUE. + + * app/main.c (on_error): Call gimp_fatal_error. (main): Don't + install any signal handler on Win32 here, either. + + * app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format + the message and call MessageBox with it. g_on_error_query doesn't + do anything useful on Win32, and printf'ing a message to stdout or + stderr doesn't do anything, either, in a windowing application. + Wed Sep 1 22:16:41 MEST 1999 Sven Neumann * app/paint_core.c: Only set the defaults for non_gui operations @@ -18,6 +56,7 @@ Wed Sep 1 20:45:56 MEST 1999 Sven Neumann when drawing a line using . Do we need the angle here too?? Wed Sep 1 14:12:17 CEST 1999 Pablo Saratxaga + * po/da.po, configure.in: added danish file from Henrik Hansen diff --git a/app/actions/help-commands.c b/app/actions/help-commands.c index 9ce2ad2f44..594761254e 100644 --- a/app/actions/help-commands.c +++ b/app/actions/help-commands.c @@ -130,7 +130,7 @@ void file_quit_cmd_callback (GtkWidget *widget, gpointer client_data) { - app_exit (0); + app_exit (FALSE); } void diff --git a/app/app_procs.c b/app/app_procs.c index c5b3afbbda..da1cd20144 100644 --- a/app/app_procs.c +++ b/app/app_procs.c @@ -677,10 +677,10 @@ app_exit_finish (void) } void -app_exit (int kill_it) +app_exit (gboolean kill_it) { /* If it's the user's perogative, and there are dirty images */ - if (kill_it == FALSE && gdisplays_dirty () && no_interface == FALSE) + if (!kill_it && gdisplays_dirty () && no_interface == FALSE) really_quit_dialog (); else app_exit_finish (); diff --git a/app/app_procs.h b/app/app_procs.h index 379a5060ad..4bafe670e3 100644 --- a/app/app_procs.h +++ b/app/app_procs.h @@ -21,7 +21,7 @@ /* Function declarations */ void gimp_init (int, char **); void app_init (void); -void app_exit (int); +void app_exit (gboolean); void app_exit_finish (void); int app_exit_finish_done (void); void app_init_update_status(char *label1val, char *label2val, float pct_progress); diff --git a/app/appenv.h b/app/appenv.h index b13b6ee902..e4fa484fc0 100644 --- a/app/appenv.h +++ b/app/appenv.h @@ -20,60 +20,15 @@ #include "glib.h" -/* The GIMP shouldn't need to know much about X11 (or Windows), so - * I'll remove this inclusion of gdkx.h. This will speed up compilations - * a bit, too. If some source file needs gdkx.h, it can include it. - */ -#if 0 -#include "gdk/gdkx.h" -#endif - #include "gtk/gtk.h" #include "gimpsetF.h" #include "colormap_dialog.t.h" -/* Without gdkx.h no GDK_DISPLAY() */ -#if 0 -#define DISPLAY ((Display *) GDK_DISPLAY()) -#endif - /* important macros - we reuse the ones from glib */ #define BOUNDS(a,x,y) CLAMP(a,x,y) #define MINIMUM(x,y) MIN(x,y) #define MAXIMUM(x,y) MAX(x,y) -#ifndef G_PI /* G_PI will be in GLib eventually */ -#define G_PI 3.14159265358979323846 -#endif -#ifndef G_PI_2 /* As will G_PI_2 */ -#define G_PI_2 1.57079632679489661923 -#endif -#ifndef G_PI_4 /* As will G_PI_4 */ -#define G_PI_4 0.78539816339744830962 -#endif -#ifndef G_SQRT2 /* As will G_SQRT2 */ -#define G_SQRT2 1.4142135623730951 -#endif - -#ifdef HAVE_RINT -#define RINT(x) rint(x) -#else -#define RINT(x) floor ((x) + 0.5) -#endif - -#define ROUND(x) ((int) ((x) + 0.5)) - -/* Square */ -#define SQR(x) ((x) * (x)) - -/* limit a (0->511) int to 255 */ -#define MAX255(a) ((a) | (((a) & 256) - (((a) & 256) >> 8))) - -/* clamp a >>int32<<-range int between 0 and 255 inclusive */ -/* broken! -> #define CLAMP0255(a) ((a & 0xFFFFFF00)? (~(a>>31)) : a) */ -#define CLAMP0255(a) CLAMP(a,0,255) - - typedef enum { MESSAGE_BOX, CONSOLE, diff --git a/app/base/color-balance.c b/app/base/color-balance.c index 03d926c05d..6e66f75f05 100644 --- a/app/base/color-balance.c +++ b/app/base/color-balance.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include -#include + #include "appenv.h" #include "actionarea.h" #include "color_balance.h" @@ -30,6 +32,7 @@ #include "interface.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #define TEXT_WIDTH 55 diff --git a/app/base/curves.c b/app/base/curves.c index 75b98e6796..e1372e1ffc 100644 --- a/app/base/curves.c +++ b/app/base/curves.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include -#include + #include "appenv.h" #include "actionarea.h" #include "buildmenu.h" @@ -32,6 +34,7 @@ #include "gimplut.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #define GRAPH 0x1 #define XRANGE_TOP 0x2 diff --git a/app/batch.c b/app/batch.c index 9f6929e2c6..fd3a61174a 100644 --- a/app/batch.c +++ b/app/batch.c @@ -96,7 +96,7 @@ batch_run_cmd (char *cmd) if (g_strcasecmp (cmd, "(gimp-quit 0)") == 0) { - app_exit (0); + app_exit (FALSE); exit (0); } diff --git a/app/bezier_select.c b/app/bezier_select.c index f5b1a2a414..ba339c1ca6 100644 --- a/app/bezier_select.c +++ b/app/bezier_select.c @@ -18,7 +18,7 @@ #include "config.h" #include -#include + #include "appenv.h" #include "cursorutil.h" #include "draw_core.h" @@ -34,6 +34,7 @@ #include "selection_options.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* Bezier extensions made by Raphael FRANCOIS (fraph@ibm.net) diff --git a/app/blend.c b/app/blend.c index 2808eb4201..183d4a41da 100644 --- a/app/blend.c +++ b/app/blend.c @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include "appenv.h" #include "asupsample.h" #include "blend.h" @@ -39,6 +40,7 @@ #include "tile.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* target size */ diff --git a/app/channel.c b/app/channel.c index f534c4743e..52fabbf3e0 100644 --- a/app/channel.c +++ b/app/channel.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include -#include + #include "appenv.h" #include "channel.h" #include "drawable.h" @@ -32,6 +34,7 @@ #include "gimppreviewcache.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #include "channel_pvt.h" #include "tile.h" diff --git a/app/color_balance.c b/app/color_balance.c index 03d926c05d..6e66f75f05 100644 --- a/app/color_balance.c +++ b/app/color_balance.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include -#include + #include "appenv.h" #include "actionarea.h" #include "color_balance.h" @@ -30,6 +32,7 @@ #include "interface.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #define TEXT_WIDTH 55 diff --git a/app/commands.c b/app/commands.c index 9ce2ad2f44..594761254e 100644 --- a/app/commands.c +++ b/app/commands.c @@ -130,7 +130,7 @@ void file_quit_cmd_callback (GtkWidget *widget, gpointer client_data) { - app_exit (0); + app_exit (FALSE); } void diff --git a/app/convert.c b/app/convert.c index 0b2ad816fd..53a36db77e 100644 --- a/app/convert.c +++ b/app/convert.c @@ -78,10 +78,10 @@ * [Adam D. Moss - adam@gimp.org] */ +#include "config.h" #include #include -#include #include "appenv.h" #include "actionarea.h" @@ -97,6 +97,7 @@ #include "preferences_dialog.h" /* ick. */ #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #include "layer_pvt.h" /* ick. */ #include "drawable_pvt.h" /* ick ick. */ diff --git a/app/core/gimpbrushgenerated-load.c b/app/core/gimpbrushgenerated-load.c index 420b316446..6168989398 100644 --- a/app/core/gimpbrushgenerated-load.c +++ b/app/core/gimpbrushgenerated-load.c @@ -17,10 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - #include "config.h" -#include #include #include @@ -30,6 +28,8 @@ #include "gimprc.h" #include "gimpbrush.h" +#include "libgimp/gimpmath.h" + #define OVERSAMPLING 5 static void diff --git a/app/core/gimpbrushgenerated-save.c b/app/core/gimpbrushgenerated-save.c index 420b316446..6168989398 100644 --- a/app/core/gimpbrushgenerated-save.c +++ b/app/core/gimpbrushgenerated-save.c @@ -17,10 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - #include "config.h" -#include #include #include @@ -30,6 +28,8 @@ #include "gimprc.h" #include "gimpbrush.h" +#include "libgimp/gimpmath.h" + #define OVERSAMPLING 5 static void diff --git a/app/core/gimpbrushgenerated.c b/app/core/gimpbrushgenerated.c index 420b316446..6168989398 100644 --- a/app/core/gimpbrushgenerated.c +++ b/app/core/gimpbrushgenerated.c @@ -17,10 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - #include "config.h" -#include #include #include @@ -30,6 +28,8 @@ #include "gimprc.h" #include "gimpbrush.h" +#include "libgimp/gimpmath.h" + #define OVERSAMPLING 5 static void diff --git a/app/core/gimpbrushpipe-load.c b/app/core/gimpbrushpipe-load.c index 8e6310788b..ccda27459c 100644 --- a/app/core/gimpbrushpipe-load.c +++ b/app/core/gimpbrushpipe-load.c @@ -19,7 +19,6 @@ #include "config.h" -#include #include #include #include @@ -35,7 +34,9 @@ #include "gimpbrushpipeP.h" #include "paint_core.h" #include "gimprc.h" + #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* Code duplicated from plug-ins/common/gpb.c... * The struct, and code to parse/build it probably should be in libgimp. diff --git a/app/core/gimpbrushpipe.c b/app/core/gimpbrushpipe.c index 8e6310788b..ccda27459c 100644 --- a/app/core/gimpbrushpipe.c +++ b/app/core/gimpbrushpipe.c @@ -19,7 +19,6 @@ #include "config.h" -#include #include #include #include @@ -35,7 +34,9 @@ #include "gimpbrushpipeP.h" #include "paint_core.h" #include "gimprc.h" + #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* Code duplicated from plug-ins/common/gpb.c... * The struct, and code to parse/build it probably should be in libgimp. diff --git a/app/core/gimpchannel-combine.c b/app/core/gimpchannel-combine.c index f534c4743e..52fabbf3e0 100644 --- a/app/core/gimpchannel-combine.c +++ b/app/core/gimpchannel-combine.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include -#include + #include "appenv.h" #include "channel.h" #include "drawable.h" @@ -32,6 +34,7 @@ #include "gimppreviewcache.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #include "channel_pvt.h" #include "tile.h" diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c index f534c4743e..52fabbf3e0 100644 --- a/app/core/gimpchannel.c +++ b/app/core/gimpchannel.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include -#include + #include "appenv.h" #include "channel.h" #include "drawable.h" @@ -32,6 +34,7 @@ #include "gimppreviewcache.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #include "channel_pvt.h" #include "tile.h" diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c index 2808eb4201..183d4a41da 100644 --- a/app/core/gimpdrawable-blend.c +++ b/app/core/gimpdrawable-blend.c @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include "appenv.h" #include "asupsample.h" #include "blend.h" @@ -39,6 +40,7 @@ #include "tile.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* target size */ diff --git a/app/core/gimpimage-convert.c b/app/core/gimpimage-convert.c index 0b2ad816fd..53a36db77e 100644 --- a/app/core/gimpimage-convert.c +++ b/app/core/gimpimage-convert.c @@ -78,10 +78,10 @@ * [Adam D. Moss - adam@gimp.org] */ +#include "config.h" #include #include -#include #include "appenv.h" #include "actionarea.h" @@ -97,6 +97,7 @@ #include "preferences_dialog.h" /* ick. */ #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #include "layer_pvt.h" /* ick. */ #include "drawable_pvt.h" /* ick ick. */ diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index c38d7471d9..ccedb69160 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -15,8 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include + #include "appenv.h" #include "colormaps.h" #include "cursorutil.h" @@ -48,6 +51,7 @@ #include "layer_pvt.h" /* ick. (not alone either) */ #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #define OVERHEAD 25 /* in units of pixel area */ diff --git a/app/curves.c b/app/curves.c index 75b98e6796..e1372e1ffc 100644 --- a/app/curves.c +++ b/app/curves.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include -#include + #include "appenv.h" #include "actionarea.h" #include "buildmenu.h" @@ -32,6 +34,7 @@ #include "gimplut.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #define GRAPH 0x1 #define XRANGE_TOP 0x2 diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index c38d7471d9..ccedb69160 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -15,8 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include + #include "appenv.h" #include "colormaps.h" #include "cursorutil.h" @@ -48,6 +51,7 @@ #include "layer_pvt.h" /* ick. (not alone either) */ #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #define OVERHEAD 25 /* in units of pixel area */ diff --git a/app/display/gimpdisplayshell-draw.c b/app/display/gimpdisplayshell-draw.c index 4fcb9edc24..922a3c3c17 100644 --- a/app/display/gimpdisplayshell-draw.c +++ b/app/display/gimpdisplayshell-draw.c @@ -170,7 +170,7 @@ toolbox_delete (GtkWidget *widget, GdkEvent *event, gpointer data) { - app_exit (0); + app_exit (FALSE); return TRUE; } diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c index 4fcb9edc24..922a3c3c17 100644 --- a/app/display/gimpdisplayshell.c +++ b/app/display/gimpdisplayshell.c @@ -170,7 +170,7 @@ toolbox_delete (GtkWidget *widget, GdkEvent *event, gpointer data) { - app_exit (0); + app_exit (FALSE); return TRUE; } diff --git a/app/dodgeburn.c b/app/dodgeburn.c index ba07025c78..a42498347a 100644 --- a/app/dodgeburn.c +++ b/app/dodgeburn.c @@ -16,10 +16,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" + #include #include -#include + #include "gdk/gdkkeysyms.h" + #include "appenv.h" #include "drawable.h" #include "errors.h" @@ -35,6 +37,7 @@ #include "gimage.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* the dodgeburn structures */ diff --git a/app/errors.c b/app/errors.c index 3ac9ee3712..612abcc926 100644 --- a/app/errors.c +++ b/app/errors.c @@ -41,6 +41,10 @@ #include "errors.h" #include "libgimp/gimpintl.h" +#ifdef NATIVE_WIN32 +#include +#endif + extern gchar *prog_name; void @@ -68,28 +72,33 @@ gimp_message_func (gchar *str) void gimp_fatal_error (gchar *fmt, ...) { +#ifndef NATIVE_WIN32 va_list args; va_start (args, fmt); -#ifndef NATIVE_WIN32 printf (_("%s: fatal error: %s\n"), prog_name, g_strdup_vprintf (fmt, args)); -#else - g_error (_("%s: fatal error: %s\n"), prog_name, g_strdup_vprintf (fmt, args)); -#endif va_end (args); - -#ifndef NATIVE_WIN32 g_on_error_query (prog_name); #else - /* g_on_error_query unreliable on Win32 */ - abort (); + /* g_on_error_query doesn't do anything reasonable on Win32. */ + va_list args; + gchar *msg; + + va_start (args, fmt); + msg = g_strdup_vprintf (fmt, args); + va_end (args); + + MessageBox (NULL, msg, prog_name, MB_OK|MB_ICONERROR); + /* I don't dare do anything more. */ + ExitProcess (1); #endif - app_exit (1); + app_exit (TRUE); } void gimp_terminate (gchar *fmt, ...) { +#ifndef NATIVE_WIN32 va_list args; va_start (args, fmt); @@ -98,9 +107,18 @@ gimp_terminate (gchar *fmt, ...) printf ("\n"); va_end (args); -#ifndef NATIVE_WIN32 if (use_debug_handler) g_on_error_query (prog_name); +#else + /* g_on_error_query doesn't do anything reasonable on Win32. */ + va_list args; + gchar *msg; + + va_start (args, fmt); + msg = g_strdup_vprintf (fmt, args); + va_end (args); + + MessageBox (NULL, msg, prog_name, MB_OK|MB_ICONERROR); #endif gdk_exit (1); } diff --git a/app/fileops.c b/app/fileops.c index fdaaaa334c..c0b43b01d7 100644 --- a/app/fileops.c +++ b/app/fileops.c @@ -58,6 +58,7 @@ #include "undo.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" typedef struct _OverwriteBox OverwriteBox; diff --git a/app/gdisplay.c b/app/gdisplay.c index c38d7471d9..ccedb69160 100644 --- a/app/gdisplay.c +++ b/app/gdisplay.c @@ -15,8 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include + #include "appenv.h" #include "colormaps.h" #include "cursorutil.h" @@ -48,6 +51,7 @@ #include "layer_pvt.h" /* ick. (not alone either) */ #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #define OVERHEAD 25 /* in units of pixel area */ diff --git a/app/gimpbrushgenerated.c b/app/gimpbrushgenerated.c index 420b316446..6168989398 100644 --- a/app/gimpbrushgenerated.c +++ b/app/gimpbrushgenerated.c @@ -17,10 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - #include "config.h" -#include #include #include @@ -30,6 +28,8 @@ #include "gimprc.h" #include "gimpbrush.h" +#include "libgimp/gimpmath.h" + #define OVERSAMPLING 5 static void diff --git a/app/gimpbrushpipe.c b/app/gimpbrushpipe.c index 8e6310788b..ccda27459c 100644 --- a/app/gimpbrushpipe.c +++ b/app/gimpbrushpipe.c @@ -19,7 +19,6 @@ #include "config.h" -#include #include #include #include @@ -35,7 +34,9 @@ #include "gimpbrushpipeP.h" #include "paint_core.h" #include "gimprc.h" + #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* Code duplicated from plug-ins/common/gpb.c... * The struct, and code to parse/build it probably should be in libgimp. diff --git a/app/gimpchannel.c b/app/gimpchannel.c index f534c4743e..52fabbf3e0 100644 --- a/app/gimpchannel.c +++ b/app/gimpchannel.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include -#include + #include "appenv.h" #include "channel.h" #include "drawable.h" @@ -32,6 +34,7 @@ #include "gimppreviewcache.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #include "channel_pvt.h" #include "tile.h" diff --git a/app/gimpimage-convert.c b/app/gimpimage-convert.c index 0b2ad816fd..53a36db77e 100644 --- a/app/gimpimage-convert.c +++ b/app/gimpimage-convert.c @@ -78,10 +78,10 @@ * [Adam D. Moss - adam@gimp.org] */ +#include "config.h" #include #include -#include #include "appenv.h" #include "actionarea.h" @@ -97,6 +97,7 @@ #include "preferences_dialog.h" /* ick. */ #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #include "layer_pvt.h" /* ick. */ #include "drawable_pvt.h" /* ick ick. */ diff --git a/app/gui/commands.c b/app/gui/commands.c index 9ce2ad2f44..594761254e 100644 --- a/app/gui/commands.c +++ b/app/gui/commands.c @@ -130,7 +130,7 @@ void file_quit_cmd_callback (GtkWidget *widget, gpointer client_data) { - app_exit (0); + app_exit (FALSE); } void diff --git a/app/gui/help-commands.c b/app/gui/help-commands.c index 9ce2ad2f44..594761254e 100644 --- a/app/gui/help-commands.c +++ b/app/gui/help-commands.c @@ -130,7 +130,7 @@ void file_quit_cmd_callback (GtkWidget *widget, gpointer client_data) { - app_exit (0); + app_exit (FALSE); } void diff --git a/app/gui/paths-dialog.c b/app/gui/paths-dialog.c index 11834eacdf..577886b533 100644 --- a/app/gui/paths-dialog.c +++ b/app/gui/paths-dialog.c @@ -22,9 +22,9 @@ #include #include #include -#include #include "gdk/gdkkeysyms.h" + #include "appenv.h" #include "draw_core.h" #include "actionarea.h" @@ -57,6 +57,7 @@ #include "drawable_pvt.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #include "pixmaps/new.xpm" #include "pixmaps/duplicate.xpm" diff --git a/app/ink.c b/app/ink.c index b9cd6a8774..d8ae4c9459 100644 --- a/app/ink.c +++ b/app/ink.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include #include + #include "appenv.h" #include "drawable.h" #include "draw_core.h" @@ -32,6 +34,7 @@ #include "gdisplay.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #include "tile.h" /* ick. */ diff --git a/app/interface.c b/app/interface.c index 4fcb9edc24..922a3c3c17 100644 --- a/app/interface.c +++ b/app/interface.c @@ -170,7 +170,7 @@ toolbox_delete (GtkWidget *widget, GdkEvent *event, gpointer data) { - app_exit (0); + app_exit (FALSE); return TRUE; } diff --git a/app/iscissors.c b/app/iscissors.c index c0c1e564d2..92f88d77a2 100644 --- a/app/iscissors.c +++ b/app/iscissors.c @@ -30,7 +30,8 @@ * The 0.54 version of the algorithm was then forwards ported to 1.1.4 * by Austin Donnelly. */ -#include +#include "config.h" + #include #include #include @@ -53,6 +54,7 @@ #include "bezier_selectP.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* local structures */ diff --git a/app/main.c b/app/main.c index ef5573b1de..50fd99de4b 100644 --- a/app/main.c +++ b/app/main.c @@ -46,10 +46,12 @@ #include "libgimp/gimpintl.h" +#ifndef NATIVE_WIN32 static RETSIGTYPE on_signal (int); #ifdef SIGCHLD static RETSIGTYPE on_sig_child (int); #endif +#endif static void init (void); static void test_gserialize(); static void on_error (const gchar* domain, @@ -314,6 +316,14 @@ main (int argc, char **argv) g_set_message_handler ((GPrintFunc) gimp_message_func); +#ifndef NATIVE_WIN32 + /* No use catching these on Win32, the user won't get any + * stack trace from glib anyhow. It's better to let Windows inform + * about the program error, and offer debugging (if the use + * has installed MSVC or some other compiler that knows how to + * install itself as a handler for program errors). + */ + /* Handle some signals */ #ifdef SIGHUP signal (SIGHUP, on_signal); @@ -346,6 +356,8 @@ main (int argc, char **argv) #ifdef SIGCHLD /* Handle child exits */ signal (SIGCHLD, on_sig_child); +#endif + #endif g_log_set_handler (NULL, G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL, @@ -395,12 +407,13 @@ on_error (const gchar *domain, const gchar *msg, gpointer user_data) { - fprintf (stderr, "%s: fatal error: %s\n", prog_name, msg); - g_on_error_query (prog_name); + gimp_fatal_error ("%s", msg); } static int caught_fatal_sig = 0; +#ifndef NATIVE_WIN32 + static RETSIGTYPE on_signal (int sig_num) { @@ -481,6 +494,8 @@ on_sig_child (int sig_num) } #endif +#endif + typedef struct { gint32 test_gint32; diff --git a/app/measure.c b/app/measure.c index c01cf21301..c956407884 100644 --- a/app/measure.c +++ b/app/measure.c @@ -20,7 +20,7 @@ */ #include "config.h" -#include + #include "actionarea.h" #include "appenv.h" #include "draw_core.h" @@ -29,7 +29,7 @@ #include "tool_options_ui.h" #include "libgimp/gimpintl.h" - +#include "libgimp/gimpmath.h" /* definitions */ #define TARGET 8 diff --git a/app/paint-funcs/paint-funcs.c b/app/paint-funcs/paint-funcs.c index eb544b52a4..3bf7c41535 100644 --- a/app/paint-funcs/paint-funcs.c +++ b/app/paint-funcs/paint-funcs.c @@ -21,7 +21,6 @@ #include #include #include -#include #include "appenv.h" #include "gimprc.h" @@ -33,6 +32,7 @@ #include "tile.h" /* ick. */ #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #define STD_BUF_SIZE 1021 #define MAXDIFF 195076 diff --git a/app/paint/gimpdodgeburn.c b/app/paint/gimpdodgeburn.c index ba07025c78..a42498347a 100644 --- a/app/paint/gimpdodgeburn.c +++ b/app/paint/gimpdodgeburn.c @@ -16,10 +16,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" + #include #include -#include + #include "gdk/gdkkeysyms.h" + #include "appenv.h" #include "drawable.h" #include "errors.h" @@ -35,6 +37,7 @@ #include "gimage.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* the dodgeburn structures */ diff --git a/app/paint/gimpink.c b/app/paint/gimpink.c index b9cd6a8774..d8ae4c9459 100644 --- a/app/paint/gimpink.c +++ b/app/paint/gimpink.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include #include + #include "appenv.h" #include "drawable.h" #include "draw_core.h" @@ -32,6 +34,7 @@ #include "gdisplay.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #include "tile.h" /* ick. */ diff --git a/app/paint/gimpsmudge.c b/app/paint/gimpsmudge.c index 197c643568..84b78c5f5d 100644 --- a/app/paint/gimpsmudge.c +++ b/app/paint/gimpsmudge.c @@ -15,10 +15,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include #include + #include "gdk/gdkkeysyms.h" + #include "appenv.h" #include "drawable.h" #include "errors.h" @@ -34,6 +37,7 @@ #include "gimage.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* default defines */ diff --git a/app/paint_core.c b/app/paint_core.c index c595deb783..109a4f9e75 100644 --- a/app/paint_core.c +++ b/app/paint_core.c @@ -15,10 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include /* temporary for debugging */ #include -#include + #include "appenv.h" #include "gimpbrushlist.h" #include "drawable.h" @@ -36,6 +38,7 @@ #include "cursorutil.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #include "tile.h" /* ick. */ diff --git a/app/paint_funcs.c b/app/paint_funcs.c index eb544b52a4..3bf7c41535 100644 --- a/app/paint_funcs.c +++ b/app/paint_funcs.c @@ -21,7 +21,6 @@ #include #include #include -#include #include "appenv.h" #include "gimprc.h" @@ -33,6 +32,7 @@ #include "tile.h" /* ick. */ #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #define STD_BUF_SIZE 1021 #define MAXDIFF 195076 diff --git a/app/paths_dialog.c b/app/paths_dialog.c index 11834eacdf..577886b533 100644 --- a/app/paths_dialog.c +++ b/app/paths_dialog.c @@ -22,9 +22,9 @@ #include #include #include -#include #include "gdk/gdkkeysyms.h" + #include "appenv.h" #include "draw_core.h" #include "actionarea.h" @@ -57,6 +57,7 @@ #include "drawable_pvt.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #include "pixmaps/new.xpm" #include "pixmaps/duplicate.xpm" diff --git a/app/rotate_tool.c b/app/rotate_tool.c index fc7f294f67..37feb3257b 100644 --- a/app/rotate_tool.c +++ b/app/rotate_tool.c @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include "appenv.h" #include "drawable.h" #include "gdisplay.h" @@ -33,6 +34,7 @@ #include "libgimp/gimpsizeentry.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* index into trans_info array */ #define ANGLE 0 diff --git a/app/smudge.c b/app/smudge.c index 197c643568..84b78c5f5d 100644 --- a/app/smudge.c +++ b/app/smudge.c @@ -15,10 +15,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include #include + #include "gdk/gdkkeysyms.h" + #include "appenv.h" #include "drawable.h" #include "errors.h" @@ -34,6 +37,7 @@ #include "gimage.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* default defines */ diff --git a/app/tools/bezier_select.c b/app/tools/bezier_select.c index f5b1a2a414..ba339c1ca6 100644 --- a/app/tools/bezier_select.c +++ b/app/tools/bezier_select.c @@ -18,7 +18,7 @@ #include "config.h" #include -#include + #include "appenv.h" #include "cursorutil.h" #include "draw_core.h" @@ -34,6 +34,7 @@ #include "selection_options.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* Bezier extensions made by Raphael FRANCOIS (fraph@ibm.net) diff --git a/app/tools/blend.c b/app/tools/blend.c index 2808eb4201..183d4a41da 100644 --- a/app/tools/blend.c +++ b/app/tools/blend.c @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include "appenv.h" #include "asupsample.h" #include "blend.h" @@ -39,6 +40,7 @@ #include "tile.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* target size */ diff --git a/app/tools/color_balance.c b/app/tools/color_balance.c index 03d926c05d..6e66f75f05 100644 --- a/app/tools/color_balance.c +++ b/app/tools/color_balance.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include -#include + #include "appenv.h" #include "actionarea.h" #include "color_balance.h" @@ -30,6 +32,7 @@ #include "interface.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #define TEXT_WIDTH 55 diff --git a/app/tools/curves.c b/app/tools/curves.c index 75b98e6796..e1372e1ffc 100644 --- a/app/tools/curves.c +++ b/app/tools/curves.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include -#include + #include "appenv.h" #include "actionarea.h" #include "buildmenu.h" @@ -32,6 +34,7 @@ #include "gimplut.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #define GRAPH 0x1 #define XRANGE_TOP 0x2 diff --git a/app/tools/dodgeburn.c b/app/tools/dodgeburn.c index ba07025c78..a42498347a 100644 --- a/app/tools/dodgeburn.c +++ b/app/tools/dodgeburn.c @@ -16,10 +16,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" + #include #include -#include + #include "gdk/gdkkeysyms.h" + #include "appenv.h" #include "drawable.h" #include "errors.h" @@ -35,6 +37,7 @@ #include "gimage.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* the dodgeburn structures */ diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c index 2808eb4201..183d4a41da 100644 --- a/app/tools/gimpblendtool.c +++ b/app/tools/gimpblendtool.c @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include "appenv.h" #include "asupsample.h" #include "blend.h" @@ -39,6 +40,7 @@ #include "tile.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* target size */ diff --git a/app/tools/gimpcolorbalancetool.c b/app/tools/gimpcolorbalancetool.c index 03d926c05d..6e66f75f05 100644 --- a/app/tools/gimpcolorbalancetool.c +++ b/app/tools/gimpcolorbalancetool.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include -#include + #include "appenv.h" #include "actionarea.h" #include "color_balance.h" @@ -30,6 +32,7 @@ #include "interface.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #define TEXT_WIDTH 55 diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c index 75b98e6796..e1372e1ffc 100644 --- a/app/tools/gimpcurvestool.c +++ b/app/tools/gimpcurvestool.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include -#include + #include "appenv.h" #include "actionarea.h" #include "buildmenu.h" @@ -32,6 +34,7 @@ #include "gimplut.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #define GRAPH 0x1 #define XRANGE_TOP 0x2 diff --git a/app/tools/gimpdodgeburntool.c b/app/tools/gimpdodgeburntool.c index ba07025c78..a42498347a 100644 --- a/app/tools/gimpdodgeburntool.c +++ b/app/tools/gimpdodgeburntool.c @@ -16,10 +16,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" + #include #include -#include + #include "gdk/gdkkeysyms.h" + #include "appenv.h" #include "drawable.h" #include "errors.h" @@ -35,6 +37,7 @@ #include "gimage.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* the dodgeburn structures */ diff --git a/app/tools/gimpinktool.c b/app/tools/gimpinktool.c index b9cd6a8774..d8ae4c9459 100644 --- a/app/tools/gimpinktool.c +++ b/app/tools/gimpinktool.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include #include + #include "appenv.h" #include "drawable.h" #include "draw_core.h" @@ -32,6 +34,7 @@ #include "gdisplay.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #include "tile.h" /* ick. */ diff --git a/app/tools/gimpiscissorstool.c b/app/tools/gimpiscissorstool.c index c0c1e564d2..92f88d77a2 100644 --- a/app/tools/gimpiscissorstool.c +++ b/app/tools/gimpiscissorstool.c @@ -30,7 +30,8 @@ * The 0.54 version of the algorithm was then forwards ported to 1.1.4 * by Austin Donnelly. */ -#include +#include "config.h" + #include #include #include @@ -53,6 +54,7 @@ #include "bezier_selectP.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* local structures */ diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c index c01cf21301..c956407884 100644 --- a/app/tools/gimpmeasuretool.c +++ b/app/tools/gimpmeasuretool.c @@ -20,7 +20,7 @@ */ #include "config.h" -#include + #include "actionarea.h" #include "appenv.h" #include "draw_core.h" @@ -29,7 +29,7 @@ #include "tool_options_ui.h" #include "libgimp/gimpintl.h" - +#include "libgimp/gimpmath.h" /* definitions */ #define TARGET 8 diff --git a/app/tools/gimprotatetool.c b/app/tools/gimprotatetool.c index fc7f294f67..37feb3257b 100644 --- a/app/tools/gimprotatetool.c +++ b/app/tools/gimprotatetool.c @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include "appenv.h" #include "drawable.h" #include "gdisplay.h" @@ -33,6 +34,7 @@ #include "libgimp/gimpsizeentry.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* index into trans_info array */ #define ANGLE 0 diff --git a/app/tools/gimpsmudgetool.c b/app/tools/gimpsmudgetool.c index 197c643568..84b78c5f5d 100644 --- a/app/tools/gimpsmudgetool.c +++ b/app/tools/gimpsmudgetool.c @@ -15,10 +15,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include #include + #include "gdk/gdkkeysyms.h" + #include "appenv.h" #include "drawable.h" #include "errors.h" @@ -34,6 +37,7 @@ #include "gimage.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* default defines */ diff --git a/app/tools/ink.c b/app/tools/ink.c index b9cd6a8774..d8ae4c9459 100644 --- a/app/tools/ink.c +++ b/app/tools/ink.c @@ -15,9 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include #include + #include "appenv.h" #include "drawable.h" #include "draw_core.h" @@ -32,6 +34,7 @@ #include "gdisplay.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #include "tile.h" /* ick. */ diff --git a/app/tools/iscissors.c b/app/tools/iscissors.c index c0c1e564d2..92f88d77a2 100644 --- a/app/tools/iscissors.c +++ b/app/tools/iscissors.c @@ -30,7 +30,8 @@ * The 0.54 version of the algorithm was then forwards ported to 1.1.4 * by Austin Donnelly. */ -#include +#include "config.h" + #include #include #include @@ -53,6 +54,7 @@ #include "bezier_selectP.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* local structures */ diff --git a/app/tools/measure.c b/app/tools/measure.c index c01cf21301..c956407884 100644 --- a/app/tools/measure.c +++ b/app/tools/measure.c @@ -20,7 +20,7 @@ */ #include "config.h" -#include + #include "actionarea.h" #include "appenv.h" #include "draw_core.h" @@ -29,7 +29,7 @@ #include "tool_options_ui.h" #include "libgimp/gimpintl.h" - +#include "libgimp/gimpmath.h" /* definitions */ #define TARGET 8 diff --git a/app/tools/paint_core.c b/app/tools/paint_core.c index c595deb783..109a4f9e75 100644 --- a/app/tools/paint_core.c +++ b/app/tools/paint_core.c @@ -15,10 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + #include #include /* temporary for debugging */ #include -#include + #include "appenv.h" #include "gimpbrushlist.h" #include "drawable.h" @@ -36,6 +38,7 @@ #include "cursorutil.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #include "tile.h" /* ick. */ diff --git a/app/tools/rotate_tool.c b/app/tools/rotate_tool.c index fc7f294f67..37feb3257b 100644 --- a/app/tools/rotate_tool.c +++ b/app/tools/rotate_tool.c @@ -15,7 +15,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include "appenv.h" #include "drawable.h" #include "gdisplay.h" @@ -33,6 +34,7 @@ #include "libgimp/gimpsizeentry.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* index into trans_info array */ #define ANGLE 0 diff --git a/app/tools/smudge.c b/app/tools/smudge.c index 197c643568..84b78c5f5d 100644 --- a/app/tools/smudge.c +++ b/app/tools/smudge.c @@ -15,10 +15,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include #include + #include "gdk/gdkkeysyms.h" + #include "appenv.h" #include "drawable.h" #include "errors.h" @@ -34,6 +37,7 @@ #include "gimage.h" #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" /* default defines */ diff --git a/app/tools/transform_core.c b/app/tools/transform_core.c index b5e812e5c5..c8f8749d51 100644 --- a/app/tools/transform_core.c +++ b/app/tools/transform_core.c @@ -15,9 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" #include -#include + #include "appenv.h" #include "actionarea.h" #include "cursorutil.h" @@ -42,6 +43,7 @@ #include "tile.h" /* ick. */ #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #define BILINEAR(jk,j1k,jk1,j1k1,dx,dy) \ ((1-dy) * (jk + dx * (j1k - jk)) + \ diff --git a/app/transform_core.c b/app/transform_core.c index b5e812e5c5..c8f8749d51 100644 --- a/app/transform_core.c +++ b/app/transform_core.c @@ -15,9 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" #include -#include + #include "appenv.h" #include "actionarea.h" #include "cursorutil.h" @@ -42,6 +43,7 @@ #include "tile.h" /* ick. */ #include "libgimp/gimpintl.h" +#include "libgimp/gimpmath.h" #define BILINEAR(jk,j1k,jk1,j1k1,dx,dy) \ ((1-dy) * (jk + dx * (j1k - jk)) + \ diff --git a/libgimp/gimp.c b/libgimp/gimp.c index 8d194ef7f0..e326ebd73d 100644 --- a/libgimp/gimp.c +++ b/libgimp/gimp.c @@ -70,7 +70,9 @@ void gimp_extension_ack (void); void gimp_read_expect_msg(WireMessage *msg, int type); +#ifndef NATIVE_WIN32 static RETSIGTYPE gimp_signal (int signum); +#endif static int gimp_write (GIOChannel *channel , guint8 *buf, gulong count); static int gimp_flush (GIOChannel *channel ); static void gimp_loop (void); @@ -181,6 +183,12 @@ gimp_main (int argc, progname = argv[0]; +#ifndef NATIVE_WIN32 + /* No use catching these on Win32, the user won't get any meaningful + * stack trace from glib anyhow. It's better to let Windows inform + * about the program error, and offer debugging if the plug-in + * has been built with MSVC, and the user has MSVC installed. + */ #ifdef SIGHUP signal (SIGHUP, gimp_signal); #endif @@ -201,6 +209,7 @@ gimp_main (int argc, #ifdef SIGFPE signal (SIGFPE, gimp_signal); #endif +#endif #ifndef NATIVE_WIN32 _readchannel = g_io_channel_unix_new (atoi (argv[2])); @@ -1131,6 +1140,7 @@ gimp_request_wakeups (void) gimp_quit (); } +#ifndef NATIVE_WIN32 static RETSIGTYPE gimp_signal (int signum) { @@ -1170,6 +1180,7 @@ gimp_signal (int signum) gimp_quit (); } +#endif static int gimp_write (GIOChannel *channel, guint8 *buf, gulong count) diff --git a/libgimp/gimp.h b/libgimp/gimp.h index 936618240d..61fb5b627a 100644 --- a/libgimp/gimp.h +++ b/libgimp/gimp.h @@ -24,6 +24,7 @@ #include "libgimp/gimpenums.h" #include "libgimp/gimpfeatures.h" #include "libgimp/gimpenv.h" +#include "libgimp/gimpmath.h" #include "libgimp/parasite.h" #include "libgimp/parasiteP.h" #include "libgimp/gimpunit.h" diff --git a/plug-ins/common/CML_explorer.c b/plug-ins/common/CML_explorer.c index a84d51b158..ea03eeb7fd 100644 --- a/plug-ins/common/CML_explorer.c +++ b/plug-ins/common/CML_explorer.c @@ -69,11 +69,13 @@ * Michael Sweet * */ +#include "config.h" #include "gtk/gtk.h" + #include "libgimp/gimp.h" + #include -#include #include #include #include @@ -81,13 +83,8 @@ #include #include /* for seed of random number */ -#include "config.h" #include "libgimp/stdplugins-intl.h" -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #ifndef RAND_MAX #define RAND_MAX 2147483647 #endif /* RAND_MAX */ @@ -1103,16 +1100,16 @@ logistic_function (CML_PARAM *param, gdouble x, gdouble power) break; case CML_SIN_CURVE: if (1.0 < power) - result = 0.5 * (sin (M_PI * ABS (x1 - 0.5) / power) / sin (M_PI * 0.5 / power) + 1); + result = 0.5 * (sin (G_PI * ABS (x1 - 0.5) / power) / sin (G_PI * 0.5 / power) + 1); else - result = 0.5 * (pow (sin (M_PI * ABS (x1 - 0.5)), power) + 1); + result = 0.5 * (pow (sin (G_PI * ABS (x1 - 0.5)), power) + 1); if (x1 < 0.5) result = 1 - result; break; case CML_SIN_CURVE_STEP: if (1.0 < power) - result = 0.5 * (sin (M_PI * ABS (x1 - 0.5) / power) / sin (M_PI * 0.5 / power) + 1); + result = 0.5 * (sin (G_PI * ABS (x1 - 0.5) / power) / sin (G_PI * 0.5 / power) + 1); else - result = 0.5 * (pow (sin (M_PI * ABS (x1 - 0.5)), power) + 1); + result = 0.5 * (pow (sin (G_PI * ABS (x1 - 0.5)), power) + 1); if (x1 < 0.5) result = 1 - result; result = (result + step) / (gdouble) n; break; diff --git a/plug-ins/common/apply_lens.c b/plug-ins/common/apply_lens.c index 36c6bc6d95..f6ce45efc9 100644 --- a/plug-ins/common/apply_lens.c +++ b/plug-ins/common/apply_lens.c @@ -51,20 +51,16 @@ - clean up source code */ +#include "config.h" + #include #include -#include #include "libgimp/gimp.h" #include "gtk/gtk.h" -#include "config.h" #include "libgimp/stdplugins-intl.h" -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #define ENTRY_WIDTH 100 /* Declare local functions. @@ -231,15 +227,15 @@ find_projected_pos(gfloat a, gfloat b, n[2] = sqrt((1-x*x/(a*a)-y*y/(b*b))*(c*c)); nxangle = acos(n[0]/sqrt(n[0]*n[0]+n[2]*n[2])); - theta1 = M_PI/2 - nxangle; + theta1 = G_PI/2 - nxangle; theta2 = asin(sin(theta1)*ri1/ri2); - theta2 = M_PI/2 - nxangle - theta2; + theta2 = G_PI/2 - nxangle - theta2; *projx = x - tan(theta2)*n[2]; nyangle = acos(n[1]/sqrt(n[1]*n[1]+n[2]*n[2])); - theta1 = M_PI/2 - nyangle; + theta1 = G_PI/2 - nyangle; theta2 = asin(sin(theta1)*ri1/ri2); - theta2 = M_PI/2 - nyangle - theta2; + theta2 = G_PI/2 - nyangle - theta2; *projy = y - tan(theta2)*n[2]; } diff --git a/plug-ins/common/blinds.c b/plug-ins/common/blinds.c index cef4e31855..dbe3e456c4 100644 --- a/plug-ins/common/blinds.c +++ b/plug-ins/common/blinds.c @@ -47,19 +47,15 @@ * Added patches supplied by Tim Mooney mooney@dogbert.cc.ndsu.NoDak.edu * to allow the plug-in to build with Digitals compiler. */ +#include "config.h" #include #include #include -#include + #include "gtk/gtk.h" #include "libgimp/gimp.h" -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - - /***** Magic numbers *****/ /* Don't make preview >255!!! It won't work for horizontal blinds */ @@ -743,7 +739,7 @@ blindsapply(guchar *srow,guchar *drow,gint width,gint bpp,guchar *bg) } /* Disp for each point */ - ang = (bvals.angledsp*2*M_PI)/360; /* Angle in rads */ + ang = (bvals.angledsp*2*G_PI)/360; /* Angle in rads */ ang = (1-fabs(cos(ang))); available = 0; diff --git a/plug-ins/common/bumpmap.c b/plug-ins/common/bumpmap.c index 612de5256f..55cc224675 100644 --- a/plug-ins/common/bumpmap.c +++ b/plug-ins/common/bumpmap.c @@ -86,7 +86,6 @@ #include "config.h" -#include #include #include #include @@ -104,10 +103,6 @@ /***** Magic numbers *****/ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #define PLUG_IN_NAME "plug_in_bump_map" #define PLUG_IN_VERSION "August 1997, 2.04" @@ -606,8 +601,8 @@ bumpmap_init_params(bumpmap_params_t *params) /* Convert to radians */ - azimuth = M_PI * bmvals.azimuth / 180.0; - elevation = M_PI * bmvals.elevation / 180.0; + azimuth = G_PI * bmvals.azimuth / 180.0; + elevation = G_PI * bmvals.elevation / 180.0; /* Calculate the light vector */ @@ -640,7 +635,7 @@ bumpmap_init_params(bumpmap_params_t *params) case SINUOSIDAL: n = i / 255.0; - params->lut[i] = (int) (255.0 * (sin((-M_PI / 2.0) + M_PI * n) + 1.0) / + params->lut[i] = (int) (255.0 * (sin((-G_PI / 2.0) + G_PI * n) + 1.0) / 2.0 + 0.5); break; diff --git a/plug-ins/common/cubism.c b/plug-ins/common/cubism.c index e935ef4d8f..3f0423f087 100644 --- a/plug-ins/common/cubism.c +++ b/plug-ins/common/cubism.c @@ -19,24 +19,15 @@ * You can contact the original The Gimp authors at gimp@xcf.berkeley.edu * Speedups by Elliot Lee */ +#include "config.h" - -#include #include #include #include "gtk/gtk.h" #include "libgimp/gimp.h" -#include "config.h" #include "libgimp/stdplugins-intl.h" -/* Some useful macros */ -#define SQR(a) ((a) * (a)) - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #ifndef RAND_MAX #define RAND_MAX 2147483647 #endif /* RAND_MAX */ @@ -473,7 +464,7 @@ render_cubism (GDrawable *drawable) cvals.tile_saturation; height = (cvals.tile_size + fp_rand (cvals.tile_size / 4.0) - cvals.tile_size / 8.0) * cvals.tile_saturation; - theta = fp_rand (2 * M_PI); + theta = fp_rand (2 * G_PI); polygon_reset (&poly); polygon_add_point (&poly, -width / 2.0, -height / 2.0); polygon_add_point (&poly, width / 2.0, -height / 2.0); diff --git a/plug-ins/common/diffraction.c b/plug-ins/common/diffraction.c index c72b5b47e9..447ab55d14 100644 --- a/plug-ins/common/diffraction.c +++ b/plug-ins/common/diffraction.c @@ -23,7 +23,6 @@ #include "config.h" -#include #include #include #include @@ -37,10 +36,6 @@ /***** Magic numbers *****/ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #define ITERATIONS 100 /* 100 */ #define WEIRD_FACTOR 0.04 /* 0.04 */ @@ -390,7 +385,7 @@ diff_init_luts(void) double a; double sina; - a = -M_PI; + a = -G_PI; for (i = 0; i <= ITERATIONS; i++) { sina = sin(a); @@ -400,7 +395,7 @@ diff_init_luts(void) param_lut1[i] = 0.75 * sina; param_lut2[i] = 0.5 * (4.0 * cos_lut[i] * cos_lut[i] + sina * sina); - a += (2.0 * M_PI / ITERATIONS); + a += (2.0 * G_PI / ITERATIONS); } /* for */ } /* diff_init_luts */ @@ -454,7 +449,7 @@ diff_intensity(double x, double y, double lam) cxy *= WEIRD_FACTOR; sxy *= WEIRD_FACTOR; - polpi2 = dvals.polarization * (M_PI / 2.0); + polpi2 = dvals.polarization * (G_PI / 2.0); cospolpi2 = cos(polpi2); sinpolpi2 = sin(polpi2); @@ -496,7 +491,7 @@ diff_intensity(double x, double y, double lam) sxy += 0.04 * sin(param); } /* for */ - polpi2 = dvals.polarization * (M_PI / 2.0); + polpi2 = dvals.polarization * (G_PI / 2.0); cospolpi2 = cos(polpi2); sinpolpi2 = sin(polpi2); diff --git a/plug-ins/common/emboss.c b/plug-ins/common/emboss.c index 9ecde1a8e5..cd87686848 100644 --- a/plug-ins/common/emboss.c +++ b/plug-ins/common/emboss.c @@ -26,24 +26,19 @@ * $Id$ */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include -#include #include #include #include #include -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - static mw_preview_t emboss_do_preview; struct Grgb { @@ -91,7 +86,7 @@ static inline void EmbossInit(gdouble azimuth, gdouble elevation, static inline void EmbossRow(guchar *src, guchar *texture, guchar *dst, guint xSize, guint bypp, gint alpha); -#define DtoR(d) ((d)*(M_PI/(gdouble)180)) +#define DtoR(d) ((d)*(G_PI/(gdouble)180)) GPlugInInfo PLUG_IN_INFO = { NULL, /* init */ diff --git a/plug-ins/common/film.c b/plug-ins/common/film.c index cd2e435f1a..dd1f79afff 100644 --- a/plug-ins/common/film.c +++ b/plug-ins/common/film.c @@ -31,11 +31,13 @@ */ static char ident[] = "@(#) GIMP Film plug-in v1.03a 1999-07-22"; +#include "config.h" + #include #include #include #include -#include + #include "gtk/gtk.h" #include "libgimp/gimp.h" diff --git a/plug-ins/common/gauss_iir.c b/plug-ins/common/gauss_iir.c index 97c3d8c956..00a646d547 100644 --- a/plug-ins/common/gauss_iir.c +++ b/plug-ins/common/gauss_iir.c @@ -15,17 +15,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" + #include #include #include + #include "gtk/gtk.h" #include "libgimp/gimp.h" -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #define ENTRY_WIDTH 100 typedef struct @@ -633,7 +631,7 @@ find_constants (gdouble n_p[], * using a 4th order approximation of the gaussian operator */ - div = sqrt(2 * M_PI) * std_dev; + div = sqrt(2 * G_PI) * std_dev; constants [0] = -1.783 / std_dev; constants [1] = -1.723 / std_dev; constants [2] = 0.6318 / std_dev; diff --git a/plug-ins/common/gee.c b/plug-ins/common/gee.c index d9a92657bc..942eca4c0d 100644 --- a/plug-ins/common/gee.c +++ b/plug-ins/common/gee.c @@ -19,25 +19,18 @@ * Removed possible div-by-0 errors, took the plugin out * of hiding (guess we need a new easter-egg for GIMP 1.2!) */ +#include "config.h" #include #include #include #include -#include #include #include "glib.h" #include "libgimp/gimp.h" #include "gtk/gtk.h" -#include "config.h" - - -#ifndef HAVE_RINT -#define rint(x) floor ((x) + 0.5) -#endif - /* Test for GTK1.2-style gdkrgb code, else use old 'preview' code. */ #ifdef __GDK_RGB_H__ #define RAPH_IS_HOME yep @@ -339,7 +332,7 @@ static void init_lut(void) for (i=0; i #include -#include #include + #include "gtk/gtk.h" #include "libgimp/gimp.h" -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #define MAX_PREVIEW_WIDTH 256 #define MAX_PREVIEW_HEIGHT 256 #define MAX_DEFORM_AREA_RADIUS 100 @@ -742,7 +739,7 @@ iwarp_init() iwarp_cpy_images(); for (i=0; i #include -#include #include #include #include @@ -47,10 +47,6 @@ /* Typedefs */ /************/ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - #define CHECKBOUNDS(x,y) (x>=0 && y>=0 && x -#include #include #ifdef HAVE_UNISTD_H #include @@ -56,10 +55,6 @@ #include #include -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #define PLUG_IN_NAME "plug_in_mblur" #define PLUG_IN_VERSION "Sep 1997, 1.2" @@ -322,8 +317,8 @@ mblur_linear(void) max_progress = sel_width * sel_height; n = mbvals.length; - px = n*cos(mbvals.angle/180.0*M_PI); - py = n*sin(mbvals.angle/180.0*M_PI); + px = n*cos(mbvals.angle/180.0*G_PI); + py = n*sin(mbvals.angle/180.0*G_PI); /* * Initialization for Bresenham algorithm: @@ -447,7 +442,7 @@ mblur_radial(void) progress = 0; max_progress = sel_width * sel_height; - angle = ((float) mbvals.angle)/180.0*M_PI; + angle = ((float) mbvals.angle)/180.0*G_PI; w = MAX(img_width-cen_x, cen_x); h = MAX(img_height-cen_y, cen_y); R = sqrt(w*w + h*h); diff --git a/plug-ins/common/mosaic.c b/plug-ins/common/mosaic.c index 3aa085d164..d1f5403811 100644 --- a/plug-ins/common/mosaic.c +++ b/plug-ins/common/mosaic.c @@ -22,8 +22,8 @@ * Copyright (C) 1996 Spencer Kimball * Speedups by Elliot Lee */ +#include "config.h" -#include #include #include #include "gtk/gtk.h" @@ -36,14 +36,8 @@ #define RAND_MAX 2147483647 #endif /* RAND_MAX */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #define SCALE_WIDTH 150 -#define SQR(x) ((x) * (x)) - #define HORIZONTAL 0 #define VERTICAL 1 #define OPAQUE 255 @@ -493,8 +487,8 @@ mosaic (GDrawable *drawable) back[alpha] = OPAQUE; } - light_x = -cos (mvals.light_dir * M_PI / 180.0); - light_y = sin (mvals.light_dir * M_PI / 180.0); + light_x = -cos (mvals.light_dir * G_PI / 180.0); + light_y = sin (mvals.light_dir * G_PI / 180.0); scale = (mvals.tile_spacing > mvals.tile_size / 2.0) ? 0.5 : 1.0 - mvals.tile_spacing / mvals.tile_size; diff --git a/plug-ins/common/newsprint.c b/plug-ins/common/newsprint.c index 529e433b51..b90a137a5e 100644 --- a/plug-ins/common/newsprint.c +++ b/plug-ins/common/newsprint.c @@ -48,19 +48,10 @@ #include #include #include -#include #include #include -#ifndef HAVE_RINT -#define rint(x) floor((x)+0.5) -#endif - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - #ifdef RCSID static char rcsid[] = "$Id$"; #endif @@ -122,7 +113,7 @@ do { \ #define BOUNDS(a,x,y) ((a < x) ? x : ((a > y) ? y : a)) #define ISNEG(x) (((x) < 0)? 1 : 0) -#define DEG2RAD(d) ((d) * M_PI / 180) +#define DEG2RAD(d) ((d) * G_PI / 180) #define VALID_BOOL(x) ((x) == TRUE || (x) == FALSE) #define CLAMPED_ADD(a, b) (((a)+(b) > 0xff)? 0xff : (a) + (b)) @@ -820,7 +811,7 @@ preview_update(channel_st *st) /* redraw preview widget */ gtk_widget_draw(prev->widget, NULL); - sprintf(pct, "%2d%%", (int)rint(spotfn_list[sfn].prev_lvl[i] * 100)); + sprintf(pct, "%2d%%", (int)RINT(spotfn_list[sfn].prev_lvl[i] * 100)); gtk_label_set_text (GTK_LABEL(prev->label), pct); } @@ -1612,8 +1603,8 @@ newsprint_cspace_update (GtkWidget *widget, * Richard Mortier for this one: * * #define a(r) \ - * ((r<=1)? M_PI * (r*r) : \ - * 4 * sqrt(r*r - 1) + M_PI*r*r - 4*r*r*acos(1/r)) + * ((r<=1)? G_PI * (r*r) : \ + * 4 * sqrt(r*r - 1) + G_PI*r*r - 4*r*r*acos(1/r)) * * radius = sqrt(x*x + y*y); * @@ -2012,8 +2003,8 @@ do { \ for(b=0; b #include -#include #include + #include "gtk/gtk.h" #include "libgimp/gimp.h" @@ -65,10 +66,6 @@ static char rcsid[] = "$Id$"; /* Some useful macros */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #ifndef RAND_MAX #define RAND_MAX 2147483647 #endif /* RAND_MAX */ @@ -1119,7 +1116,7 @@ nova (GDrawable *drawable) l = sqrt( u*u + v*v ); /* This algorithm is still under construction. */ - c = (atan2 (u, v) / (2 * M_PI) + .51) * pvals.nspoke; + c = (atan2 (u, v) / (2 * G_PI) + .51) * pvals.nspoke; i = (int) floor (c); c -= i; i %= pvals.nspoke; diff --git a/plug-ins/common/polar.c b/plug-ins/common/polar.c index 75335bc7b3..0a7950a02a 100644 --- a/plug-ins/common/polar.c +++ b/plug-ins/common/polar.c @@ -57,7 +57,6 @@ #include "config.h" -#include #include #include #include @@ -68,11 +67,6 @@ #include #include -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - -#define sqr(x) ((x) * (x)) #define WITHIN(a, b, c) ((((a) <= (b)) && ((b) <= (c))) ? 1 : 0) @@ -495,29 +489,29 @@ calc_undistorted_coords(double wx, double wy, ym = ydiff / 2.0; circle = pcvals.circle; angle = pcvals.angle; - angl = (double)angle / 180.0 * M_PI; + angl = (double)angle / 180.0 * G_PI; if (pcvals.polrec) { if (wx >= cen_x) { if (wy > cen_y) { - phi = M_PI - atan (((double)(wx - cen_x))/((double)(wy - cen_y))); - r = sqrt (sqr (wx - cen_x) + sqr (wy - cen_y)); + phi = G_PI - atan (((double)(wx - cen_x))/((double)(wy - cen_y))); + r = sqrt (SQR (wx - cen_x) + SQR (wy - cen_y)); } else if (wy < cen_y) { phi = atan (((double)(wx - cen_x))/((double)(cen_y - wy))); - r = sqrt (sqr (wx - cen_x) + sqr (cen_y - wy)); + r = sqrt (SQR (wx - cen_x) + SQR (cen_y - wy)); } else { - phi = M_PI / 2; + phi = G_PI / 2; r = wx - cen_x; /* cen_x - x1; */ } } else if (wx < cen_x) { if (wy < cen_y) { - phi = 2 * M_PI - atan (((double)(cen_x -wx))/((double)(cen_y - wy))); - r = sqrt (sqr (cen_x - wx) + sqr (cen_y - wy)); + phi = 2 * G_PI - atan (((double)(cen_x -wx))/((double)(cen_y - wy))); + r = sqrt (SQR (cen_x - wx) + SQR (cen_y - wy)); } else if (wy > cen_y) { - phi = M_PI + atan (((double)(cen_x - wx))/((double)(wy - cen_y))); - r = sqrt (sqr (cen_x - wx) + sqr (wy - cen_y)); + phi = G_PI + atan (((double)(cen_x - wx))/((double)(wy - cen_y))); + r = sqrt (SQR (cen_x - wx) + SQR (wy - cen_y)); } else { - phi = 1.5 * M_PI; + phi = 1.5 * G_PI; r = cen_x - wx; /* cen_x - x1; */ } } @@ -540,17 +534,17 @@ calc_undistorted_coords(double wx, double wy, xmax = ymax / m; } - rmax = sqrt ( (double)(sqr (xmax) + sqr (ymax)) ); + rmax = sqrt ( (double)(SQR (xmax) + SQR (ymax)) ); t = ((cen_y - y1) < (cen_x - x1)) ? (cen_y - y1) : (cen_x - x1); rmax = (rmax - t) / 100 * (100 - circle) + t; - phi = fmod (phi + angl, 2*M_PI); + phi = fmod (phi + angl, 2*G_PI); if (pcvals.backwards) - x_calc = x2 - 1 - (x2 - x1 - 1)/(2*M_PI) * phi; + x_calc = x2 - 1 - (x2 - x1 - 1)/(2*G_PI) * phi; else - x_calc = (x2 - x1 - 1)/(2*M_PI) * phi + x1; + x_calc = (x2 - x1 - 1)/(2*G_PI) * phi + x1; if (pcvals.inverse) y_calc = (y2 - y1)/rmax * r + y1; @@ -571,20 +565,20 @@ calc_undistorted_coords(double wx, double wy, } else { if (pcvals.backwards) - phi = (2 * M_PI) * (x2 - wx) / xdiff; + phi = (2 * G_PI) * (x2 - wx) / xdiff; else - phi = (2 * M_PI) * (wx - x1) / xdiff; + phi = (2 * G_PI) * (wx - x1) / xdiff; - phi = fmod (phi + angl, 2 * M_PI); + phi = fmod (phi + angl, 2 * G_PI); - if (phi >= 1.5 * M_PI) - phi2 = 2 * M_PI - phi; + if (phi >= 1.5 * G_PI) + phi2 = 2 * G_PI - phi; else - if (phi >= M_PI) - phi2 = phi - M_PI; + if (phi >= G_PI) + phi2 = phi - G_PI; else - if (phi >= 0.5 * M_PI) - phi2 = M_PI - phi; + if (phi >= 0.5 * G_PI) + phi2 = G_PI - phi; else phi2 = phi; @@ -613,7 +607,7 @@ calc_undistorted_coords(double wx, double wy, xmax = ymax / m; } - rmax = sqrt ((double)(sqr (xmax) + sqr (ymax))); + rmax = sqrt ((double)(SQR (xmax) + SQR (ymax))); t = ((ym - y1) < (xm - x1)) ? (ym - y1) : (xm - x1); @@ -627,19 +621,19 @@ calc_undistorted_coords(double wx, double wy, xx = r * sin (phi2); yy = r * cos (phi2); - if (phi >= 1.5 * M_PI) + if (phi >= 1.5 * G_PI) { x_calc = (double)xm - xx; y_calc = (double)ym - yy; } else - if (phi >= M_PI) + if (phi >= G_PI) { x_calc = (double)xm - xx; y_calc = (double)ym + yy; } else - if (phi >= 0.5 * M_PI) + if (phi >= 0.5 * G_PI) { x_calc = (double)xm + xx; y_calc = (double)ym + yy; diff --git a/plug-ins/common/psd.c b/plug-ins/common/psd.c index 45ebe87beb..a174461963 100644 --- a/plug-ins/common/psd.c +++ b/plug-ins/common/psd.c @@ -146,15 +146,10 @@ #include #endif #include -#include #include #include -#ifndef HAVE_RINT -#define rint(x) floor (x + 0.5) -#endif - /* Local types etc */ typedef enum @@ -765,14 +760,14 @@ dispatch_resID(guint ID, FILE *fd, guint32 *offset, guint32 Size) if (psd_image.guides[i].horizontal) { psd_image.guides[i].position = - rint((double)(psd_image.guides[i].position * + RINT((double)(psd_image.guides[i].position * (magic4>>8)) /(double)(magic4&255)); } else { psd_image.guides[i].position = - rint((double)(psd_image.guides[i].position * + RINT((double)(psd_image.guides[i].position * (magic6>>8)) /(double)(magic6&255)); } diff --git a/plug-ins/common/ripple.c b/plug-ins/common/ripple.c index 3248314c4b..4819430f10 100644 --- a/plug-ins/common/ripple.c +++ b/plug-ins/common/ripple.c @@ -20,20 +20,17 @@ * * You can contact the original The Gimp authors at gimp@xcf.berkeley.edu */ -#include +#include "config.h" + #include #include #include -#include + #include "gtk/gtk.h" #include "libgimp/gimp.h" /* Some useful macros */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #define SCALE_WIDTH 200 #define TILE_CACHE_SIZE 16 #define ENTRY_WIDTH 35 @@ -1012,7 +1009,7 @@ displace_amount (gint location) switch (rvals.waveform) { case SINE: - return rvals.amplitude*sin(location*(2*M_PI)/(double)rvals.period); + return rvals.amplitude*sin(location*(2*G_PI)/(double)rvals.period); case SAWTOOTH: return floor(rvals.amplitude*(fabs((((location%rvals.period)/(double)rvals.period)*4)-2)-1)); } diff --git a/plug-ins/common/sparkle.c b/plug-ins/common/sparkle.c index 3ac0d0278a..6d855d1039 100644 --- a/plug-ins/common/sparkle.c +++ b/plug-ins/common/sparkle.c @@ -22,18 +22,15 @@ /* * Sparkle - simulate pixel bloom and diffraction effects */ +#include "config.h" #include #include #include -#include + #include "gtk/gtk.h" #include "libgimp/gimp.h" -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #define SCALE_WIDTH 125 #define TILE_CACHE_SIZE 16 #define MAX_CHANNELS 4 @@ -657,8 +654,8 @@ fspike (GPixelRgn *dest_rgn, hsl_to_rgb (ho, 1.0, vo, &val[0], &val[1], &val[2]); } - dx = 0.2 * cos (theta * M_PI / 180.0); - dy = 0.2 * sin (theta * M_PI / 180.0); + dx = 0.2 * cos (theta * G_PI / 180.0); + dy = 0.2 * sin (theta * G_PI / 180.0); xrt = xr; yrt = yr; rpos = 0.2; diff --git a/plug-ins/common/spheredesigner.c b/plug-ins/common/spheredesigner.c index 477611f15d..39df97e183 100644 --- a/plug-ins/common/spheredesigner.c +++ b/plug-ins/common/spheredesigner.c @@ -32,10 +32,6 @@ #include -#ifndef G_PI /* G_PI will be in GLib eventually */ -#define G_PI 3.14159265358979323846 -#endif - /* Tor Lillqvist used these, but they're not defined on my system? -Vidar */ /* They are in GIMP's config.h. --tml */ #ifndef SRAND_FUNC diff --git a/plug-ins/common/spread.c b/plug-ins/common/spread.c index 2b95449b26..d584651f28 100644 --- a/plug-ins/common/spread.c +++ b/plug-ins/common/spread.c @@ -21,19 +21,16 @@ * You can contact Federico Mena Quintero at quartic@polloux.fciencias.unam.mx * You can contact the original The Gimp authors at gimp@xcf.berkeley.edu */ +#include "config.h" #include #include #include -#include + #include "gtk/gtk.h" #include "libgimp/gimp.h" /* Some useful macros */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #define SCALE_WIDTH 200 #define TILE_CACHE_SIZE 16 #define ENTRY_WIDTH 50 @@ -270,7 +267,7 @@ spread (GDrawable *drawable) /* Initialize random stuff */ srand (time (NULL)); - angle_mod_value = M_PI*2; + angle_mod_value = G_PI*2; angle_sub_value = angle_mod_value / 2; x_mod_value = x_amount + 1; x_sub_value = x_mod_value / 2; diff --git a/plug-ins/common/waves.c b/plug-ins/common/waves.c index 0912a247b0..9e534eaa14 100644 --- a/plug-ins/common/waves.c +++ b/plug-ins/common/waves.c @@ -25,9 +25,8 @@ * * $Id$ */ - +#include "config.h" -#include #include #include @@ -35,10 +34,6 @@ #include #include -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - struct Grgb { guint8 red; guint8 green; @@ -371,7 +366,7 @@ wave(guchar *src, guchar *dst, gint width, gint height, gint bypp, gint k; - phase = phase*M_PI/180; + phase = phase*G_PI/180; rowsiz = width * bypp; if (verbose) { @@ -461,13 +456,13 @@ wave(guchar *src, guchar *dst, gint width, gint height, gint bypp, if (reflective){ amnt = amplitude * fabs(sin(((d / wavelength) - * (2.0 * M_PI) + phase))); + * (2.0 * G_PI) + phase))); needx = (amnt * dx) / xscale + cen_x; needy = (amnt * dy) / yscale + cen_y; } else { amnt = amplitude * sin(((d / wavelength) - * (2.0 * M_PI) + phase)); + * (2.0 * G_PI) + phase)); needx = (amnt + dx) / xscale + cen_x; needy = (amnt + dy) / yscale + cen_y; diff --git a/plug-ins/common/whirlpinch.c b/plug-ins/common/whirlpinch.c index 0319ff42a3..62dc1a6d4f 100644 --- a/plug-ins/common/whirlpinch.c +++ b/plug-ins/common/whirlpinch.c @@ -48,7 +48,6 @@ #include "config.h" -#include #include #include #include @@ -59,19 +58,11 @@ #include "gtk/gtk.h" #include "libgimp/gimp.h" - -/***** Magic numbers *****/ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - -#ifndef M_PI_2 -#define M_PI_2 1.57079632679489661923 -#endif /* M_PI_2 */ - #define PLUG_IN_NAME "plug_in_whirl_pinch" #define PLUG_IN_VERSION "May 1997, 2.09" +/***** Magic numbers *****/ + #define PREVIEW_SIZE 128 #define SCALE_WIDTH 200 #define ENTRY_WIDTH 60 @@ -418,7 +409,7 @@ whirl_pinch(void) gimp_progress_init("Whirling and pinching..."); - whirl = wpvals.whirl * M_PI / 180; + whirl = wpvals.whirl * G_PI / 180; radius2 = radius * radius * wpvals.radius; for (row = sel_y1; row <= ((sel_y1 + sel_y2) / 2); row++) { @@ -563,7 +554,7 @@ calc_undistorted_coords(double wx, double wy, /* Pinch */ - factor = pow(sin(M_PI_2 * dist), -pinch); + factor = pow(sin(G_PI_2 * dist), -pinch); dx *= factor; dy *= factor; @@ -931,7 +922,7 @@ dialog_update_preview(void) dx = (right - left) / (preview_width - 1); dy = (bottom - top) / (preview_height - 1); - whirl = wpvals.whirl * M_PI / 180.0; + whirl = wpvals.whirl * G_PI / 180.0; radius2 = radius * radius * wpvals.radius; scale_x = (double) preview_width / (right - left + 1); diff --git a/plug-ins/flame/libifs.c b/plug-ins/flame/libifs.c index 1d9a11a79e..3906824d00 100644 --- a/plug-ins/flame/libifs.c +++ b/plug-ins/flame/libifs.c @@ -16,20 +16,15 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" - -#include #include #include +#include "libgimp/gimpmath.h" + #include "libifs.h" -#include "config.h" - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #define CHOOSE_XFORM_GRAIN 100 @@ -161,7 +156,7 @@ void iterate(cp, n, fuse, points) double nx, ny; if (tx < -EPS || tx > EPS || ty < -EPS || ty > EPS) - nx = atan2(tx, ty) / M_PI; + nx = atan2(tx, ty) / G_PI; else nx = 0.0; @@ -403,23 +398,23 @@ void interpolate_angle(t, s, v1, v2, v3, tie, cross) /* take the shorter way around the circle... */ if (x > y) { d = x - y; - if (d > M_PI + EPS || - (d > M_PI - EPS && tie)) - y += 2*M_PI; + if (d > G_PI + EPS || + (d > G_PI - EPS && tie)) + y += 2*G_PI; } else { d = y - x; - if (d > M_PI + EPS || - (d > M_PI - EPS && tie)) - x += 2*M_PI; + if (d > G_PI + EPS || + (d > G_PI - EPS && tie)) + x += 2*G_PI; } /* unless we are supposed to avoid crossing */ if (cross) { if (lastx > x) { if (lasty < y) - y -= 2*M_PI; + y -= 2*G_PI; } else { if (lasty > y) - y += 2*M_PI; + y += 2*G_PI; } } else { lastx = x; @@ -552,7 +547,7 @@ void interpolate(cps, ncps, time, result) if (cps[i1].cmap_inter) { for (i = 0; i < 256; i++) { double spread = 0.15; - double d0, d1, e0, e1, c = 2 * M_PI * i / 256.0; + double d0, d1, e0, e1, c = 2 * G_PI * i / 256.0; c = cos(c * cps[i1].cmap_inter) + 4.0 * c1 - 2.0; if (c > spread) c = spread; if (c < -spread) c = -spread; @@ -626,7 +621,7 @@ void interpolate(cps, ncps, time, result) result->xform[i].c); if (1) { - double rh_time = time * 2*M_PI / (60.0 * 30.0); + double rh_time = time * 2*G_PI / (60.0 * 30.0); /* apply pulse factor. */ r = 1.0; diff --git a/plug-ins/gfig/gfig.c b/plug-ins/gfig/gfig.c index 7ab045cdc5..05e60b1b52 100644 --- a/plug-ins/gfig/gfig.c +++ b/plug-ins/gfig/gfig.c @@ -78,10 +78,6 @@ # endif #endif -#ifndef HAVE_RINT -#define rint(x) floor (x + 0.5) -#endif - #include "libgimp/gimp.h" #include "libgimp/gimpui.h" #include "pix_data.h" @@ -120,20 +116,6 @@ #define BRUSH_PREVIEW_SZ 32 #define GFIG_HEADER "GFIG Version 0.1\n" - -#ifndef TRUE -#define TRUE 1 -#endif /* TRUE */ - -#ifndef FALSE -#define FALSE 0 -#endif /* FALSE */ - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - - #define PREVIEW_MASK GDK_EXPOSURE_MASK | \ GDK_MOTION_NOTIFY | \ GDK_POINTER_MOTION_MASK | \ @@ -6895,7 +6877,7 @@ find_grid_pos(GdkPoint *p,GdkPoint *gp,guint is_butt3) real_radius = ang_radius = sqrt((shift_y*shift_y) + (shift_x*shift_x)); /* round radius */ - rounded_radius = (gint)(rint(ang_radius/selvals.opts.gridspacing))*selvals.opts.gridspacing; + rounded_radius = (gint)(RINT(ang_radius/selvals.opts.gridspacing))*selvals.opts.gridspacing; if(rounded_radius <= 0 || real_radius <=0) { /* DEAD CENTER */ @@ -6908,21 +6890,21 @@ find_grid_pos(GdkPoint *p,GdkPoint *gp,guint is_butt3) return; } - ang_grid = 2*M_PI/get_num_radials(); + ang_grid = 2*G_PI/get_num_radials(); real_angle = atan2(shift_y,shift_x); if(real_angle < 0) - real_angle += 2*M_PI; + real_angle += 2*G_PI; - rounded_angle = (rint((real_angle/ang_grid)))*ang_grid; + rounded_angle = (RINT((real_angle/ang_grid)))*ang_grid; #ifdef DEBUG printf("real_ang = %f ang_gid = %f rounded_angle = %f rounded radius = %d\n", real_angle,ang_grid,rounded_angle,rounded_radius); printf("preview_width = %d preview_height = %d\n",preview_width,preview_height); #endif /* DEBUG */ - gp->x = (gint)rint((rounded_radius*cos(rounded_angle))) + preview_width/2; - gp->y = -(gint)rint((rounded_radius*sin(rounded_angle))) + preview_height/2; + gp->x = (gint)RINT((rounded_radius*cos(rounded_angle))) + preview_width/2; + gp->y = -(gint)RINT((rounded_radius*sin(rounded_angle))) + preview_height/2; if(is_butt3) { @@ -6930,13 +6912,13 @@ find_grid_pos(GdkPoint *p,GdkPoint *gp,guint is_butt3) { if(fabs(rounded_angle - cons_ang) > ang_grid/2) { - gp->x = (gint)rint((cons_radius*cos(rounded_angle))) + preview_width/2; - gp->y = -(gint)rint((cons_radius*sin(rounded_angle))) + preview_height/2; + gp->x = (gint)RINT((cons_radius*cos(rounded_angle))) + preview_width/2; + gp->y = -(gint)RINT((cons_radius*sin(rounded_angle))) + preview_height/2; } else { - gp->x = (gint)rint((rounded_radius*cos(cons_ang))) + preview_width/2; - gp->y = -(gint)rint((rounded_radius*sin(cons_ang))) + preview_height/2; + gp->x = (gint)RINT((rounded_radius*cos(cons_ang))) + preview_width/2; + gp->y = -(gint)RINT((rounded_radius*sin(cons_ang))) + preview_height/2; } } } @@ -7232,7 +7214,7 @@ draw_grid_polar(GdkGC *drawgc) } /* Lines */ - ang_grid = 2*M_PI/get_num_radials(); + ang_grid = 2*G_PI/get_num_radials(); ang_radius = sqrt((preview_width*preview_width) + (preview_height*preview_height))/2; for(loop = 0 ; loop <= get_num_radials() ; loop++) @@ -7241,8 +7223,8 @@ draw_grid_polar(GdkGC *drawgc) ang_loop = loop * ang_grid; - lx = (gint)rint(ang_radius * cos(ang_loop)); - ly = (gint)rint(ang_radius * sin(ang_loop)); + lx = (gint)RINT(ang_radius * cos(ang_loop)); + ly = (gint)RINT(ang_radius * sin(ang_loop)); gdk_draw_line(gfig_preview->window, drawgc, @@ -8517,10 +8499,10 @@ d_draw_circle(DOBJECT * obj) gdk_draw_arc (gfig_preview->window, gfig_gc, 0, - gfig_scale_x(center_pnt->pnt.x - (gint)rint(radius)), - gfig_scale_y(center_pnt->pnt.y - (gint)rint(radius)), - gfig_scale_x((gint)rint(radius) * 2), - gfig_scale_y((gint)rint(radius) * 2), + gfig_scale_x(center_pnt->pnt.x - (gint)RINT(radius)), + gfig_scale_y(center_pnt->pnt.y - (gint)RINT(radius)), + gfig_scale_x((gint)RINT(radius) * 2), + gfig_scale_y((gint)RINT(radius) * 2), 0, 360*64); } @@ -8693,10 +8675,10 @@ d_update_circle(GdkPoint *pnt) gdk_draw_arc (gfig_preview->window, gfig_gc, 0, - center_pnt->pnt.x - (gint)rint(radius), - center_pnt->pnt.y - (gint)rint(radius), - (gint)rint(radius) * 2, - (gint)rint(radius) * 2, + center_pnt->pnt.x - (gint)RINT(radius), + center_pnt->pnt.y - (gint)RINT(radius), + (gint)RINT(radius) * 2, + (gint)RINT(radius) * 2, 0, 360*64); } @@ -8716,10 +8698,10 @@ d_update_circle(GdkPoint *pnt) gdk_draw_arc (gfig_preview->window, gfig_gc, 0, - center_pnt->pnt.x - (gint)rint(radius), - center_pnt->pnt.y - (gint)rint(radius), - (gint)rint(radius) * 2, - (gint)rint(radius) * 2, + center_pnt->pnt.x - (gint)RINT(radius), + center_pnt->pnt.y - (gint)RINT(radius), + (gint)RINT(radius) * 2, + (gint)RINT(radius) * 2, 0, 360*64); @@ -8932,7 +8914,7 @@ d_paint_approx_ellipse(DOBJECT *obj) b_axis = ((gdouble)(radius_pnt->pnt.y - center_pnt->pnt.y)); /* Lines */ - ang_grid = 2*M_PI/(gdouble)(gint)600; + ang_grid = 2*G_PI/(gdouble)(gint)600; for(loop = 0 ; loop < (gint)600 ; loop++) { @@ -8946,8 +8928,8 @@ d_paint_approx_ellipse(DOBJECT *obj) lx = radius * cos(ang_loop); ly = radius * sin(ang_loop); - calc_pnt.x = (gint)rint(lx + center_pnt->pnt.x); - calc_pnt.y = (gint)rint(ly + center_pnt->pnt.y); + calc_pnt.x = (gint)RINT(lx + center_pnt->pnt.x); + calc_pnt.y = (gint)RINT(ly + center_pnt->pnt.y); /* Miss out duped pnts */ if(!first) @@ -9445,7 +9427,7 @@ d_draw_poly(DOBJECT *obj) radius = sqrt((shift_x*shift_x) + (shift_y*shift_y)); /* Lines */ - ang_grid = 2*M_PI/(gdouble)(gint)obj->type_data; + ang_grid = 2*G_PI/(gdouble)(gint)obj->type_data; offset_angle = atan2(shift_y,shift_x); for(loop = 0 ; loop < (gint)obj->type_data ; loop++) @@ -9458,8 +9440,8 @@ d_draw_poly(DOBJECT *obj) lx = radius * cos(ang_loop); ly = radius * sin(ang_loop); - calc_pnt.x = (gint)rint(lx + center_pnt->pnt.x); - calc_pnt.y = (gint)rint(ly + center_pnt->pnt.y); + calc_pnt.x = (gint)RINT(lx + center_pnt->pnt.x); + calc_pnt.y = (gint)RINT(ly + center_pnt->pnt.y); if(do_line) { @@ -9568,7 +9550,7 @@ d_paint_poly(DOBJECT *obj) radius = sqrt((shift_x*shift_x) + (shift_y*shift_y)); /* Lines */ - ang_grid = 2*M_PI/(gdouble)(gint)obj->type_data; + ang_grid = 2*G_PI/(gdouble)(gint)obj->type_data; offset_angle = atan2(shift_y,shift_x); for(loop = 0 ; loop < (gint)obj->type_data ; loop++) @@ -9581,8 +9563,8 @@ d_paint_poly(DOBJECT *obj) lx = radius * cos(ang_loop); ly = radius * sin(ang_loop); - calc_pnt.x = (gint)rint(lx + center_pnt->pnt.x); - calc_pnt.y = (gint)rint(ly + center_pnt->pnt.y); + calc_pnt.x = (gint)RINT(lx + center_pnt->pnt.x); + calc_pnt.y = (gint)RINT(ly + center_pnt->pnt.y); /* Miss out duped pnts */ if(!first) @@ -9730,7 +9712,7 @@ d_poly2lines(DOBJECT *obj) radius = sqrt((shift_x*shift_x) + (shift_y*shift_y)); /* Lines */ - ang_grid = 2*M_PI/(gdouble)(gint)obj->type_data; + ang_grid = 2*G_PI/(gdouble)(gint)obj->type_data; offset_angle = atan2(shift_y,shift_x); for(loop = 0 ; loop < (gint)obj->type_data ; loop++) @@ -9743,8 +9725,8 @@ d_poly2lines(DOBJECT *obj) lx = radius * cos(ang_loop); ly = radius * sin(ang_loop); - calc_pnt.x = (gint)rint(lx + center_pnt->pnt.x); - calc_pnt.y = (gint)rint(ly + center_pnt->pnt.y); + calc_pnt.x = (gint)RINT(lx + center_pnt->pnt.x); + calc_pnt.y = (gint)RINT(ly + center_pnt->pnt.y); if(!first) { @@ -9851,7 +9833,7 @@ d_star2lines(DOBJECT *obj) outer_radius = sqrt((shift_x*shift_x) + (shift_y*shift_y)); /* Lines */ - ang_grid = 2*M_PI/(2.0*(gdouble)(gint)obj->type_data); + ang_grid = 2*G_PI/(2.0*(gdouble)(gint)obj->type_data); offset_angle = atan2(shift_y,shift_x); shift_x = inner_radius_pnt->pnt.x - center_pnt->pnt.x; @@ -9877,8 +9859,8 @@ d_star2lines(DOBJECT *obj) ly = outer_radius * sin(ang_loop); } - calc_pnt.x = (gint)rint(lx + center_pnt->pnt.x); - calc_pnt.y = (gint)rint(ly + center_pnt->pnt.y); + calc_pnt.x = (gint)RINT(lx + center_pnt->pnt.x); + calc_pnt.y = (gint)RINT(ly + center_pnt->pnt.y); if(!first) { @@ -10294,9 +10276,9 @@ arc_angle(GdkPoint *pnt, GdkPoint *center) printf("offset_ang = %f\n",offset_angle); #endif /* DEBUG */ if(offset_angle < 0) - offset_angle += 2*M_PI; + offset_angle += 2*G_PI; - return(offset_angle*360/(2*M_PI)); + return(offset_angle*360/(2*G_PI)); } void @@ -10540,7 +10522,7 @@ d_paint_arc(DOBJECT *obj) line_pnts = g_malloc0(GFIG_LCC*(2*seg_count + 3)*sizeof(gdouble)); /* Lines */ - ang_grid = 2*M_PI/(gdouble)360; + ang_grid = 2*G_PI/(gdouble)360; if(arcang < 0.0) { @@ -10549,7 +10531,7 @@ d_paint_arc(DOBJECT *obj) arcang = -arcang; } - minang = minang * (2*M_PI/360); /* min ang is in degrees - need in rads*/ + minang = minang * (2*G_PI/360); /* min ang is in degrees - need in rads*/ for(loop = 0 ; loop < abs((gint)arcang) ; loop++) { @@ -10561,8 +10543,8 @@ d_paint_arc(DOBJECT *obj) lx = radius * cos(ang_loop); ly = -radius * sin(ang_loop); /* y grows down screen and angs measured from x clockwise */ - calc_pnt.x = (gint)rint(lx + center_pnt.x); - calc_pnt.y = (gint)rint(ly + center_pnt.y); + calc_pnt.x = (gint)RINT(lx + center_pnt.x); + calc_pnt.y = (gint)RINT(ly + center_pnt.y); /* Miss out duped pnts */ if(!first) @@ -10943,7 +10925,7 @@ d_draw_star(DOBJECT *obj) outer_radius = sqrt((shift_x*shift_x) + (shift_y*shift_y)); /* Lines */ - ang_grid = 2*M_PI/(2.0*(gdouble)(gint)obj->type_data); + ang_grid = 2*G_PI/(2.0*(gdouble)(gint)obj->type_data); offset_angle = atan2(shift_y,shift_x); shift_x = inner_radius_pnt->pnt.x - center_pnt->pnt.x; @@ -10969,8 +10951,8 @@ d_draw_star(DOBJECT *obj) ly = outer_radius * sin(ang_loop); } - calc_pnt.x = (gint)rint(lx + center_pnt->pnt.x); - calc_pnt.y = (gint)rint(ly + center_pnt->pnt.y); + calc_pnt.x = (gint)RINT(lx + center_pnt->pnt.x); + calc_pnt.y = (gint)RINT(ly + center_pnt->pnt.y); if(do_line) { @@ -11099,7 +11081,7 @@ d_paint_star(DOBJECT *obj) outer_radius = sqrt((shift_x*shift_x) + (shift_y*shift_y)); /* Lines */ - ang_grid = 2*M_PI/(2.0*(gdouble)(gint)obj->type_data); + ang_grid = 2*G_PI/(2.0*(gdouble)(gint)obj->type_data); offset_angle = atan2(shift_y,shift_x); shift_x = inner_radius_pnt->pnt.x - center_pnt->pnt.x; @@ -11125,8 +11107,8 @@ d_paint_star(DOBJECT *obj) ly = outer_radius * sin(ang_loop); } - calc_pnt.x = (gint)rint(lx + center_pnt->pnt.x); - calc_pnt.y = (gint)rint(ly + center_pnt->pnt.y); + calc_pnt.x = (gint)RINT(lx + center_pnt->pnt.x); + calc_pnt.y = (gint)RINT(ly + center_pnt->pnt.y); /* Miss out duped pnts */ if(!first) @@ -11511,14 +11493,14 @@ d_draw_spiral(DOBJECT *obj) clock_wise = ((gint)obj->type_data)/(abs((gint)(obj->type_data))); if(offset_angle < 0) - offset_angle += 2*M_PI; + offset_angle += 2*G_PI; - sp_cons = radius/((gint)obj->type_data * 2 * M_PI + offset_angle); + sp_cons = radius/((gint)obj->type_data * 2 * G_PI + offset_angle); /* Lines */ - ang_grid = 2.0*M_PI/(gdouble)180; + ang_grid = 2.0*G_PI/(gdouble)180; - for(loop = 0 ; loop <= abs((gint)(obj->type_data)*180) + clock_wise*(gint)rint(offset_angle/ang_grid) ; loop++) + for(loop = 0 ; loop <= abs((gint)(obj->type_data)*180) + clock_wise*(gint)RINT(offset_angle/ang_grid) ; loop++) { gdouble lx,ly; GdkPoint calc_pnt; @@ -11528,8 +11510,8 @@ d_draw_spiral(DOBJECT *obj) lx = sp_cons * ang_loop * cos(ang_loop)*clock_wise; ly = sp_cons * ang_loop * sin(ang_loop); - calc_pnt.x = (gint)rint(lx + center_pnt->pnt.x); - calc_pnt.y = (gint)rint(ly + center_pnt->pnt.y); + calc_pnt.x = (gint)RINT(lx + center_pnt->pnt.x); + calc_pnt.y = (gint)RINT(ly + center_pnt->pnt.y); if(do_line) { @@ -11617,15 +11599,15 @@ d_paint_spiral(DOBJECT *obj) offset_angle = atan2(shift_y,shift_x); if(offset_angle < 0) - offset_angle += 2*M_PI; + offset_angle += 2*G_PI; - sp_cons = radius/((gint)obj->type_data * 2 * M_PI + offset_angle); + sp_cons = radius/((gint)obj->type_data * 2 * G_PI + offset_angle); /* Lines */ - ang_grid = 2.0*M_PI/(gdouble)180; + ang_grid = 2.0*G_PI/(gdouble)180; /* count - */ - seg_count = abs((gint)(obj->type_data)*180) + clock_wise*(gint)rint(offset_angle/ang_grid); + seg_count = abs((gint)(obj->type_data)*180) + clock_wise*(gint)RINT(offset_angle/ang_grid); /* The second 2* to get around bug in GIMP */ line_pnts = g_malloc0(GFIG_LCC*(2*seg_count + 3)*sizeof(gdouble)); @@ -11640,8 +11622,8 @@ d_paint_spiral(DOBJECT *obj) lx = sp_cons * ang_loop * cos(ang_loop)*clock_wise; ly = sp_cons * ang_loop * sin(ang_loop); - calc_pnt.x = (gint)rint(lx + center_pnt->pnt.x); - calc_pnt.y = (gint)rint(ly + center_pnt->pnt.y); + calc_pnt.x = (gint)RINT(lx + center_pnt->pnt.x); + calc_pnt.y = (gint)RINT(ly + center_pnt->pnt.y); /* Miss out duped pnts */ if(!loop) diff --git a/plug-ins/gimpressionist/gimpressionist.h b/plug-ins/gimpressionist/gimpressionist.h index 8bd0ec678b..13fc70f212 100644 --- a/plug-ins/gimpressionist/gimpressionist.h +++ b/plug-ins/gimpressionist/gimpressionist.h @@ -1,5 +1,7 @@ #include +#include "libgimp/gimpmath.h" + #define PLUG_IN_NAME "plug_in_gimpressionist" #define PLUG_IN_VERSION "v0.99.6, August 1999" @@ -11,14 +13,6 @@ #define MAXORIENTVECT 50 #define MAXSIZEVECT 50 -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - -#ifndef M_PI_2 -#define M_PI_2 (M_PI / 2.0) -#endif /* M_PI_2 */ - /* Type declaration and definitions */ struct vector_t { diff --git a/plug-ins/gimpressionist/orientmap.c b/plug-ins/gimpressionist/orientmap.c index ec298e900b..61b59b0216 100644 --- a/plug-ins/gimpressionist/orientmap.c +++ b/plug-ins/gimpressionist/orientmap.c @@ -34,12 +34,12 @@ int numvect = 0; double degtorad(double d) { - return d/180.0*M_PI; + return d/180.0*G_PI; } double radtodeg(double d) { - double v = d/M_PI*180.0; + double v = d/G_PI*180.0; if(v < 0.0) v += 360; return v; } @@ -117,18 +117,18 @@ double getdir(double x, double y, int from) } else if(vec[i].type == 1) { double a = atan2(vec[i].dy, vec[i].dx); a -= atan2(y-vec[i].y, x-vec[i].x); - tx = sin(a+M_PI_2); - ty = cos(a+M_PI_2); + tx = sin(a+G_PI_2); + ty = cos(a+G_PI_2); } else if(vec[i].type == 2) { double a = atan2(vec[i].dy, vec[i].dx); a += atan2(y-vec[i].y, x-vec[i].x); - tx = sin(a+M_PI_2); - ty = cos(a+M_PI_2); + tx = sin(a+G_PI_2); + ty = cos(a+G_PI_2); } else if(vec[i].type == 3) { double a = atan2(vec[i].dy, vec[i].dx); a -= atan2(y-vec[i].y, x-vec[i].x)*2; - tx = sin(a+M_PI_2); - ty = cos(a+M_PI_2); + tx = sin(a+G_PI_2); + ty = cos(a+G_PI_2); } dst = dist(x,y,vec[i].x,vec[i].y); diff --git a/plug-ins/gimpressionist/ppmtool.c b/plug-ins/gimpressionist/ppmtool.c index 55bd614343..81989f4dd7 100644 --- a/plug-ins/gimpressionist/ppmtool.c +++ b/plug-ins/gimpressionist/ppmtool.c @@ -332,7 +332,7 @@ void freerotate(struct ppm *p, double amount) double nx, ny; double R, a; struct ppm tmp = {0,0,NULL}; - double f = amount*M_PI*2/360.0; + double f = amount*G_PI*2/360.0; int rowstride = p->width * 3; a = p->width/(float)p->height; diff --git a/plug-ins/ifscompose/ifscompose.c b/plug-ins/ifscompose/ifscompose.c index 06d9d17c8a..cc27bf3869 100644 --- a/plug-ins/ifscompose/ifscompose.c +++ b/plug-ins/ifscompose/ifscompose.c @@ -32,8 +32,8 @@ * brushes. * 4. (minor) Make undo work correctly when focus is in entry widget. */ +#include "config.h" -#include #include #include #include @@ -42,10 +42,6 @@ #include "libgimp/gimp.h" #include "ifscompose.h" -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #define SCALE_WIDTH 150 #define ENTRY_WIDTH 60 #define DESIGN_AREA_MAX_SIZE 256 @@ -1492,7 +1488,7 @@ update_values() ifsD->in_update = TRUE; ifsD->current_vals = elements[ifsD->current_element]->v; - ifsD->current_vals.theta *= 180/M_PI; + ifsD->current_vals.theta *= 180/G_PI; value_pair_update(ifsD->prob_pair); value_pair_update(ifsD->x_pair); @@ -1977,7 +1973,7 @@ val_changed_update () undo_update(ifsD->current_element); cur->v = ifsD->current_vals; - cur->v.theta *= M_PI/180.0; + cur->v.theta *= G_PI/180.0; aff_element_compute_trans(cur,width,height, ifsvals.center_x, ifsvals.center_y); aff_element_compute_color_trans(cur); @@ -2139,7 +2135,7 @@ color_map_color_changed_cb(GtkWidget *widget, color_map->color->vals); elements[ifsD->current_element]->v = ifsD->current_vals; - elements[ifsD->current_element]->v.theta *= M_PI/180.0; + elements[ifsD->current_element]->v.theta *= G_PI/180.0; aff_element_compute_color_trans(elements[ifsD->current_element]); update_values(); diff --git a/plug-ins/makefile.cygwin b/plug-ins/makefile.cygwin index 2e11d79538..3336eb0589 100644 --- a/plug-ins/makefile.cygwin +++ b/plug-ins/makefile.cygwin @@ -36,7 +36,7 @@ SEPARATE = AlienMap FractalExplorer Lighting MapObject bmp borderaverage dbbrows # ../unofficial-plug-ins directory, go there, and do "make -f # makefile.cygwin unofficial". -UNOFFICIAL = Anamorphose RGB_Displace ccanalyze fuse gimp_ace guash user_filter +UNOFFICIAL = Anamorphose RGB_Displace ccanalyze fuse gimp_ace guash pmosaic user_filter # The main target @@ -357,6 +357,14 @@ OBJECTS = \ uf_parser.tab.o endif +ifdef EXTRA_pmosaic +EXTRACFLAGS = -I$(JPEG) +EXTRALIBS = -L $(JPEG) -ljpeg +OBJECTS = \ + pmosaic.o \ + pmsc.o +endif + ifdef EXTRA_twain OBJECTS = \ tw_func.o \ diff --git a/plug-ins/makefile.msc b/plug-ins/makefile.msc index 008878379f..37e70dc460 100644 --- a/plug-ins/makefile.msc +++ b/plug-ins/makefile.msc @@ -35,7 +35,7 @@ SEPARATE = AlienMap FractalExplorer Lighting MapObject bmp borderaverage dbbrows # ..\unofficial-plug-ins directory, go there, and do "nmake -f # makefile.msc unofficial". -UNOFFICIAL = Anamorphose RGB_Displace ccanalyze fuse gimp_ace guash user_filter +UNOFFICIAL = Anamorphose RGB_Displace ccanalyze fuse gimp_ace guash pmosaic user_filter # The main target @@ -381,6 +381,14 @@ OBJECTS = \ uf_parser.tab.obj !ENDIF +!IFDEF EXTRA_pmosaic +EXTRACFLAGS = -I$(JPEG) +EXTRALIBS = $(JPEG)\libjpeg.lib +OBJECTS = \ + pmosaic.obj \ + pmsc.obj +!ENDIF + !IFDEF EXTRA_twain OBJECTS = \ tw_func.obj \ diff --git a/plug-ins/mosaic/mosaic.c b/plug-ins/mosaic/mosaic.c index 3aa085d164..d1f5403811 100644 --- a/plug-ins/mosaic/mosaic.c +++ b/plug-ins/mosaic/mosaic.c @@ -22,8 +22,8 @@ * Copyright (C) 1996 Spencer Kimball * Speedups by Elliot Lee */ +#include "config.h" -#include #include #include #include "gtk/gtk.h" @@ -36,14 +36,8 @@ #define RAND_MAX 2147483647 #endif /* RAND_MAX */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #define SCALE_WIDTH 150 -#define SQR(x) ((x) * (x)) - #define HORIZONTAL 0 #define VERTICAL 1 #define OPAQUE 255 @@ -493,8 +487,8 @@ mosaic (GDrawable *drawable) back[alpha] = OPAQUE; } - light_x = -cos (mvals.light_dir * M_PI / 180.0); - light_y = sin (mvals.light_dir * M_PI / 180.0); + light_x = -cos (mvals.light_dir * G_PI / 180.0); + light_y = sin (mvals.light_dir * G_PI / 180.0); scale = (mvals.tile_spacing > mvals.tile_size / 2.0) ? 0.5 : 1.0 - mvals.tile_spacing / mvals.tile_size; diff --git a/plug-ins/pagecurl/pagecurl.c b/plug-ins/pagecurl/pagecurl.c index d544c9a233..69c02be6f8 100644 --- a/plug-ins/pagecurl/pagecurl.c +++ b/plug-ins/pagecurl/pagecurl.c @@ -48,10 +48,10 @@ * - Exchanged the meaning of FG/BG Color, because mostly the FG * color is darker. */ +#include "config.h" #include #include -#include #include #include @@ -65,10 +65,6 @@ #include "curl7.xpm" #include -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #define PLUG_IN_NAME "plug_in_pagecurl" #define PLUG_IN_VERSION "May 1998, 0.9" #define NGRADSAMPLES 256 @@ -753,7 +749,7 @@ static void init_calculation () { alpha = atan ((double) sel_height / sel_width); beta = alpha / 2.0; - k = sel_width / ((M_PI + alpha) * sin (beta) + cos (beta)); + k = sel_width / ((G_PI + alpha) * sin (beta) + cos (beta)); v_set (¢er, k * cos (beta), k * sin (beta)); radius = center.y; @@ -899,7 +895,7 @@ static void do_curl_effect (void) { /* On the curl */ if (curl.do_curl_gradient) { /* Calculate position in Gradient (0 <= intensity <= 1) */ - intensity = (angle/alpha) + sin(M_PI*2 * angle/alpha)*0.075; + intensity = (angle/alpha) + sin(G_PI*2 * angle/alpha)*0.075; /* Check boundaries */ intensity = (intensity < 0 ? 0 : (intensity > 1 ? 1 : intensity )); gradsamp = &grad_samples[((guint) (intensity * NGRADSAMPLES)) * dest_rgn.bpp]; @@ -911,7 +907,7 @@ static void do_curl_effect (void) { pp[0] = gradsamp[0]; pp[alpha_pos] = (guchar) ((double) gradsamp[alpha_pos] * (1 - intensity*(1-curl.do_curl_opacity))); } else { - intensity = pow (sin (M_PI * angle / alpha), 1.5); + intensity = pow (sin (G_PI * angle / alpha), 1.5); if (color_image) { pp[0] = (intensity * back_color[0] + (1 - intensity) * fore_color[0]); pp[1] = (intensity * back_color[1] + (1 - intensity) * fore_color[1]); diff --git a/plug-ins/sel2path/math.c b/plug-ins/sel2path/math.c index 4460db2f79..c66ee9fb4b 100644 --- a/plug-ins/sel2path/math.c +++ b/plug-ins/sel2path/math.c @@ -16,6 +16,8 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "config.h" + #include #include #include @@ -23,9 +25,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ +#include "libgimp/gimpmath.h" #include "types.h" #include "global.h" @@ -78,7 +78,7 @@ acosd (real v) if (errno == ERANGE || errno == EDOM) FATAL_PERROR ("acosd"); - return a * 180.0 / M_PI; + return a * 180.0 / G_PI; } diff --git a/plug-ins/sel2path/sel2path.c b/plug-ins/sel2path/sel2path.c index d2f5baeba0..7bf802580f 100644 --- a/plug-ins/sel2path/sel2path.c +++ b/plug-ins/sel2path/sel2path.c @@ -46,10 +46,6 @@ #include "sel2path.h" #include "libgimp/stdplugins-intl.h" -#ifndef HAVE_RINT -#define rint(x) floor (x + 0.5) -#endif - #define MID_POINT 127 /***** Magic numbers *****/ @@ -453,11 +449,11 @@ gen_anchor(gdouble *p,double x,double y,int is_newcurve) { /* printf("TYPE: %s X: %d Y: %d\n", */ /* (is_newcurve)?"3":"1", */ -/* sel_x1+(int)rint(x), */ -/* sel_y1 + sel_height - (int)rint(y)+1); */ +/* sel_x1+(int)RINT(x), */ +/* sel_y1 + sel_height - (int)RINT(y)+1); */ - *p++ = (sel_x1+(int)rint(x)); - *p++ = sel_y1 + sel_height - (int)rint(y)+1; + *p++ = (sel_x1+(int)RINT(x)); + *p++ = sel_y1 + sel_height - (int)RINT(y)+1; *p++ = (is_newcurve)?3.0:1.0; } @@ -467,11 +463,11 @@ void gen_control(gdouble *p,double x,double y) { /* printf("TYPE: 2 X: %d Y: %d\n", */ -/* sel_x1+(int)rint(x), */ -/* sel_y1 + sel_height - (int)rint(y)+1); */ +/* sel_x1+(int)RINT(x), */ +/* sel_y1 + sel_height - (int)RINT(y)+1); */ - *p++ = sel_x1+(int)rint(x); - *p++ = sel_y1 + sel_height - (int)rint(y)+1; + *p++ = sel_x1+(int)RINT(x); + *p++ = sel_y1 + sel_height - (int)RINT(y)+1; *p++ = 2.0; } diff --git a/plug-ins/sinus/sinus.c b/plug-ins/sinus/sinus.c index d9203177c0..6444aad979 100644 --- a/plug-ins/sinus/sinus.c +++ b/plug-ins/sinus/sinus.c @@ -30,6 +30,10 @@ #define USE_LOGO +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include @@ -39,18 +43,10 @@ #include #include -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #ifdef USE_LOGO #include "sinus_logo.h" #endif -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif /* M_PI */ - #ifndef RAND_MAX #define RAND_MAX 2147483647 #endif /* RAND_MAX */ @@ -304,32 +300,32 @@ void prepare_coef( params *p) if (svals.perturbation==IDEAL) { p->c11= 0*rand(); p->c12= (2.0*rand()/(RAND_MAX+1.0)-1)*scaley; /*rand+rand is used to keep */ - p->c13= (2*M_PI*rand())/RAND_MAX; + p->c13= (2*G_PI*rand())/RAND_MAX; p->c21= 0*rand(); p->c22= (2.0*rand()/(RAND_MAX+1.0)-1)*scaley; /*correspondance beetween Ideal*/ - p->c23= (2*M_PI*rand())/RAND_MAX; + p->c23= (2*G_PI*rand())/RAND_MAX; p->c31= (2.0*rand()/(RAND_MAX+1.0)-1)*scalex; /*and perturbed coefs (I hope...)*/ p->c32= 0*rand(); - p->c33= (2*M_PI*rand())/RAND_MAX; + p->c33= (2*G_PI*rand())/RAND_MAX; } else { p->c11= (2.0*rand()/(RAND_MAX+1.0)-1)*scalex; p->c12= (2.0*rand()/(RAND_MAX+1.0)-1)*scaley; - p->c13= (2*M_PI*rand())/RAND_MAX; + p->c13= (2*G_PI*rand())/RAND_MAX; p->c21= (2.0*rand()/(RAND_MAX+1.0)-1)*scalex; p->c22= (2.0*rand()/(RAND_MAX+1.0)-1)*scaley; - p->c23= (2*M_PI*rand())/RAND_MAX; + p->c23= (2*G_PI*rand())/RAND_MAX; p->c31= (2.0*rand()/(RAND_MAX+1.0)-1)*scalex; p->c32= (2.0*rand()/(RAND_MAX+1.0)-1)*scaley; - p->c33= (2*M_PI*rand())/RAND_MAX; + p->c33= (2*G_PI*rand())/RAND_MAX; } if (svals.tiling) { - p->c11= ROUND_TO_INT(p->c11/(2*M_PI))*2*M_PI; - p->c12= ROUND_TO_INT(p->c12/(2*M_PI))*2*M_PI; - p->c21= ROUND_TO_INT(p->c21/(2*M_PI))*2*M_PI; - p->c22= ROUND_TO_INT(p->c22/(2*M_PI))*2*M_PI; - p->c31= ROUND_TO_INT(p->c31/(2*M_PI))*2*M_PI; - p->c32= ROUND_TO_INT(p->c32/(2*M_PI))*2*M_PI; + p->c11= ROUND_TO_INT(p->c11/(2*G_PI))*2*G_PI; + p->c12= ROUND_TO_INT(p->c12/(2*G_PI))*2*G_PI; + p->c21= ROUND_TO_INT(p->c21/(2*G_PI))*2*G_PI; + p->c22= ROUND_TO_INT(p->c22/(2*G_PI))*2*G_PI; + p->c31= ROUND_TO_INT(p->c31/(2*G_PI))*2*G_PI; + p->c32= ROUND_TO_INT(p->c32/(2*G_PI))*2*G_PI; } col2.a=255.999*svals.col2[3]; @@ -431,7 +427,7 @@ double bilinear(double v) double cosinus(double v) { - return 0.5-0.5*sin((v+0.25)*M_PI*2); + return 0.5-0.5*sin((v+0.25)*G_PI*2); } diff --git a/po/makefile.msc b/po/makefile.msc index bb084dd8f8..6bc10aa32e 100644 --- a/po/makefile.msc +++ b/po/makefile.msc @@ -5,7 +5,7 @@ # Locale directory. LOCALEDIR = c:\gimp\locale -LANGUAGES= de fi fr hu it ja ko nl no pl ru sv +LANGUAGES= da de fi fr hu it ja ko nl no pl ru sv ################################################################