From 9593e52ef291fdf759d6f652b3b453a832e9d389 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Mon, 12 Jul 2004 16:57:29 +0000 Subject: [PATCH] plug-ins/gfig/gfig-dialog.c plug-ins/gfig/gfig-preview.c 2004-07-12 Sven Neumann * plug-ins/gfig/gfig-dialog.c * plug-ins/gfig/gfig-preview.c * plug-ins/gfig/gfig-style.c * plug-ins/gfig/gfig.c: some include cleanups. Use libgimpbase/gimpwin32-io.h instead of defining W_OK explicitely. Don't undef GTK_DISABLE_DEPRECATED except for gfig-preview.c. --- ChangeLog | 9 ++++++ plug-ins/gfig/gfig-dialog.c | 13 ++------ plug-ins/gfig/gfig-preview.c | 2 +- plug-ins/gfig/gfig-style.c | 21 ++----------- plug-ins/gfig/gfig.c | 60 ++++++++++++++---------------------- 5 files changed, 37 insertions(+), 68 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9e446457b6..37a247a992 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-07-12 Sven Neumann + + * plug-ins/gfig/gfig-dialog.c + * plug-ins/gfig/gfig-preview.c + * plug-ins/gfig/gfig-style.c + * plug-ins/gfig/gfig.c: some include cleanups. Use + libgimpbase/gimpwin32-io.h instead of defining W_OK explicitely. + Don't undef GTK_DISABLE_DEPRECATED except for gfig-preview.c. + 2004-07-12 Michael Natterer * plug-ins/script-fu/scripts/round-corners.scm: applied patch from diff --git a/plug-ins/gfig/gfig-dialog.c b/plug-ins/gfig/gfig-dialog.c index 0404899648..82be1d1738 100644 --- a/plug-ins/gfig/gfig-dialog.c +++ b/plug-ins/gfig/gfig-dialog.c @@ -34,24 +34,15 @@ #include -#ifdef __GNUC__ -#warning GTK_DISABLE_DEPRECATED -#endif -#undef GTK_DISABLE_DEPRECATED - #include #ifdef G_OS_WIN32 -# include -# ifndef W_OK -# define W_OK 2 -# endif +#include #endif #include #include -#include -#include + #include "libgimp/stdplugins-intl.h" #include "gfig.h" diff --git a/plug-ins/gfig/gfig-preview.c b/plug-ins/gfig/gfig-preview.c index e1dddf643e..95e56d077b 100644 --- a/plug-ins/gfig/gfig-preview.c +++ b/plug-ins/gfig/gfig-preview.c @@ -1,4 +1,4 @@ - /* +/* * Copyright (C) 1995 Spencer Kimball and Peter Mattis * * This is a plug-in for the GIMP. diff --git a/plug-ins/gfig/gfig-style.c b/plug-ins/gfig/gfig-style.c index 4c07ac69c2..cdcbc9b890 100644 --- a/plug-ins/gfig/gfig-style.c +++ b/plug-ins/gfig/gfig-style.c @@ -2,37 +2,20 @@ #include #include -#include - -#ifdef HAVE_UNISTD_H -#include -#endif #include -#ifdef __GNUC__ -#warning GTK_DISABLE_DEPRECATED -#endif -#undef GTK_DISABLE_DEPRECATED - #include -#ifdef G_OS_WIN32 -# include -# ifndef W_OK -# define W_OK 2 -# endif -#endif - #include #include -#include -#include + #include "libgimp/stdplugins-intl.h" #include "gfig.h" #include "gfig-style.h" + static void gfig_read_parameter_string (gchar **text, gint nitems, gchar *name, diff --git a/plug-ins/gfig/gfig.c b/plug-ins/gfig/gfig.c index 061a9b7e08..479c9e7fdd 100644 --- a/plug-ins/gfig/gfig.c +++ b/plug-ins/gfig/gfig.c @@ -26,32 +26,18 @@ #include #include +#include #include #ifdef HAVE_UNISTD_H #include #endif -#include - -#ifdef __GNUC__ -#warning GTK_DISABLE_DEPRECATED -#endif -#undef GTK_DISABLE_DEPRECATED - #include -#ifdef G_OS_WIN32 -# include -# ifndef W_OK -# define W_OK 2 -# endif -#endif - #include #include -#include -#include + #include "libgimp/stdplugins-intl.h" #include "gfig.h" @@ -112,7 +98,7 @@ Dobject *tmp_line; /* Needed when drawing lines */ gint need_to_scale; -static gint load_options (GFigObj *gfig, +static gint load_options (GFigObj *gfig, FILE *fp); /* globals */ @@ -209,7 +195,7 @@ run (const gchar *name, pheight = MIN (sel_height, PREVIEW_SIZE); pwidth = sel_width * pheight / sel_height; } - + preview_width = MAX (pwidth, 2); /* Min size is 2 */ preview_height = MAX (pheight, 2); @@ -253,10 +239,10 @@ run (const gchar *name, } gimp_image_undo_group_end (gfig_context->image_id); - + if (run_mode != GIMP_RUN_NONINTERACTIVE) gimp_displays_flush (); - else + else #if 0 if (run_mode == GIMP_RUN_INTERACTIVE) gimp_set_data ("plug_in_gfig", &selvals, sizeof (SelectItVals)); @@ -473,14 +459,14 @@ gfig_load (const gchar *filename, sscanf (load_buf, "Name: %100s", str_buf); gfig_name_decode (load_buf, str_buf); gfig->draw_name = g_strdup (load_buf); - + get_line (load_buf, MAX_LOAD_LINE, fp, 0); if (strncmp (load_buf, "Version: ", 9) == 0) gfig->version = g_ascii_strtod (load_buf + 9, NULL); - + get_line (load_buf, MAX_LOAD_LINE, fp, 0); sscanf (load_buf, "ObjCount: %d", &load_count); - + if (load_options (gfig, fp)) { g_message ("File '%s' corrupt file - Line %d Option section incorrect", @@ -494,22 +480,22 @@ gfig_load (const gchar *filename, gimp_filename_to_utf8 (filename), line_no); return NULL; } - - + + gfig_load_objs (gfig, load_count, fp); - + /* Check count ? */ - + chk_count = gfig_obj_counts (gfig->obj_list); - + if (chk_count != load_count) { g_message ("File '%s' corrupt file - Line %d Object count to small", gimp_filename_to_utf8 (filename), line_no); return NULL; } - + fclose (fp); if (!gfig_context->current_obj) @@ -538,7 +524,7 @@ save_options (GString *string) { g_string_append_printf (string, "GridType: ISO_GRID\n"); } - else + else { g_string_append_printf (string, "GridType: RECT_GRID\n"); /* default to RECT_GRID */ } @@ -550,8 +536,8 @@ save_options (GString *string) g_string_append_printf (string, "\n"); } -static void -gfig_save_obj_start (Dobject *obj, +static void +gfig_save_obj_start (Dobject *obj, GString *string) { g_string_append_printf (string, "<%s ", obj->class->name); @@ -559,8 +545,8 @@ gfig_save_obj_start (Dobject *obj, g_string_append_printf (string, ">\n"); } -static void -gfig_save_obj_end (Dobject *obj, +static void +gfig_save_obj_end (Dobject *obj, GString *string) { g_string_append_printf (string, "\n",obj->class->name); @@ -679,7 +665,7 @@ gfig_save_as_string () GString *string; string = g_string_new (GFIG_HEADER); - + gfig_name_encode (conv_buf, gfig_context->current_obj->draw_name); g_string_append_printf (string, "Name: %s\n", conv_buf); g_string_append_printf (string, "Version: %s\n", @@ -723,11 +709,11 @@ gfig_save_as_parasite () * format has stabilized. */ #if 0 - parasite = gimp_parasite_new ("gfig", GIMP_PARASITE_PERSISTENT | GIMP_PARASITE_UNDOABLE, + parasite = gimp_parasite_new ("gfig", GIMP_PARASITE_PERSISTENT | GIMP_PARASITE_UNDOABLE, datasize, data); #endif - parasite = gimp_parasite_new ("gfig", GIMP_PARASITE_UNDOABLE, + parasite = gimp_parasite_new ("gfig", GIMP_PARASITE_UNDOABLE, string->len, string->str); g_string_free (string, TRUE);