From c27f21f58bd86d305ea99feb5822fa43b52b2126 Mon Sep 17 00:00:00 2001 From: EST 1999 Matt Wilson Date: Sat, 27 Mar 1999 06:15:57 +0000 Subject: [PATCH] removed the idle function from the splash screen, added code that services Sat Mar 27 01:13:42 EST 1999 Matt Wilson * app/app_procs.c: removed the idle function from the splash screen, added code that services the event queue. This reduces flicker in the splash screen. (backport from 1.1) * app/brushes.c: s/gpointer/gconstpointer for hash table functions (backport from 1.1) * app/fileops.c: added #include to get prototype for strtol() * app/gdisplay.c: added a check to see if we have a gdisplay hash table set up before we go looking for the gdisplay for this toplevel widget. (backport from 1.1) * app/interface.c: added a bound check for progress_update (backport from 1.1) * app/main.c: added a cast to make g_set-message_handler happy (backport from 1.1) * app/patterns.c: s/gpointer/gconstpointer for hash table functions (backport from 1.1) * app/plug_in.c: added bounds check for progress bar update * app/procedural_db.c: s/gpointer/gconstpointer for hash table functions, changed to using g_str_equal for comparison (backport from 1.1) * plug-ins/MapObject/mapobject_ui.c: now uses the right widget for adjustment callbacks (backport from 1.1 branch) * plug-ins/dbbrowser/dbbrowser_utils.c: fixed the clist of db functions so that the scrollbar shows, added viewports for non-scrollable description table * plug-ins/gfig/gfig.c: reverted to the gfig version from the 1.0 branch, ported to GTK+ 1.2 * plug-ins/script-fu/script-fu-server.c: set up the clientname hash table to use g_direct_hash (backport from 1.1), added stdlib.h for malloc() prototype. --- ChangeLog | 46 + app/actions/plug-in-commands.c | 31 +- app/app_procs.c | 11 +- app/brushes.c | 26 +- app/core/gimpprojection.c | 8 +- app/display/gimpdisplay.c | 8 +- app/display/gimpdisplayshell-draw.c | 3 + app/display/gimpdisplayshell.c | 3 + app/fileops.c | 1 + app/gdisplay.c | 8 +- app/gui/plug-in-commands.c | 31 +- app/gui/plug-in-menus.c | 31 +- app/interface.c | 3 + app/main.c | 2 +- app/menus/plug-in-menus.c | 31 +- app/patterns.c | 4 +- app/plug-in/gimpplugin-message.c | 31 +- app/plug-in/gimpplugin-progress.c | 31 +- app/plug-in/gimpplugin.c | 31 +- app/plug-in/gimppluginmanager-call.c | 31 +- app/plug-in/gimppluginmanager-run.c | 31 +- app/plug-in/gimppluginmanager.c | 31 +- app/plug-in/gimppluginshm.c | 31 +- app/plug-in/plug-in-def.c | 31 +- app/plug-in/plug-in-message.c | 31 +- app/plug-in/plug-in-params.c | 31 +- app/plug-in/plug-in-progress.c | 31 +- app/plug-in/plug-in-run.c | 31 +- app/plug-in/plug-in-shm.c | 31 +- app/plug-in/plug-in.c | 31 +- app/plug-in/plug-ins.c | 31 +- app/plug_in.c | 31 +- app/procedural_db.c | 15 +- config.h.in | 4 + libgimp/gimp.c | 2 +- libgimp/gimpprocbrowserdialog.c | 10 +- libgimp/gimpprocview.c | 10 +- plug-ins/MapObject/mapobject_ui.c | 4 +- plug-ins/dbbrowser/dbbrowser_utils.c | 10 +- plug-ins/dbbrowser/gimpprocbrowser.c | 10 +- plug-ins/dbbrowser/gimpprocview.c | 10 +- plug-ins/gfig/gfig.c | 1119 ++++++++++++------------- plug-ins/script-fu/script-fu-server.c | 9 +- 43 files changed, 1020 insertions(+), 926 deletions(-) diff --git a/ChangeLog b/ChangeLog index 885eb18258..ec564cf896 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,49 @@ +Sat Mar 27 01:13:42 EST 1999 Matt Wilson + + * app/app_procs.c: removed the idle function from the + splash screen, added code that services the event + queue. This reduces flicker in the splash screen. + (backport from 1.1) + + * app/brushes.c: s/gpointer/gconstpointer for hash table + functions (backport from 1.1) + + * app/fileops.c: added #include to get + prototype for strtol() + + * app/gdisplay.c: added a check to see if we have a gdisplay + hash table set up before we go looking for the gdisplay + for this toplevel widget. (backport from 1.1) + + * app/interface.c: added a bound check for progress_update + (backport from 1.1) + + * app/main.c: added a cast to make g_set-message_handler happy + (backport from 1.1) + + * app/patterns.c: s/gpointer/gconstpointer for hash table + functions (backport from 1.1) + + * app/plug_in.c: added bounds check for progress bar update + + * app/procedural_db.c: s/gpointer/gconstpointer for hash table + functions, changed to using g_str_equal for comparison + (backport from 1.1) + + * plug-ins/MapObject/mapobject_ui.c: now uses the right widget + for adjustment callbacks (backport from 1.1 branch) + + * plug-ins/dbbrowser/dbbrowser_utils.c: fixed the clist of + db functions so that the scrollbar shows, added viewports + for non-scrollable description table + + * plug-ins/gfig/gfig.c: reverted to the gfig version from + the 1.0 branch, ported to GTK+ 1.2 + + * plug-ins/script-fu/script-fu-server.c: set up the clientname + hash table to use g_direct_hash (backport from 1.1), + added stdlib.h for malloc() prototype. + Mon Mar 15 13:13:36 1999 Owen Taylor * plug-ins/xd/xd.c plug-ins/film/film.c: diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index 6114bbaa80..325bd40b4b 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/app_procs.c b/app/app_procs.c index f7f0e57e08..6d32307431 100644 --- a/app/app_procs.c +++ b/app/app_procs.c @@ -305,7 +305,6 @@ static GtkWidget *win_initstatus = NULL; static GtkWidget *label1 = NULL; static GtkWidget *label2 = NULL; static GtkWidget *pbar = NULL; -static gint idle_tag = -1; static void destroy_initialization_status_window(void) @@ -317,7 +316,6 @@ destroy_initialization_status_window(void) gdk_pixmap_unref(logo_pixmap); win_initstatus = label1 = label2 = pbar = logo_area = NULL; logo_pixmap = NULL; - gtk_idle_remove(idle_tag); } } @@ -431,9 +429,12 @@ app_init_update_status(char *label1val, gtk_progress_bar_update(GTK_PROGRESS_BAR(pbar), pct_progress); } gtk_widget_draw(win_initstatus, &area); - idle_tag = gtk_idle_add((GtkFunction) gtk_true, NULL); - gtk_main_iteration(); - gtk_idle_remove(idle_tag); + while (gtk_events_pending()) + gtk_main_iteration(); + /* We sync here to make sure things get drawn before continuing, + * is the improved look worth the time? I'm not sure... + */ + gdk_flush(); } } diff --git a/app/brushes.c b/app/brushes.c index 80ab423a89..24a410e841 100644 --- a/app/brushes.c +++ b/app/brushes.c @@ -58,7 +58,7 @@ static void create_default_brush (void); static void load_brush (char *filename); static void free_brush (GBrushP); static void brushes_free_one (gpointer, gpointer); -static gint brush_compare_func (gpointer, gpointer); +static gint brush_compare_func (gconstpointer, gconstpointer); /* function declarations */ void @@ -91,18 +91,18 @@ brushes_init (int no_data) list = g_slist_next(list); if(list) { GBrushP gb2 = (GBrushP)list->data; - + if(gb_start == NULL) { gb_start = gb; } - + if(gb_start->name && gb2->name && (strcmp(gb_start->name,gb2->name) == 0)) { - + gint b_digits = 2; gint gb_tmp_cnt = gb_count++; - + /* Alter gb2... */ g_free(gb2->name); while((gb_tmp_cnt /= 10) > 0) @@ -116,8 +116,8 @@ brushes_init (int no_data) gb_start = gb2; gb_count = 0; } - } - } + } + } } @@ -129,7 +129,7 @@ brushes_free_one (gpointer data, gpointer dummy) static gint -brush_compare_func (gpointer first, gpointer second) +brush_compare_func (gconstpointer first, gconstpointer second) { return strcmp (((GBrushP)first)->name, ((GBrushP)second)->name); } @@ -370,7 +370,7 @@ create_brush_dialog () else gdk_window_raise(brush_select_dialog->shell->window); } - + } @@ -460,10 +460,10 @@ static Argument * brushes_refresh_brush_invoker (Argument *args) { - /* FIXME: I've hardcoded success to be 1, because brushes_init() is a - * void function right now. It'd be nice if it returned a value at + /* FIXME: I've hardcoded success to be 1, because brushes_init() is a + * void function right now. It'd be nice if it returned a value at * some future date, so we could tell if things blew up when reparsing - * the list (for whatever reason). + * the list (for whatever reason). * - Seth "Yes, this is a kludge" Burgess * */ @@ -526,7 +526,7 @@ ProcRecord brushes_refresh_brush_proc = "gimp_brushes_refresh", "Refresh current brushes", "This procedure retrieves all brushes currently in the user's brush path " - "and updates the brush dialog accordingly.", + "and updates the brush dialog accordingly.", "Seth Burgess", "Seth Burgess", "1997", diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index be65a29063..784f36db9b 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -202,7 +202,7 @@ gdisplay_delete (GDisplay *gdisp) /* free the selection structure */ selection_free (gdisp->select); - + if (gdisp->scroll_gc) gdk_gc_destroy (gdisp->scroll_gc); @@ -1114,7 +1114,7 @@ gdisplay_active () GtkWidget *event_widget; GtkWidget *toplevel_widget; GdkEvent *event; - GDisplay *gdisp; + GDisplay *gdisp = NULL; /* If the popup shell is valid, then get the gdisplay associated with that shell */ event = gtk_get_current_event (); @@ -1125,7 +1125,9 @@ gdisplay_active () return NULL; toplevel_widget = gtk_widget_get_toplevel (event_widget); - gdisp = g_hash_table_lookup (display_ht, toplevel_widget); + + if (display_ht) + gdisp = g_hash_table_lookup (display_ht, toplevel_widget); if (gdisp) return gdisp; diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index be65a29063..784f36db9b 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -202,7 +202,7 @@ gdisplay_delete (GDisplay *gdisp) /* free the selection structure */ selection_free (gdisp->select); - + if (gdisp->scroll_gc) gdk_gc_destroy (gdisp->scroll_gc); @@ -1114,7 +1114,7 @@ gdisplay_active () GtkWidget *event_widget; GtkWidget *toplevel_widget; GdkEvent *event; - GDisplay *gdisp; + GDisplay *gdisp = NULL; /* If the popup shell is valid, then get the gdisplay associated with that shell */ event = gtk_get_current_event (); @@ -1125,7 +1125,9 @@ gdisplay_active () return NULL; toplevel_widget = gtk_widget_get_toplevel (event_widget); - gdisp = g_hash_table_lookup (display_ht, toplevel_widget); + + if (display_ht) + gdisp = g_hash_table_lookup (display_ht, toplevel_widget); if (gdisp) return gdisp; diff --git a/app/display/gimpdisplayshell-draw.c b/app/display/gimpdisplayshell-draw.c index b65430836a..7b462074fe 100644 --- a/app/display/gimpdisplayshell-draw.c +++ b/app/display/gimpdisplayshell-draw.c @@ -1012,6 +1012,9 @@ progress_start () void progress_update (float percentage) { + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + gtk_progress_bar_update (GTK_PROGRESS_BAR (progress_area), percentage); if (GTK_WIDGET_VISIBLE (progress_area)) diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c index b65430836a..7b462074fe 100644 --- a/app/display/gimpdisplayshell.c +++ b/app/display/gimpdisplayshell.c @@ -1012,6 +1012,9 @@ progress_start () void progress_update (float percentage) { + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + gtk_progress_bar_update (GTK_PROGRESS_BAR (progress_area), percentage); if (GTK_WIDGET_VISIBLE (progress_area)) diff --git a/app/fileops.c b/app/fileops.c index bd2a2231f8..a19de0610a 100644 --- a/app/fileops.c +++ b/app/fileops.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "appenv.h" #include "actionarea.h" diff --git a/app/gdisplay.c b/app/gdisplay.c index be65a29063..784f36db9b 100644 --- a/app/gdisplay.c +++ b/app/gdisplay.c @@ -202,7 +202,7 @@ gdisplay_delete (GDisplay *gdisp) /* free the selection structure */ selection_free (gdisp->select); - + if (gdisp->scroll_gc) gdk_gc_destroy (gdisp->scroll_gc); @@ -1114,7 +1114,7 @@ gdisplay_active () GtkWidget *event_widget; GtkWidget *toplevel_widget; GdkEvent *event; - GDisplay *gdisp; + GDisplay *gdisp = NULL; /* If the popup shell is valid, then get the gdisplay associated with that shell */ event = gtk_get_current_event (); @@ -1125,7 +1125,9 @@ gdisplay_active () return NULL; toplevel_widget = gtk_widget_get_toplevel (event_widget); - gdisp = g_hash_table_lookup (display_ht, toplevel_widget); + + if (display_ht) + gdisp = g_hash_table_lookup (display_ht, toplevel_widget); if (gdisp) return gdisp; diff --git a/app/gui/plug-in-commands.c b/app/gui/plug-in-commands.c index 6114bbaa80..325bd40b4b 100644 --- a/app/gui/plug-in-commands.c +++ b/app/gui/plug-in-commands.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/gui/plug-in-menus.c b/app/gui/plug-in-menus.c index 6114bbaa80..325bd40b4b 100644 --- a/app/gui/plug-in-menus.c +++ b/app/gui/plug-in-menus.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/interface.c b/app/interface.c index b65430836a..7b462074fe 100644 --- a/app/interface.c +++ b/app/interface.c @@ -1012,6 +1012,9 @@ progress_start () void progress_update (float percentage) { + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + gtk_progress_bar_update (GTK_PROGRESS_BAR (progress_area), percentage); if (GTK_WIDGET_VISIBLE (progress_area)) diff --git a/app/main.c b/app/main.c index 31274ae17d..618886ae2d 100644 --- a/app/main.c +++ b/app/main.c @@ -233,7 +233,7 @@ main (int argc, char **argv) if (show_version || show_help) exit (0); - g_set_message_handler (&message_func); + g_set_message_handler ((GPrintFunc) message_func); /* Handle some signals */ signal (SIGHUP, on_signal); diff --git a/app/menus/plug-in-menus.c b/app/menus/plug-in-menus.c index 6114bbaa80..325bd40b4b 100644 --- a/app/menus/plug-in-menus.c +++ b/app/menus/plug-in-menus.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/patterns.c b/app/patterns.c index 114815e2ea..a0976e9e3b 100644 --- a/app/patterns.c +++ b/app/patterns.c @@ -53,7 +53,7 @@ static GSList * insert_pattern_in_list (GSList *, GPatternP); static void load_pattern (char *filename); static void free_pattern (GPatternP); static void pattern_free_one (gpointer, gpointer); -static gint pattern_compare_func (gpointer, gpointer); +static gint pattern_compare_func (gconstpointer, gconstpointer); /* function declarations */ @@ -92,7 +92,7 @@ pattern_free_one (gpointer data, gpointer dummy) } static gint -pattern_compare_func(gpointer first, gpointer second) +pattern_compare_func(gconstpointer first, gconstpointer second) { return strcmp (((GPatternP)first)->name, ((GPatternP)second)->name); } diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug-in/gimpplugin-progress.c +++ b/app/plug-in/gimpplugin-progress.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug-in/gimppluginmanager.c +++ b/app/plug-in/gimppluginmanager.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/plug-in/gimppluginshm.c b/app/plug-in/gimppluginshm.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug-in/gimppluginshm.c +++ b/app/plug-in/gimppluginshm.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/plug-in/plug-in-def.c b/app/plug-in/plug-in-def.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug-in/plug-in-def.c +++ b/app/plug-in/plug-in-def.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/plug-in/plug-in-message.c b/app/plug-in/plug-in-message.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug-in/plug-in-message.c +++ b/app/plug-in/plug-in-message.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/plug-in/plug-in-params.c b/app/plug-in/plug-in-params.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug-in/plug-in-params.c +++ b/app/plug-in/plug-in-params.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/plug-in/plug-in-progress.c b/app/plug-in/plug-in-progress.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug-in/plug-in-progress.c +++ b/app/plug-in/plug-in-progress.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/plug-in/plug-in-shm.c b/app/plug-in/plug-in-shm.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug-in/plug-in-shm.c +++ b/app/plug-in/plug-in-shm.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/plug-in/plug-in.c b/app/plug-in/plug-in.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug-in/plug-in.c +++ b/app/plug-in/plug-in.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/plug-in/plug-ins.c b/app/plug-in/plug-ins.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug-in/plug-ins.c +++ b/app/plug-in/plug-ins.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/plug_in.c b/app/plug_in.c index 6114bbaa80..325bd40b4b 100644 --- a/app/plug_in.c +++ b/app/plug_in.c @@ -445,7 +445,7 @@ plug_in_kill () { GSList *tmp; PlugIn *plug_in; - + #ifdef HAVE_SHM_H #ifndef IPC_RMID_DEFERRED_RELEASE if (shm_ID != -1) @@ -458,7 +458,7 @@ plug_in_kill () shmdt ((char*) shm_addr); #endif #endif - + tmp = open_plug_ins; while (tmp) { @@ -1048,7 +1048,7 @@ plug_in_get_current_return_vals (ProcRecord *proc_rec) Argument* plug_in_run (ProcRecord *proc_rec, Argument *args, - int synchronous, + int synchronous, int destroy_values) { GPConfig config; @@ -1112,12 +1112,12 @@ plug_in_run (ProcRecord *proc_rec, if (plug_in->recurse) { gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); } } } - + done: if (return_vals && destroy_values) { @@ -1220,7 +1220,7 @@ plug_in_recv_message (gpointer data, memset (&msg, 0, sizeof (WireMessage)); if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -1615,22 +1615,22 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) * Sanity check for array arguments */ - for (i = 1; i < proc_install->nparams; i++) + for (i = 1; i < proc_install->nparams; i++) { if ((proc_install->params[i].type == PDB_INT32ARRAY || proc_install->params[i].type == PDB_INT8ARRAY || proc_install->params[i].type == PDB_FLOATARRAY || proc_install->params[i].type == PDB_STRINGARRAY) && - proc_install->params[i-1].type != PDB_INT32) + proc_install->params[i-1].type != PDB_INT32) { g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " - "passing standard. Argument %d is noncompliant.", + "passing standard. Argument %d is noncompliant.", current_plug_in->args[0], proc_install->name, i); return; } } - + /* * Initialization @@ -2071,7 +2071,7 @@ plug_in_query (char *filename, { if (!wire_read_msg (current_readfd, &msg)) plug_in_close (current_plug_in, TRUE); - else + else { plug_in_handle_message (&msg); wire_destroy (&msg); @@ -2416,7 +2416,7 @@ plug_in_temp_run (ProcRecord *proc_rec, plug_in->recurse = TRUE; gtk_main (); - + return_vals = plug_in_get_current_return_vals (proc_rec); plug_in->recurse = old_recurse; plug_in->busy = FALSE; @@ -3026,6 +3026,9 @@ plug_in_progress_update (PlugIn *plug_in, double percentage) { #ifdef SEPARATE_PROGRESS_BAR + if (!(percentage >= 0.0 && percentage <= 1.0)) + return; + if (!plug_in->progress) plug_in_progress_init (plug_in, NULL); @@ -3086,12 +3089,12 @@ static Argument* message_handler_set_invoker (Argument *args) { int success = TRUE; - + if ((args[0].value.pdb_int >= MESSAGE_BOX) && (args[0].value.pdb_int <= CONSOLE)) message_handler = args[0].value.pdb_int; else success = FALSE; - + return procedural_db_return_args (&message_handler_set_proc, success); } diff --git a/app/procedural_db.c b/app/procedural_db.c index cd3d007f9e..6f009d89af 100644 --- a/app/procedural_db.c +++ b/app/procedural_db.c @@ -66,9 +66,7 @@ static Argument * procedural_db_set_data (Argument *); static Argument * procedural_db_query (Argument *); static void procedural_db_query_entry (gpointer, gpointer, gpointer); static int match_strings (regex_t *, char *); -static guint procedural_db_hash_func (gpointer key); -static gint procedural_db_compare_func (gpointer a, gpointer b); - +static guint procedural_db_hash_func (gconstpointer key); /* Local data */ static GHashTable *procedural_ht = NULL; @@ -485,7 +483,7 @@ procedural_db_init () app_init_update_status("Procedural Database", NULL, -1); if (!procedural_ht) procedural_ht = g_hash_table_new (procedural_db_hash_func, - procedural_db_compare_func); + g_str_equal); } void @@ -1128,7 +1126,7 @@ match_strings (regex_t * preg, } static guint -procedural_db_hash_func (gpointer key) +procedural_db_hash_func (gconstpointer key) { gchar *string; guint result; @@ -1172,9 +1170,4 @@ procedural_db_hash_func (gpointer key) return result; } -static gint -procedural_db_compare_func (gpointer a, - gpointer b) -{ - return (strcmp ((char *) a, (char *) b) == 0); -} + diff --git a/config.h.in b/config.h.in index bdf835472f..d9ac81d2ca 100644 --- a/config.h.in +++ b/config.h.in @@ -82,3 +82,7 @@ /* Define if you have the header file. */ #undef HAVE_SYS_NDIR_H + +/* define if compiled symbols have a leading underscore */ +#undef WITH_SYMBOL_UNDERSCORE + diff --git a/libgimp/gimp.c b/libgimp/gimp.c index c8115d0125..78a2c5738f 100644 --- a/libgimp/gimp.c +++ b/libgimp/gimp.c @@ -120,7 +120,7 @@ gimp_main (int argc, return 0; } - g_set_message_handler (&gimp_message_func); + g_set_message_handler ((GPrintFunc) gimp_message_func); temp_proc_ht = g_hash_table_new (&g_str_hash, &g_str_equal); diff --git a/libgimp/gimpprocbrowserdialog.c b/libgimp/gimpprocbrowserdialog.c index 0f9795093b..4f0090f297 100644 --- a/libgimp/gimpprocbrowserdialog.c +++ b/libgimp/gimpprocbrowserdialog.c @@ -22,6 +22,8 @@ 0.08 26th sept 97 by Thomas NOEL */ +#include + #include "dbbrowser_utils.h" GList *proc_table; @@ -92,8 +94,7 @@ gimp_db_browser(void (* apply_callback) ( gchar *selected_proc_name, gtk_signal_connect (GTK_OBJECT (dbbrowser->clist), "select_row", (GtkSignalFunc) procedure_select_callback, dbbrowser); - gtk_box_pack_start (GTK_BOX (vbox), - dbbrowser->clist, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (vbox), dbbrowser->scrolled_win, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (dbbrowser->scrolled_win), dbbrowser->clist); gtk_widget_show(dbbrowser->clist); gtk_widget_show(dbbrowser->scrolled_win); @@ -452,8 +453,9 @@ dialog_select (dbbrowser_t *dbbrowser, if (old_table) gtk_widget_destroy(old_table); - gtk_container_add (GTK_CONTAINER (dbbrowser->descr_scroll), - dbbrowser->descr_table ); + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (dbbrowser->descr_scroll), + dbbrowser->descr_table); + gtk_widget_show(dbbrowser->descr_table); } diff --git a/libgimp/gimpprocview.c b/libgimp/gimpprocview.c index 0f9795093b..4f0090f297 100644 --- a/libgimp/gimpprocview.c +++ b/libgimp/gimpprocview.c @@ -22,6 +22,8 @@ 0.08 26th sept 97 by Thomas NOEL */ +#include + #include "dbbrowser_utils.h" GList *proc_table; @@ -92,8 +94,7 @@ gimp_db_browser(void (* apply_callback) ( gchar *selected_proc_name, gtk_signal_connect (GTK_OBJECT (dbbrowser->clist), "select_row", (GtkSignalFunc) procedure_select_callback, dbbrowser); - gtk_box_pack_start (GTK_BOX (vbox), - dbbrowser->clist, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (vbox), dbbrowser->scrolled_win, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (dbbrowser->scrolled_win), dbbrowser->clist); gtk_widget_show(dbbrowser->clist); gtk_widget_show(dbbrowser->scrolled_win); @@ -452,8 +453,9 @@ dialog_select (dbbrowser_t *dbbrowser, if (old_table) gtk_widget_destroy(old_table); - gtk_container_add (GTK_CONTAINER (dbbrowser->descr_scroll), - dbbrowser->descr_table ); + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (dbbrowser->descr_scroll), + dbbrowser->descr_table); + gtk_widget_show(dbbrowser->descr_table); } diff --git a/plug-ins/MapObject/mapobject_ui.c b/plug-ins/MapObject/mapobject_ui.c index 4afba5610b..b15c742cb7 100644 --- a/plug-ins/MapObject/mapobject_ui.c +++ b/plug-ins/MapObject/mapobject_ui.c @@ -131,7 +131,7 @@ void angle_update(GtkWidget *widget, GtkScale *scale) GtkAdjustment *adjustment; valueptr=(gdouble *)gtk_object_get_data(GTK_OBJECT(widget),"ValuePtr"); - adjustment=gtk_range_get_adjustment(GTK_RANGE(scale)); + adjustment=gtk_range_get_adjustment(GTK_RANGE(widget)); *valueptr=(gdouble)adjustment->value; @@ -169,7 +169,7 @@ void scale_update(GtkWidget *widget,GtkScale *scale) GtkAdjustment *adjustment; valueptr=(gdouble *)gtk_object_get_data(GTK_OBJECT(widget),"ValuePtr"); - adjustment=gtk_range_get_adjustment(GTK_RANGE(scale)); + adjustment=gtk_range_get_adjustment(GTK_RANGE(widget)); *valueptr=(gdouble)adjustment->value; } diff --git a/plug-ins/dbbrowser/dbbrowser_utils.c b/plug-ins/dbbrowser/dbbrowser_utils.c index 0f9795093b..4f0090f297 100644 --- a/plug-ins/dbbrowser/dbbrowser_utils.c +++ b/plug-ins/dbbrowser/dbbrowser_utils.c @@ -22,6 +22,8 @@ 0.08 26th sept 97 by Thomas NOEL */ +#include + #include "dbbrowser_utils.h" GList *proc_table; @@ -92,8 +94,7 @@ gimp_db_browser(void (* apply_callback) ( gchar *selected_proc_name, gtk_signal_connect (GTK_OBJECT (dbbrowser->clist), "select_row", (GtkSignalFunc) procedure_select_callback, dbbrowser); - gtk_box_pack_start (GTK_BOX (vbox), - dbbrowser->clist, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (vbox), dbbrowser->scrolled_win, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (dbbrowser->scrolled_win), dbbrowser->clist); gtk_widget_show(dbbrowser->clist); gtk_widget_show(dbbrowser->scrolled_win); @@ -452,8 +453,9 @@ dialog_select (dbbrowser_t *dbbrowser, if (old_table) gtk_widget_destroy(old_table); - gtk_container_add (GTK_CONTAINER (dbbrowser->descr_scroll), - dbbrowser->descr_table ); + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (dbbrowser->descr_scroll), + dbbrowser->descr_table); + gtk_widget_show(dbbrowser->descr_table); } diff --git a/plug-ins/dbbrowser/gimpprocbrowser.c b/plug-ins/dbbrowser/gimpprocbrowser.c index 0f9795093b..4f0090f297 100644 --- a/plug-ins/dbbrowser/gimpprocbrowser.c +++ b/plug-ins/dbbrowser/gimpprocbrowser.c @@ -22,6 +22,8 @@ 0.08 26th sept 97 by Thomas NOEL */ +#include + #include "dbbrowser_utils.h" GList *proc_table; @@ -92,8 +94,7 @@ gimp_db_browser(void (* apply_callback) ( gchar *selected_proc_name, gtk_signal_connect (GTK_OBJECT (dbbrowser->clist), "select_row", (GtkSignalFunc) procedure_select_callback, dbbrowser); - gtk_box_pack_start (GTK_BOX (vbox), - dbbrowser->clist, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (vbox), dbbrowser->scrolled_win, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (dbbrowser->scrolled_win), dbbrowser->clist); gtk_widget_show(dbbrowser->clist); gtk_widget_show(dbbrowser->scrolled_win); @@ -452,8 +453,9 @@ dialog_select (dbbrowser_t *dbbrowser, if (old_table) gtk_widget_destroy(old_table); - gtk_container_add (GTK_CONTAINER (dbbrowser->descr_scroll), - dbbrowser->descr_table ); + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (dbbrowser->descr_scroll), + dbbrowser->descr_table); + gtk_widget_show(dbbrowser->descr_table); } diff --git a/plug-ins/dbbrowser/gimpprocview.c b/plug-ins/dbbrowser/gimpprocview.c index 0f9795093b..4f0090f297 100644 --- a/plug-ins/dbbrowser/gimpprocview.c +++ b/plug-ins/dbbrowser/gimpprocview.c @@ -22,6 +22,8 @@ 0.08 26th sept 97 by Thomas NOEL */ +#include + #include "dbbrowser_utils.h" GList *proc_table; @@ -92,8 +94,7 @@ gimp_db_browser(void (* apply_callback) ( gchar *selected_proc_name, gtk_signal_connect (GTK_OBJECT (dbbrowser->clist), "select_row", (GtkSignalFunc) procedure_select_callback, dbbrowser); - gtk_box_pack_start (GTK_BOX (vbox), - dbbrowser->clist, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (vbox), dbbrowser->scrolled_win, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (dbbrowser->scrolled_win), dbbrowser->clist); gtk_widget_show(dbbrowser->clist); gtk_widget_show(dbbrowser->scrolled_win); @@ -452,8 +453,9 @@ dialog_select (dbbrowser_t *dbbrowser, if (old_table) gtk_widget_destroy(old_table); - gtk_container_add (GTK_CONTAINER (dbbrowser->descr_scroll), - dbbrowser->descr_table ); + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (dbbrowser->descr_scroll), + dbbrowser->descr_table); + gtk_widget_show(dbbrowser->descr_table); } diff --git a/plug-ins/gfig/gfig.c b/plug-ins/gfig/gfig.c index e476ec8d08..275f2de23c 100644 --- a/plug-ins/gfig/gfig.c +++ b/plug-ins/gfig/gfig.c @@ -20,28 +20,28 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * * Some of this code was taken from the Whirl plug-in * which was copyrighted by Federico Mena Quintero (as below). - * + * * Whirl plug-in --- distort an image into a whirlpool - * Copyright (C) 1997 Federico Mena Quintero + * Copyright (C) 1997 Federico Mena Quintero * */ /* Change log:- - * 0.9 First public release. + * 0.9 First public release. * 0.95 Second release. - * + * * 0.96 Added patch from Rob Saunders that introduces a isometric type grid * Removed use of gtk_idle* stuff on position update. Not required. * - * 1.0 Fixed to work with the new gtk+-0.99.4 (tooltips stuff has changed). - * + * 1.0 Fixed to work with the new gtk+-0.99.4 (tooltips stuff has changed). + * * 1.1 Fixed crashes when objects not fully defined - * + * * 1.2 More bug fixes and prevent gtk warning when creating new figs - * + * * 1.3 Portability fixes and fixed bug reports 257 and 258 from and 81 & 101 & 133 * http://www.wilberworks.com/bugs.cgi */ @@ -54,10 +54,8 @@ #include #include #include -#include -#include +#include "gtk/gtk.h" #include "libgimp/gimp.h" -#include "libgimp/gimpui.h" #include "pix_data.h" @@ -65,7 +63,7 @@ * following #define */ -#define HAVE_PATCHED 1 +#define HAVE_PATCHED 1 #ifdef HAVE_PATCHED #define GFIG_LCC 1 @@ -115,7 +113,7 @@ GDK_BUTTON_RELEASE_MASK | \ GDK_BUTTON_MOTION_MASK | \ GDK_KEY_PRESS_MASK | \ - GDK_KEY_RELEASE_MASK + GDK_KEY_RELEASE_MASK GDrawable *gfig_select_drawable; GtkWidget *gfig_preview; @@ -126,7 +124,7 @@ GdkPixmap *gfig_pixmap; gint32 gfig_image; gint32 gfig_drawable; GtkWidget *brush_page_pw; -GtkWidget *brush_sel_button; + static gint tile_width, tile_height; static gint img_width, img_height,img_bpp,real_img_bpp; @@ -187,6 +185,9 @@ static void find_grid_pos(GdkPoint *p,GdkPoint *gp, guint state); static gint brush_list_button_press(GtkWidget *widget,GdkEventButton *event,gpointer data); static gint calculate_point_to_line_distance(GdkPoint *p, GdkPoint *A, GdkPoint *B, GdkPoint *I); +/* gtk private function forward declaration */ +gchar * gdk_pixmap_extract_color (gchar *buffer); + GPlugInInfo PLUG_IN_INFO = { NULL, /* init_proc */ @@ -250,7 +251,7 @@ typedef enum BrshType { #define GRID_TYPE_MENU 1 #define GRID_RENDER_MENU 2 -#define GRID_IGNORE 0 +#define GRID_IGNORE 0 #define GRID_HIGHTLIGHT 1 #define GRID_RESTORE 2 @@ -295,7 +296,7 @@ typedef struct GfigOptWidgets static GFIGOPTWIDGETS gfig_opt_widget; -typedef struct SelectItVals +typedef struct SelectItVals { GFIGOPTS opts; gint showimage; @@ -349,9 +350,9 @@ typedef enum Selection_Type { REPLACE=2, INTERSECT=3 } SELECTION_TYPE; + - -typedef enum Arc_Type { +typedef enum Arc_Type { ARC_SEGMENT, ARC_SECTOR } ARC_TYPE; @@ -436,7 +437,7 @@ static DOBJECT *tmp_line; /* Needed when drawing lines */ static DOBJECT *tmp_bezier; /* Neeed when drawing bezier curves */ typedef struct DAllObjs { - struct DAllObjs * next; + struct DAllObjs * next; DOBJECT * obj; /* Object on list */ } DALLOBJS; @@ -456,7 +457,7 @@ typedef struct DFigObj { GtkWidget *list_item; GtkWidget *label_widget; GtkWidget *pixmap_widget; -} GFIGOBJ; +} GFIGOBJ; typedef struct BrushDesc { @@ -495,7 +496,7 @@ static gint drawing_pic = FALSE; /* If true drawing to the small preview */ GtkWidget *status_label_dname; GtkWidget *status_label_fname; GFIGOBJ * gfig_obj_for_menu; /* More static data - need to know which object was selected*/ -GtkWidget *save_menu_item; +GtkWidget *save_menu_item; GtkWidget *save_button; GtkTooltips *gfig_tooltips; /* Central tool tips bit */ @@ -606,7 +607,7 @@ query () { PARAM_INT32, "run_mode", "Interactive, non-interactive" }, { PARAM_IMAGE, "image", "Input image (unused)" }, { PARAM_DRAWABLE, "drawable", "Input drawable" }, - { PARAM_INT32, "dummy", "dummy" } + { PARAM_INT32, "dummy", "dummy" } }; static GParamDef *return_vals = NULL; static int nargs = sizeof (args) / sizeof (args[0]); @@ -651,8 +652,8 @@ run (gchar *name, values[0].type = PARAM_STATUS; values[0].data.d_status = status; - gfig_select_drawable = - drawable = + gfig_select_drawable = + drawable = gimp_drawable_get (param[2].data.d_drawable); tile_width = gimp_tile_width(); @@ -667,7 +668,7 @@ run (gchar *name, sel_height = sel_y2 - sel_y1; /* Calculate preview size */ - + if (sel_width > sel_height) { pwidth = MIN(sel_width, PREVIEW_SIZE); pheight = sel_height * pwidth / sel_width; @@ -675,13 +676,13 @@ run (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); + preview_height = MAX(pheight, 2); org_scale_x_factor = scale_x_factor = (gdouble)sel_width/(gdouble)preview_width; org_scale_y_factor = scale_y_factor = (gdouble)sel_height/(gdouble)preview_height; - + switch (run_mode) { case RUN_INTERACTIVE: @@ -712,7 +713,7 @@ run (gchar *name, gimp_tile_cache_ntiles((drawable->width + gimp_tile_width() - 1) / gimp_tile_width()); do_gfig(); - + if (run_mode != RUN_NONINTERACTIVE) gimp_displays_flush (); @@ -733,7 +734,7 @@ run (gchar *name, /* From testgtk */ static void -ok_warn_window(GtkWidget * widget, +ok_warn_window(GtkWidget * widget, gpointer data) { gtk_widget_destroy (GTK_WIDGET (data)); @@ -750,7 +751,7 @@ create_warn_dialog (gchar *msg) gtk_window_set_title (GTK_WINDOW (window), "Warning"); gtk_container_border_width (GTK_CONTAINER (window), 0); - + button = gtk_button_new_with_label ("OK"); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) ok_warn_window, @@ -774,14 +775,14 @@ gfig_clear_selection(gint32 image_ID) GParam *return_vals; int nreturn_vals; - /* Clear any selection - needed because drawing circles/ellipses + /* Clear any selection - needed because drawing circles/ellipses * uses the selection method and will confuse the output. */ return_vals = gimp_run_procedure ("gimp_selection_clear", &nreturn_vals, PARAM_IMAGE, image_ID, PARAM_END); - + gimp_destroy_params (return_vals, nreturn_vals); } @@ -803,17 +804,17 @@ plug_in_parse_gfig_path() struct stat filestat; gint err; gchar buf[256]; - + if(gfig_path_list) g_list_free(gfig_path_list); - + gfig_path_list = NULL; - + return_vals = gimp_run_procedure ("gimp_gimprc_query", &nreturn_vals, PARAM_STRING, "gfig-path", PARAM_END); - + if (return_vals[0].data.d_status != STATUS_SUCCESS || return_vals[1].data.d_string == NULL) { g_warning("No gfig-path in gimprc: gfig_path_list is NULL\nSee README file"); @@ -827,10 +828,10 @@ plug_in_parse_gfig_path() gimp_destroy_params (return_vals, nreturn_vals); return; } - + path_string = g_strdup (return_vals[1].data.d_string); gimp_destroy_params (return_vals, nreturn_vals); - + /* Set local path to contain temp_path, where (supposedly) * there may be working files. */ @@ -946,11 +947,11 @@ gfig_list_pos(GFIGOBJ *gfig) n = 0; tmp = gfig_list; - - while (tmp) + + while (tmp) { g = tmp->data; - + if (strcmp (gfig->draw_name, g->draw_name) <= 0) break; n++; @@ -1071,7 +1072,7 @@ gfig_list_load_all(GList *plist) if (!err && S_ISREG (filestat.st_mode)) { gfig = gfig_load (filename, dir_ent->d_name); - + if (gfig) { /* Read only ?*/ @@ -1121,7 +1122,7 @@ gfig_load_objs(GFIGOBJ *gfig,gint load_count,FILE *fp) { obj = NULL; get_line(load_buf,MAX_LOAD_LINE,fp,0); - + if(!strcmp(load_buf,"")) { obj = d_load_line(fp); @@ -1158,7 +1159,7 @@ gfig_load_objs(GFIGOBJ *gfig,gint load_count,FILE *fp) { g_warning("Unknown obj type file %s line %d\n",gfig->filename,line_no); } - + if(obj) { add_to_all_obj(gfig,obj); @@ -1175,7 +1176,7 @@ gfig_load (gchar *filename, gchar *name) gchar str_buf[MAX_LOAD_LINE]; gint chk_count; gint load_count = 0; - + g_assert (filename != NULL); #ifdef DEBUG @@ -1210,7 +1211,7 @@ gfig_load (gchar *filename, gchar *name) create_warn_dialog(err); return(NULL); } - + get_line(load_buf,MAX_LOAD_LINE,fp,0); sscanf(load_buf,"Name: %100s",str_buf); gfig_name_decode(load_buf,str_buf); @@ -1239,7 +1240,7 @@ gfig_load (gchar *filename, gchar *name) gfig_load_objs(gfig,load_count,fp); /* Check count ? */ - + chk_count = gfig_obj_counts(gfig->obj_list); if(chk_count != load_count) @@ -1335,24 +1336,24 @@ update_options(GFIGOBJ *old_obj) } if(selvals.opts.drawgrid != current_obj->opts.drawgrid) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gfig_opt_widget.drawgrid),current_obj->opts.drawgrid); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (gfig_opt_widget.drawgrid),current_obj->opts.drawgrid); } if(selvals.opts.snap2grid != current_obj->opts.snap2grid) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gfig_opt_widget.snap2grid),current_obj->opts.snap2grid); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (gfig_opt_widget.snap2grid),current_obj->opts.snap2grid); } if(selvals.opts.lockongrid != current_obj->opts.lockongrid) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gfig_opt_widget.lockongrid),current_obj->opts.lockongrid); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (gfig_opt_widget.lockongrid),current_obj->opts.lockongrid); } if(selvals.opts.showcontrol != current_obj->opts.showcontrol) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gfig_opt_widget.showcontrol),current_obj->opts.showcontrol); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (gfig_opt_widget.showcontrol),current_obj->opts.showcontrol); } if(selvals.opts.gridtype != current_obj->opts.gridtype) { gtk_option_menu_set_history (GTK_OPTION_MENU (gfig_opt_widget.gridtypemenu), - current_obj->opts.gridtype); + current_obj->opts.gridtype); gridtype_menu_callback( gtk_menu_get_active( @@ -1386,7 +1387,7 @@ load_options(GFIGOBJ *gfig,FILE *fp) if(strcmp(load_buf,"")) return(-1); - + get_line(load_buf,MAX_LOAD_LINE,fp,0); #ifdef DEBUG @@ -1454,7 +1455,7 @@ load_options(GFIGOBJ *gfig,FILE *fp) #ifdef DEBUG printf("opt line '%s'\n",load_buf); #endif /* DEBUG */ - } + } return(0); } @@ -1484,7 +1485,7 @@ gfig_save_callbk() savename = current_obj->filename; fp = fopen (savename, "w+"); - + if (!fp) { gchar errbuf[256]; @@ -1496,9 +1497,9 @@ gfig_save_callbk() /* Write header out */ fputs(GFIG_HEADER,fp); - - /* - * draw_name + + /* + * draw_name * version * obj_list * @@ -1512,7 +1513,7 @@ gfig_save_callbk() count = gfig_obj_counts(objs); fprintf(fp,"ObjCount: %d\n",count); - + save_options(fp); objs = current_obj->obj_list; @@ -1560,14 +1561,14 @@ file_selection_ok (GtkWidget *w, /* Check if directory exists */ err = stat (filenamebuf, &filestat); - + if (!err && S_ISDIR (filestat.st_mode)) { /* Can't save to directory */ create_warn_dialog("Save:- Can't save to a directory"); return; } - + obj->filename = g_strdup(filenamebuf); real_current = current_obj; @@ -1660,7 +1661,6 @@ typedef struct gint transparent; } _GdkPixmapColor; - static gchar* my_gdk_pixmap_skip_whitespaces (gchar *buffer) { @@ -1716,7 +1716,7 @@ my_gdk_pixmap_extract_color (gchar *buffer) else if (ptr[0] == '#') { counter = 1; - while (ptr[counter] != 0 && + while (ptr[counter] != 0 && ((ptr[counter] >= '0' && ptr[counter] <= '9') || (ptr[counter] >= 'a' && ptr[counter] <= 'f') || (ptr[counter] >= 'A' && ptr[counter] <= 'F'))) @@ -1726,7 +1726,7 @@ my_gdk_pixmap_extract_color (gchar *buffer) strncpy (retcol, ptr, counter); retcol[counter] = 0; - + return retcol; } @@ -1911,10 +1911,10 @@ cache_preview() gimp_pixel_rgn_init(&src_rgn,gfig_select_drawable,sel_x1,sel_y1,sel_width,sel_height,FALSE,FALSE); - src_rows = g_new(guchar ,sel_width*4); + src_rows = g_new(guchar ,sel_width*4); p = pv_cache = g_new(guchar ,preview_width*preview_height*4); - real_img_bpp = gimp_drawable_bpp(gfig_select_drawable->id); + real_img_bpp = gimp_drawable_bpp(gfig_select_drawable->id); has_alpha = gimp_drawable_has_alpha(gfig_select_drawable->id); @@ -1939,18 +1939,18 @@ cache_preview() /*memset(p,-1,preview_width*preview_height*4); return;*/ for (y = 0; y < preview_height; y++) { - + gimp_pixel_rgn_get_row(&src_rgn, src_rows, sel_x1, sel_y1 + (y*sel_height)/preview_height, sel_width); - + for (x = 0; x < (preview_width); x ++) { /* Get the pixels of each col */ int i; for (i = 0 ; i < 3; i++ ) - p[x*img_bpp+i] = src_rows[((x*sel_width)/preview_width)*src_rgn.bpp +((isgrey)?0:i)]; + p[x*img_bpp+i] = src_rows[((x*sel_width)/preview_width)*src_rgn.bpp +((isgrey)?0:i)]; if(has_alpha) p[x*img_bpp+3] = src_rows[((x*sel_width)/preview_width)*src_rgn.bpp + ((isgrey)?1:3)]; } @@ -1964,8 +1964,8 @@ refill_cache() { GdkCursorType ctype1 = GDK_WATCH; GdkCursorType ctype2 = GDK_TOP_LEFT_ARROW; - static GdkCursor *preview_cursor1; - static GdkCursor *preview_cursor2; + static GdkCursor *preview_cursor1; + static GdkCursor *preview_cursor2; if(!preview_cursor1) preview_cursor1 = gdk_cursor_new(ctype1); @@ -2075,7 +2075,7 @@ gfig_obj_modified(GFIGOBJ *obj,gint stat_type) /* Set the new one up */ if(stat_type == GFIG_MODIFIED) gfig_set_pixmap(obj,Floppy6_xpm); - else + else gfig_set_pixmap(obj,blank_xpm); /* Remove old */ @@ -2173,11 +2173,11 @@ but_with_pix(char **pixdata, GSList **group, gint baction) button = gtk_radio_button_new(*group); gtk_container_border_width (GTK_CONTAINER (button), 0); - gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE); + gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE); gtk_signal_connect (GTK_OBJECT (button), "toggled", (GtkSignalFunc) toggle_obj_type, (gpointer)baction); - + gtk_widget_show(button); *group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); @@ -2241,7 +2241,7 @@ small_preview(GtkWidget * list) gtk_signal_connect (GTK_OBJECT (button), "button_press_event", (GtkSignalFunc) edit_button_press, (gpointer) list); - gtk_tooltips_set_tip(gfig_tooltips,button,"Edit Gfig object collection",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Edit Gfig object collection",NULL); gtk_widget_show(button); button = gtk_button_new_with_label ("Merge"); @@ -2249,7 +2249,7 @@ small_preview(GtkWidget * list) gtk_signal_connect (GTK_OBJECT (button), "button_press_event", (GtkSignalFunc) merge_button_press, (gpointer)list); - gtk_tooltips_set_tip(gfig_tooltips,button,"Merge Gfig Object collection into the current edit session",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Merge Gfig Object collection into the current edit session",NULL); gtk_widget_show(button); return(vbox); @@ -2258,7 +2258,7 @@ small_preview(GtkWidget * list) /* Special case for now - options on poly/star/spiral button */ static void -num_sides_dialog (gchar * d_title, +num_sides_dialog (gchar * d_title, gint * num_sides, gint * which_way, gint adj_min, @@ -2277,7 +2277,7 @@ num_sides_dialog (gchar * d_title, gtk_window_set_title (GTK_WINDOW (window), d_title); gtk_container_border_width (GTK_CONTAINER (window), 0); - + button = gtk_button_new_with_label ("Close"); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) ok_warn_window, @@ -2318,7 +2318,7 @@ num_sides_dialog (gchar * d_title, (GtkSignalFunc) gfig_entry_update, num_sides); gtk_box_pack_start(GTK_BOX (hbox), entry, TRUE, TRUE, 0); - gtk_widget_show(entry); + gtk_widget_show(entry); if(which_way) { @@ -2329,12 +2329,12 @@ num_sides_dialog (gchar * d_title, /* Add special toggle for spiral */ option_menu = gtk_option_menu_new (); menu = gtk_menu_new(); - + menuitem = gtk_menu_item_new_with_label("Clockwise"); gtk_signal_connect (GTK_OBJECT (menuitem), "activate", (GtkSignalFunc)gfig_toggle_update, (gpointer)which_way); - + gtk_widget_show (menuitem); gtk_menu_append (GTK_MENU (menu), menuitem); @@ -2342,10 +2342,10 @@ num_sides_dialog (gchar * d_title, gtk_signal_connect (GTK_OBJECT (menuitem), "activate", (GtkSignalFunc)gfig_toggle_update, (gpointer)which_way); - + gtk_widget_show (menuitem); gtk_menu_append (GTK_MENU (menu), menuitem); - + gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu); gtk_widget_show (option_menu); gtk_box_pack_start (GTK_BOX (hbox), option_menu,TRUE,TRUE,0); @@ -2369,7 +2369,7 @@ bezier_dialog (void) gtk_window_set_title (GTK_WINDOW (window), "Bezier settings"); gtk_container_border_width (GTK_CONTAINER (window), 0); - + button = gtk_button_new_with_label ("Close"); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) ok_warn_window, @@ -2387,7 +2387,7 @@ bezier_dialog (void) (GtkSignalFunc) gfig_toggle_update, (gpointer)&bezier_closed); gtk_tooltips_set_tip(gfig_tooltips,toggle,"Close curve on completion",NULL); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),bezier_closed); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (toggle),bezier_closed); gtk_widget_show(toggle); gtk_box_pack_start(GTK_BOX(vbox),toggle, TRUE, TRUE, 0); @@ -2396,7 +2396,7 @@ bezier_dialog (void) (GtkSignalFunc) gfig_toggle_update, (gpointer)&bezier_line_frame); gtk_tooltips_set_tip(gfig_tooltips,toggle,"Draws lines between the control points. Only during curve creation",NULL); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),bezier_line_frame); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (toggle),bezier_line_frame); gtk_widget_show(toggle); gtk_box_pack_start(GTK_BOX(vbox),toggle, TRUE, TRUE, 0); @@ -2414,7 +2414,7 @@ poly_button_press (GtkWidget *w, (event->button == 1)) num_sides_dialog("Regular polygon number of sides",&poly_num_sides,NULL,3,200); return FALSE; -} +} static gint star_button_press (GtkWidget *w, @@ -2425,7 +2425,7 @@ star_button_press (GtkWidget *w, (event->button == 1)) num_sides_dialog("Star number of points",&star_num_sides,NULL,3,200); return FALSE; -} +} static gint spiral_button_press (GtkWidget *w, @@ -2436,7 +2436,7 @@ spiral_button_press (GtkWidget *w, (event->button == 1)) num_sides_dialog("Spiral number of points",&spiral_num_turns,&spiral_toggle,1,20); return FALSE; -} +} static gint bezier_button_press (GtkWidget *w, @@ -2447,7 +2447,7 @@ bezier_button_press (GtkWidget *w, (event->button == 1)) bezier_dialog(); return FALSE; -} +} static GtkWidget * draw_buttons(GtkWidget *ww) @@ -2460,33 +2460,33 @@ draw_buttons(GtkWidget *ww) frame = gtk_frame_new ("Ops"); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN); gtk_container_border_width (GTK_CONTAINER (frame), 1); - + /* Create group */ group = NULL; vbox = gtk_vbox_new(FALSE, 0); - gtk_container_add (GTK_CONTAINER (frame), vbox); + gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_container_border_width(GTK_CONTAINER(vbox), 2); /* Put buttons in */ button = but_with_pix(line_xpm,&group,LINE); gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 0); gtk_widget_show(button); - gtk_tooltips_set_tip(gfig_tooltips,button,"Create line",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Create line",NULL); button = but_with_pix(circle_xpm,&group,CIRCLE); gtk_container_add (GTK_CONTAINER (vbox), button); gtk_widget_show(button); - gtk_tooltips_set_tip(gfig_tooltips,button,"Create circle",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Create circle",NULL); button = but_with_pix(ellipse_xpm,&group,ELLIPSE); gtk_container_add (GTK_CONTAINER (vbox), button); gtk_widget_show(button); - gtk_tooltips_set_tip(gfig_tooltips,button,"Create ellipse",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Create ellipse",NULL); button = but_with_pix(curve_xpm,&group,ARC); gtk_container_add (GTK_CONTAINER (vbox), button); gtk_widget_show(button); - gtk_tooltips_set_tip(gfig_tooltips,button,"Create arch",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Create arch",NULL); button = but_with_pix(poly_xpm,&group,POLY); gtk_container_add (GTK_CONTAINER (vbox), button); @@ -2495,7 +2495,7 @@ draw_buttons(GtkWidget *ww) gtk_signal_connect (GTK_OBJECT (button), "button_press_event", (GtkSignalFunc) poly_button_press, NULL); - gtk_tooltips_set_tip(gfig_tooltips,button,"Create reg polygon",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Create reg polygon",NULL); button = but_with_pix(star_xpm,&group,STAR); gtk_container_add (GTK_CONTAINER (vbox), button); @@ -2503,7 +2503,7 @@ draw_buttons(GtkWidget *ww) gtk_signal_connect (GTK_OBJECT (button), "button_press_event", (GtkSignalFunc) star_button_press, NULL); - gtk_tooltips_set_tip(gfig_tooltips,button,"Create star",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Create star",NULL); button = but_with_pix(spiral_xpm,&group,SPIRAL); gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 0); @@ -2511,7 +2511,7 @@ draw_buttons(GtkWidget *ww) gtk_signal_connect (GTK_OBJECT (button), "button_press_event", (GtkSignalFunc) spiral_button_press, NULL); - gtk_tooltips_set_tip(gfig_tooltips,button,"Create spiral",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Create spiral",NULL); button = but_with_pix(bezier_xpm,&group,BEZIER); gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 0); @@ -2520,27 +2520,27 @@ draw_buttons(GtkWidget *ww) (GtkSignalFunc) bezier_button_press, NULL); - gtk_tooltips_set_tip(gfig_tooltips,button,"Create bezier curve. Shift + Button ends object creation.",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Create bezier curve. Shift + Button ends object creation.",NULL); button = but_with_pix(move_obj_xpm,&group,MOVE_OBJ); gtk_container_add (GTK_CONTAINER (vbox), button); gtk_widget_show(button); - gtk_tooltips_set_tip(gfig_tooltips,button,"Move an object",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Move an object",NULL); button = but_with_pix(move_point_xpm,&group,MOVE_POINT); gtk_container_add (GTK_CONTAINER (vbox), button); gtk_widget_show(button); - gtk_tooltips_set_tip(gfig_tooltips,button,"Move a single point",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Move a single point",NULL); button = but_with_pix(copy_obj_xpm,&group,COPY_OBJ); gtk_container_add (GTK_CONTAINER (vbox), button); gtk_widget_show(button); - gtk_tooltips_set_tip(gfig_tooltips,button,"Copy an object",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Copy an object",NULL); button = but_with_pix(delete_xpm,&group,DEL_OBJ); gtk_container_add (GTK_CONTAINER (vbox), button); gtk_widget_show(button); - gtk_tooltips_set_tip(gfig_tooltips,button,"Delete an object",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Delete an object",NULL); button = obj_select_buttons(); gtk_container_add (GTK_CONTAINER (vbox), button); @@ -2775,13 +2775,13 @@ gfig_brush_fill_preview_xy(GtkWidget *pw,gint x1 ,gint y1) /* Given an x and y fill preview in correctly offsetted */ for(row_count = 0; row_count < BRUSH_PREVIEW_SZ; row_count++) - gtk_preview_draw_row(GTK_PREVIEW(pw), - &bdesc->pv_buf[bdesc->x_off*bdesc->bpp + gtk_preview_draw_row(GTK_PREVIEW(pw), + &bdesc->pv_buf[bdesc->x_off*bdesc->bpp + (bdesc->width *bdesc->bpp - *(row_count + bdesc->y_off))], - 0, - row_count, + *(row_count + bdesc->y_off))], + 0, + row_count, BRUSH_PREVIEW_SZ); } @@ -2800,10 +2800,10 @@ gfig_brush_fill_preview(GtkWidget *pw,gint32 layer_ID, BRUSHDESC * bdesc) brushdrawable = gimp_drawable_get(layer_ID); bdesc->bpp = bcount; - + /* Fill the preview with the current brush name */ gimp_pixel_rgn_init(&src_rgn,brushdrawable,0,0,bdesc->width,bdesc->height,FALSE,FALSE); - + bdesc->pv_buf = g_new(guchar ,bdesc->width*bdesc->height*bcount); bdesc->x_off = bdesc->y_off = 0; /* Start from top left */ @@ -2863,7 +2863,7 @@ mygimp_brush_info(gint32 *width, { GParam *return_vals; int nreturn_vals; - + return_vals = gimp_run_procedure ("gimp_brushes_get_brush", &nreturn_vals, PARAM_END); @@ -2880,7 +2880,7 @@ mygimp_brush_info(gint32 *width, } gimp_destroy_params (return_vals, nreturn_vals); -} +} static void gfig_brush_img_del(void) @@ -2892,7 +2892,7 @@ gfig_brush_img_del(void) static gint32 gfig_gen_brush_preview(BRUSHDESC *bdesc) { - /* Given the name of a brush then paint it and return the ID of the image + /* Given the name of a brush then paint it and return the ID of the image * the preview can be got from */ GParam *return_vals = NULL; @@ -2933,7 +2933,7 @@ gfig_gen_brush_preview(BRUSHDESC *bdesc) * paint with brush * restore colours */ - + gimp_palette_get_foreground(&fR,&fG,&fB); gimp_palette_get_background(&bR,&bG,&bB); saved_bname = mygimp_brush_get(); @@ -2959,45 +2959,49 @@ gfig_gen_brush_preview(BRUSHDESC *bdesc) { case BRUSH_BRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_paintbrush", &nreturn_vals, + PARAM_IMAGE, brush_image_ID, PARAM_DRAWABLE, layer_ID, PARAM_FLOAT,0.0, PARAM_INT32,2*GFIG_LCC,/* GIMP BUG should be 2!!!!*/ - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PENCIL_TYPE: return_vals = gimp_run_procedure ("gimp_pencil", &nreturn_vals, + PARAM_IMAGE, brush_image_ID, PARAM_DRAWABLE, layer_ID, PARAM_INT32,2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_AIRBRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_airbrush", &nreturn_vals, + PARAM_IMAGE, brush_image_ID, PARAM_DRAWABLE, layer_ID, PARAM_FLOAT,(gdouble)selvals.airbrushpressure, PARAM_INT32,2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PATTERN_TYPE: return_vals = gimp_run_procedure ("gimp_clone", &nreturn_vals, + PARAM_IMAGE, brush_image_ID, PARAM_DRAWABLE, layer_ID, PARAM_DRAWABLE, layer_ID, PARAM_INT32, 1, PARAM_FLOAT,(gdouble)0.0, PARAM_FLOAT,(gdouble)0.0, PARAM_INT32,2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; default: break; - } + } gimp_destroy_params (return_vals, nreturn_vals); - gimp_palette_set_background(bR,bG,bB); + gimp_palette_set_background(bR,bG,bB); gimp_palette_set_foreground(fR,fG,fB); mygimp_brush_set(saved_bname); @@ -3241,9 +3245,9 @@ paint_page() vbox = gtk_vbox_new(FALSE, 0); gtk_container_border_width(GTK_CONTAINER(vbox), 4); - table = gtk_table_new (6, 6, FALSE); + table = gtk_table_new (6, 6, FALSE); gtk_table_set_row_spacings(GTK_TABLE(table),6); - gtk_container_border_width (GTK_CONTAINER (table), 1); + gtk_container_border_width (GTK_CONTAINER (table), 1); gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0); gtk_widget_show(table); @@ -3291,7 +3295,7 @@ paint_page() toggle = gtk_check_button_new_with_label ("Scale to image "); gtk_table_attach(GTK_TABLE(table), toggle, 1, 2, 3, 4, GTK_FILL, GTK_FILL, 0, 0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),selvals.scaletoimage); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(toggle),selvals.scaletoimage); gtk_signal_connect (GTK_OBJECT (toggle), "toggled", (GtkSignalFunc) gfig_scale2img_update, (gpointer)&selvals.scaletoimage); @@ -3309,7 +3313,7 @@ paint_page() (GtkSignalFunc)gfig_scale_update_scale, &selvals.scaletoimagefp); gtk_widget_show (scale_scale); - gtk_widget_show (hbox); + gtk_widget_show (hbox); gtk_table_attach(GTK_TABLE(table), hbox, 2, 4, 3, 4, GTK_FILL|GTK_EXPAND , GTK_FILL, 0, 0); gtk_widget_set_sensitive(GTK_WIDGET(scale_scale),FALSE); gtk_object_set_user_data (GTK_OBJECT (toggle), (gpointer)scale_scale_data); @@ -3320,14 +3324,12 @@ paint_page() gtk_signal_connect (GTK_OBJECT (toggle), "toggled", (GtkSignalFunc) gfig_toggle_update, (gpointer)&selvals.approxcircles); - gtk_tooltips_set_tip(gfig_tooltips,toggle,"Approx. circles & ellipses using lines. Allows the use of brush fading with these types of objects.",NULL); + gtk_tooltips_set_tip(gfig_tooltips,toggle,"Approx. circles & ellipses using lines. Allows the use of brush fading with these types of objects.",NULL); gtk_widget_show(toggle); return(vbox); } -#if 0 /* NOT USED */ - static void gfig_get_brushes(GtkWidget *list) { @@ -3353,7 +3355,7 @@ gfig_get_brushes(GtkWidget *list) } num_brs = return_vals[1].data.d_int32; - + brush_names = return_vals[2].data.d_stringarray; for( i = 0 ; i < num_brs; i++) @@ -3375,7 +3377,7 @@ gfig_get_brushes(GtkWidget *list) list_item2sel = i; } } - + if(fbdesc != (BRUSHDESC*)-1) { /* First item selected by default - unselected it ! */ @@ -3386,7 +3388,7 @@ gfig_get_brushes(GtkWidget *list) gimp_destroy_params (return_vals, nreturn_vals); gtk_list_select_item(GTK_LIST(list),list_item2sel); } -#endif + #if 0 /* NOT USED */ static gint @@ -3411,7 +3413,7 @@ set_brush_press(GtkWidget *widget, #ifdef DEBUG printf("Str = %s\n",str); #endif /* DEBUG */ - + /* set it */ return_vals = gimp_run_procedure ("gimp_brushes_set_brush", &nreturn_vals, @@ -3432,54 +3434,12 @@ set_brush_press(GtkWidget *widget, #endif /* NOT USED */ -static void -gfig_brush_invoker(gchar *name, - gdouble opacity, - gint spacing, - gint paint_mode, - gint width, - gint height, - gchar * mask_data, - gint closing, - gpointer udata) -{ - BRUSHDESC *bdesc = g_malloc0(sizeof(BRUSHDESC)); /* Mem leak */ - - bdesc->bpp = 3; - bdesc->width = width; - bdesc->height = height; - bdesc->bname = g_strdup(name); - - brush_list_button_press(NULL,NULL,bdesc); - -} - -#if 0 /* GIMP 1.1.x */ -static gint -select_brush_press(GtkWidget *widget, - GdkEventButton *event, - gpointer data) -{ - BRUSHDESC *bdesc = g_malloc0(sizeof(BRUSHDESC)); - gimp_interactive_selection_brush("Gfig brush selection", - mygimp_brush_get(), - 1.0, /* Opacity */ - -1, /* spacing (default)*/ - 1, /* Paint mode */ - gfig_brush_invoker, - NULL); - - bdesc->bpp = 3; - bdesc->bname = mygimp_brush_get(); - - brush_list_button_press(NULL,NULL,bdesc); - - return(TRUE); -} -#endif static GtkWidget * brush_page() { + GtkWidget *list_frame; + GtkWidget *list; + GtkWidget *scrolled_win; GtkWidget *table; GtkWidget *label; GtkWidget *pw; @@ -3487,16 +3447,13 @@ brush_page() GtkObject *fade_out_scale_data; GtkObject *pressure_scale_data; GtkWidget *vbox; - GtkWidget *button; - BRUSHDESC *bdesc = g_malloc0(sizeof(BRUSHDESC)); /* Initial brush settings */ - vbox = gtk_vbox_new(FALSE, 0); gtk_container_border_width(GTK_CONTAINER(vbox), 4); - table = gtk_table_new (6, 6, FALSE); + table = gtk_table_new (6, 6, FALSE); gtk_table_set_row_spacings(GTK_TABLE(table),6); - gtk_container_border_width (GTK_CONTAINER (table), 1); + gtk_container_border_width (GTK_CONTAINER (table), 1); gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0); gtk_widget_show(table); @@ -3510,7 +3467,7 @@ brush_page() /* Fade option */ /* the fade-out scale From GIMP itself*/ fade_out_hbox = gtk_hbox_new (FALSE, 1); - + label = gtk_label_new ("Fade Out:"); gtk_box_pack_start (GTK_BOX (fade_out_hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); @@ -3525,7 +3482,7 @@ brush_page() &selvals.brushfade); gtk_widget_show (scale); gtk_table_attach(GTK_TABLE(table), fade_out_hbox, 1, 2, 0, 1, GTK_FILL|GTK_EXPAND , GTK_FILL, 0, 0); - gtk_widget_show (fade_out_hbox); + gtk_widget_show (fade_out_hbox); pressure_hbox = gtk_hbox_new (FALSE, 1); label = gtk_label_new ("Pressure:"); @@ -3558,7 +3515,6 @@ brush_page() (GtkSignalFunc)gfig_brush_update_preview, (gpointer)brush_page_pw); -#if 0 /* Brush list */ list_frame = gtk_frame_new(NULL); gtk_frame_set_shadow_type (GTK_FRAME (list_frame), GTK_SHADOW_ETCHED_IN); @@ -3574,25 +3530,10 @@ brush_page() gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE); gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list); - gtk_widget_show (list); gtk_table_attach(GTK_TABLE(table), list_frame, 0, 4, 1, 5, GTK_FILL|GTK_EXPAND , GTK_FILL|GTK_EXPAND, 0, 0); /* Get brush list and insert in table */ gfig_get_brushes(list); -#endif /* 0 */ -#if 0 /* GIMP 1.1.x */ - /* Start of new brush selection code */ - brush_sel_button = button = gtk_button_new_with_label ("Set brush..."); - gtk_table_attach(GTK_TABLE(table), button, 0,4,1,5, 0, 0, 0, 0); - gtk_signal_connect (GTK_OBJECT (button), "button_press_event", - (GtkSignalFunc) select_brush_press, - NULL); - gtk_widget_show(button); -#endif - /* Setup initial brush settings */ - bdesc->bpp = 3; - bdesc->bname = mygimp_brush_get(); - brush_list_button_press(NULL,NULL,bdesc); return(vbox); } @@ -3604,28 +3545,28 @@ select_menu_callback (GtkWidget *widget, gpointer data) if(mtype == SELECT_TYPE_MENU) { - SELECTION_TYPE type = + SELECTION_TYPE type = (SELECTION_TYPE)gtk_object_get_user_data (GTK_OBJECT (widget)); selopt.type = type; } else if(mtype == SELECT_ARCTYPE_MENU) { - ARC_TYPE type = + ARC_TYPE type = (ARC_TYPE)gtk_object_get_user_data (GTK_OBJECT (widget)); selopt.as_pie = type; } else if(mtype == SELECT_TYPE_MENU_FILL) { - FILL_TYPE type = + FILL_TYPE type = (FILL_TYPE)gtk_object_get_user_data (GTK_OBJECT (widget)); selopt.fill_type = type; } else if(mtype == SELECT_TYPE_MENU_WHEN) { - FILL_WHEN type = + FILL_WHEN type = (FILL_WHEN)gtk_object_get_user_data (GTK_OBJECT (widget)); selopt.fill_when = type; } @@ -3806,21 +3747,21 @@ select_page() vbox = gtk_vbox_new(FALSE, 0); gtk_container_border_width(GTK_CONTAINER(vbox), 4); - table = gtk_table_new (7, 7, FALSE); + table = gtk_table_new (7, 7, FALSE); gtk_table_set_row_spacings(GTK_TABLE(table),6); - gtk_container_border_width (GTK_CONTAINER (table), 1); + gtk_container_border_width (GTK_CONTAINER (table), 1); gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0); gtk_widget_show(table); - /* The secltion settings - + /* The secltion settings - * 1) Type (option menu) * 2) Anti A (toggle) * 3) Feather (toggle) * 4) F radius (slider) - * 5) Fill type (option menu) + * 5) Fill type (option menu) * 6) Opacity (slider) * 7) When to fill (toggle) - * 8) Arc as segment/sector + * 8) Arc as segment/sector */ /* Put widgets in */ @@ -3833,7 +3774,7 @@ select_page() menu = select_page_menu_type(); gtk_box_pack_start (GTK_BOX (hbox), menu, TRUE, TRUE, 0); - gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (hbox); + gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (hbox); /* 2 */ @@ -3842,7 +3783,7 @@ select_page() gtk_signal_connect (GTK_OBJECT (toggle), "toggled", (GtkSignalFunc) gfig_toggle_update, (gpointer)&selopt.antia); - gtk_widget_show(toggle); + gtk_widget_show(toggle); /* 3 */ toggle = gtk_check_button_new_with_label ("Feather"); @@ -3850,11 +3791,11 @@ select_page() gtk_signal_connect (GTK_OBJECT (toggle), "toggled", (GtkSignalFunc) gfig_toggle_update, (gpointer)&selopt.feather); - gtk_widget_show(toggle); + gtk_widget_show(toggle); /* 4 */ hbox = gtk_hbox_new (FALSE, 1); - + label = gtk_label_new ("Feather Radius:"); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); @@ -3869,7 +3810,7 @@ select_page() &selopt.feather_radius); gtk_widget_show (scale); gtk_table_attach(GTK_TABLE(table), hbox, 1, 3, 1, 2, GTK_FILL|GTK_EXPAND , GTK_FILL, 0, 0); - gtk_widget_show (hbox); + gtk_widget_show (hbox); /* 5 */ hbox = gtk_hbox_new (FALSE, 1); @@ -3880,11 +3821,11 @@ select_page() menu = select_page_menu_fill_type(); gtk_box_pack_start (GTK_BOX (hbox), menu, TRUE, TRUE, 0); - gtk_table_attach (GTK_TABLE (table), hbox, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (hbox); + gtk_table_attach (GTK_TABLE (table), hbox, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (hbox); /* 6 */ hbox = gtk_hbox_new (FALSE, 1); - + label = gtk_label_new ("Fill Opacity:"); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); @@ -3899,7 +3840,7 @@ select_page() &selopt.fill_opacity); gtk_widget_show (scale); gtk_table_attach(GTK_TABLE(table), hbox, 1, 3, 2, 3, GTK_FILL|GTK_EXPAND , GTK_FILL, 0, 0); - gtk_widget_show (hbox); + gtk_widget_show (hbox); /* 7 */ hbox = gtk_hbox_new (FALSE, 1); @@ -3910,7 +3851,7 @@ select_page() menu = select_page_menu_fill_when(); gtk_box_pack_start (GTK_BOX (hbox), menu, TRUE, TRUE, 0); - gtk_table_attach (GTK_TABLE (table), hbox, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (hbox); + gtk_table_attach (GTK_TABLE (table), hbox, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (hbox); /* 8 */ hbox = gtk_hbox_new (FALSE, 1); @@ -3921,7 +3862,7 @@ select_page() menu = select_page_menu_arctype(); gtk_box_pack_start (GTK_BOX (hbox), menu, TRUE, TRUE, 0); - gtk_table_attach (GTK_TABLE (table), hbox, 0, 1, 5, 6, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (hbox); + gtk_table_attach (GTK_TABLE (table), hbox, 0, 1, 5, 6, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (hbox); return(vbox); } @@ -3987,7 +3928,7 @@ option_page_menu_gridtype(void) (gpointer)GRID_TYPE_MENU); gtk_widget_show (menuitem); gtk_menu_append (GTK_MENU (menu), menuitem); - + gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu); gtk_widget_show (option_menu); @@ -4084,9 +4025,9 @@ options_page() vbox = gtk_vbox_new(FALSE, 0); gtk_container_border_width(GTK_CONTAINER(vbox), 4); - table = gtk_table_new (6, 6, FALSE); + table = gtk_table_new (6, 6, FALSE); gtk_table_set_row_spacings(GTK_TABLE(table),6); - gtk_container_border_width (GTK_CONTAINER (table), 1); + gtk_container_border_width (GTK_CONTAINER (table), 1); gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0); gtk_widget_show(table); @@ -4099,7 +4040,7 @@ options_page() gtk_signal_connect (GTK_OBJECT (toggle), "toggled", (GtkSignalFunc) toggle_show_image, (gpointer)1); - gtk_widget_show(toggle); + gtk_widget_show(toggle); button = gtk_button_new_with_label ("Reload image"); gtk_table_attach(GTK_TABLE(table), button, 1, 2, 0, 1, 0, 0, 0, 0); @@ -4134,7 +4075,7 @@ options_page() gtk_table_attach(GTK_TABLE(table), menu, 3, 4, 1, 2, GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show(toggle); + gtk_widget_show(toggle); gfig_opt_widget.showcontrol = toggle; sprintf(buf,"Max Undo:"); @@ -4165,7 +4106,7 @@ options_page() (GtkSignalFunc) gfig_entry_update, &selvals.maxundo); gtk_table_attach(GTK_TABLE(table), entry, 4, 5, 2, 3, GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show(entry); + gtk_widget_show(entry); toggle = gtk_check_button_new_with_label ("Show tool tips "); gtk_table_attach(GTK_TABLE(table), toggle, 0, 1, 3, 4, GTK_FILL, GTK_FILL, 0, 0); @@ -4175,8 +4116,8 @@ options_page() gtk_signal_connect (GTK_OBJECT (toggle), "toggled", (GtkSignalFunc) toggle_tooltips, (gpointer)&selvals.showtooltips); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),selvals.showtooltips); - gtk_widget_show(toggle); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(toggle),selvals.showtooltips); + gtk_widget_show(toggle); toggle = gtk_check_button_new_with_label ("Show pos"); gtk_table_attach(GTK_TABLE(table), toggle, 1, 2, 3, 4, GTK_FILL, GTK_FILL, 0, 0); @@ -4186,7 +4127,7 @@ options_page() gtk_signal_connect_after (GTK_OBJECT (toggle), "toggled", (GtkSignalFunc) gfig_pos_enable, (gpointer)1); - gtk_widget_show(toggle); + gtk_widget_show(toggle); button = gtk_button_new_with_label ("About"); gtk_table_attach(GTK_TABLE(table), button, 3, 4, 4, 5, GTK_FILL, GTK_FILL, 0, 0); @@ -4214,16 +4155,16 @@ grid_frame() frame = gtk_frame_new ("Grid"); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN); gtk_container_border_width (GTK_CONTAINER (frame), 1); - + table = gtk_table_new (7, 7, FALSE); - gtk_container_add (GTK_CONTAINER (frame), table); + gtk_container_add (GTK_CONTAINER (frame), table); toggle = gtk_check_button_new_with_label ("Snap to grid"); gtk_table_attach(GTK_TABLE(table), toggle, 1, 2, 3, 4, GTK_FILL, GTK_FILL, 0, 0); gtk_signal_connect (GTK_OBJECT (toggle), "toggled", (GtkSignalFunc) gfig_toggle_update, (gpointer)&selvals.opts.snap2grid); - gtk_widget_show(toggle); + gtk_widget_show(toggle); gfig_opt_widget.snap2grid = toggle; toggle = gtk_check_button_new_with_label ("Display grid"); @@ -4234,7 +4175,7 @@ grid_frame() gtk_signal_connect (GTK_OBJECT (toggle), "toggled", (GtkSignalFunc) draw_grid_clear, (gpointer)1); - gtk_widget_show(toggle); + gtk_widget_show(toggle); gfig_opt_widget.drawgrid = toggle; @@ -4277,14 +4218,14 @@ grid_frame() (GtkSignalFunc) gfig_entry_update, &selvals.opts.gridspacing); gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 4, 5, GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show(entry); + gtk_widget_show(entry); gtk_widget_show(table); gtk_widget_show(frame); return(frame); } -void +void clear_list_items(GtkList *list) { gtk_list_clear_items(list,0,-1); @@ -4307,7 +4248,7 @@ build_list_items(GtkWidget *list) else list_pix = gfig_new_pixmap(list,blank_xpm); - list_item = gfig_list_item_new_with_label_and_pixmap(g,g->draw_name,list_pix); + list_item = gfig_list_item_new_with_label_and_pixmap(g,g->draw_name,list_pix); gtk_object_set_user_data (GTK_OBJECT (list_item), (gpointer)g); gtk_list_append_items (GTK_LIST (list), g_list_append(NULL,list_item)); @@ -4366,7 +4307,7 @@ add_objects_list () gtk_signal_connect (GTK_OBJECT (button), "button_press_event", (GtkSignalFunc) rescan_button_press, NULL); - gtk_tooltips_set_tip(gfig_tooltips,button,"Select directory and rescan Gfig object collection",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Select directory and rescan Gfig object collection",NULL); gtk_table_attach(GTK_TABLE(table), button, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 0, 0); button = gtk_button_new_with_label ("Load"); @@ -4374,7 +4315,7 @@ add_objects_list () gtk_signal_connect (GTK_OBJECT (button), "button_press_event", (GtkSignalFunc) load_button_press, list); - gtk_tooltips_set_tip(gfig_tooltips,button,"Load a single Gfig object collection",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Load a single Gfig object collection",NULL); gtk_table_attach(GTK_TABLE(table), button, 2, 3, 1, 2, GTK_FILL, GTK_FILL, 0, 0); button = gtk_button_new_with_label ("New"); @@ -4382,7 +4323,7 @@ add_objects_list () (GtkSignalFunc) new_button_press, "New gfig obj"); gtk_widget_show(button); - gtk_tooltips_set_tip(gfig_tooltips,button,"Create a new Gfig object collection for editing",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Create a new Gfig object collection for editing",NULL); gtk_table_attach(GTK_TABLE(table), button, 2, 3, 2, 3, GTK_FILL, GTK_FILL, 0, 0); @@ -4391,7 +4332,7 @@ add_objects_list () (GtkSignalFunc) gfig_delete_gfig_callback, (gpointer)list); gtk_widget_show(button); - gtk_tooltips_set_tip(gfig_tooltips,button,"Delete currently selected Gfig Object collection",NULL); + gtk_tooltips_set_tip(gfig_tooltips,button,"Delete currently selected Gfig Object collection",NULL); gtk_table_attach(GTK_TABLE(table), button, 2, 3, 3, 4, GTK_FILL, GTK_FILL, 0, 0); /* Attach the frame for the list Show the widgets */ @@ -4423,7 +4364,7 @@ gfig_pos_update_labels(gpointer data) static gchar buf[256]; /*gtk_idle_remove(pos_tag);*/ - pos_tag = -1; + pos_tag = -1; if(x_pos_val < 0) sprintf(buf," X:%.3d ",x_pos_val); @@ -4465,10 +4406,10 @@ static void gfig_obj_size_update(gint sz) { static gchar buf[256]; - + sprintf(buf,"%6d",sz); - gtk_label_set_text(GTK_LABEL(obj_size_label),buf); -} + gtk_label_set(GTK_LABEL(obj_size_label),buf); +} static GtkWidget * gfig_obj_size_label(void) @@ -4485,14 +4426,14 @@ gfig_obj_size_label(void) gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); obj_size_label = gtk_label_new(""); - gtk_misc_set_alignment (GTK_MISC (obj_size_label), 0.5, 0.5); + gtk_misc_set_alignment (GTK_MISC (obj_size_label), 0.5, 0.5); gtk_widget_show(obj_size_label); gtk_box_pack_start (GTK_BOX (hbox), obj_size_label, FALSE, FALSE, 0); gtk_widget_show(hbox); sprintf(buf,"%6d",0); - gtk_label_set_text(GTK_LABEL(obj_size_label),buf); + gtk_label_set(GTK_LABEL(obj_size_label),buf); return(hbox); } @@ -4530,9 +4471,9 @@ gfig_pos_labels(void) gtk_widget_show(vbox); sprintf(buf," X: %.3d ",0); - gtk_label_set_text(GTK_LABEL(x_pos_label),buf); + gtk_label_set(GTK_LABEL(x_pos_label),buf); sprintf(buf," Y: %.3d ",0); - gtk_label_set_text(GTK_LABEL(y_pos_label),buf); + gtk_label_set(GTK_LABEL(y_pos_label),buf); return(hbox); } @@ -4548,7 +4489,7 @@ make_pos_info(void) hbox = gtk_hbox_new (TRUE, 1); gtk_frame_set_shadow_type (GTK_FRAME (xframe), GTK_SHADOW_ETCHED_IN); - gtk_container_add (GTK_CONTAINER (xframe), hbox); + gtk_container_add (GTK_CONTAINER (xframe), hbox); /* Add labels */ label = gfig_pos_labels(); @@ -4584,7 +4525,7 @@ make_status(void) gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1, 0 , GTK_FILL, 0, 0); - + label = gtk_label_new("Filename:"); gtk_misc_set_alignment(GTK_MISC(label),0.5,0.5); gtk_widget_show(label); @@ -4612,7 +4553,7 @@ make_status(void) gtk_table_attach(GTK_TABLE(table), progress_widget, 2, 4, 2, 3, 0 , 0, 0, 0); #endif /* 0 */ - gtk_container_add (GTK_CONTAINER (xframe), table); + gtk_container_add (GTK_CONTAINER (xframe), table); gtk_widget_show(table); gtk_widget_show(xframe); @@ -4628,10 +4569,10 @@ make_preview(void) GtkWidget * table; GtkWidget * ruler; - + gfig_preview = gtk_preview_new(GTK_PREVIEW_COLOR); gtk_widget_set_events( GTK_WIDGET(gfig_preview), PREVIEW_MASK ); - gfig_preview_exp_id = + gfig_preview_exp_id = gtk_signal_connect_after( GTK_OBJECT(gfig_preview), "expose_event", (GtkSignalFunc) gfig_preview_expose, NULL); @@ -4649,7 +4590,7 @@ make_preview(void) table = gtk_table_new (3, 3, FALSE); gtk_table_attach(GTK_TABLE(table), gfig_preview, 1, 2, 1, 2, GTK_FILL ,GTK_FILL , 0, 0); - gtk_container_add (GTK_CONTAINER (xframe), table); + gtk_container_add (GTK_CONTAINER (xframe), table); ruler = gtk_hruler_new (); gtk_ruler_set_range (GTK_RULER (ruler), 0, preview_width, 0, PREVIEW_SIZE); @@ -4683,7 +4624,7 @@ make_preview(void) xframe = make_status(); gtk_box_pack_start(GTK_BOX(vbox), xframe, TRUE, TRUE, 0); - + gtk_widget_show(vbox); gtk_widget_show(hbox); @@ -4787,7 +4728,7 @@ gfig_dialog () NULL); /* Tooltips bis */ - gfig_tooltips = gtk_tooltips_new(); + gfig_tooltips = gtk_tooltips_new(); /* Action area */ button = gtk_button_new_with_label ("Done"); @@ -4847,50 +4788,50 @@ gfig_dialog () frame = gtk_frame_new ("preview"); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN); gtk_container_border_width (GTK_CONTAINER (frame), 1); - table = gtk_table_new (6, 6, FALSE); - gtk_container_border_width (GTK_CONTAINER (table), 1); - gtk_container_add (GTK_CONTAINER (frame), table); + table = gtk_table_new (6, 6, FALSE); + gtk_container_border_width (GTK_CONTAINER (table), 1); + gtk_container_add (GTK_CONTAINER (frame), table); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (top_level_dlg)->vbox), frame, TRUE, TRUE, 0); /* Preview itself */ xframe = make_preview(); gtk_table_attach(GTK_TABLE(table), xframe, 1, 2, 0, 2, GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show(table); - gtk_widget_show(frame); + gtk_widget_show(table); + gtk_widget_show(frame); gtk_widget_show(gfig_preview); /* Add buttons beside the preview frame */ xframe = draw_buttons(top_level_dlg); - gtk_table_attach(GTK_TABLE(table), xframe, 0,1, 0, 2, GTK_FILL, GTK_FILL, 0, 0); + gtk_table_attach(GTK_TABLE(table), xframe, 0,1, 0, 2, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(xframe); frame = gtk_frame_new ("Settings"); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN); gtk_container_border_width (GTK_CONTAINER (frame), 1); - + gtk_table_attach(GTK_TABLE(table), frame, 2, 3, 0, 2, GTK_FILL , GTK_FILL, 0, 0); table = gtk_table_new (7, 7, FALSE); - + gtk_container_border_width (GTK_CONTAINER (table), 1); gtk_table_set_row_spacings(GTK_TABLE(table),1); gtk_container_add (GTK_CONTAINER (frame), table); /* listbox + entry */ oframe = add_objects_list(); - gtk_table_attach(GTK_TABLE(table), oframe, 0,6, 0 , 1, GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0); + gtk_table_attach(GTK_TABLE(table), oframe, 0,6, 0 , 1, GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0); /* Grid entry */ xframe = grid_frame(); - gtk_table_attach(GTK_TABLE(table), xframe, 0,6, 3, 4, GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0); + gtk_table_attach(GTK_TABLE(table), xframe, 0,6, 3, 4, GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0); /* The notebook */ notebook = gtk_notebook_new(); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP); gtk_widget_show(notebook); gtk_table_attach(GTK_TABLE(table), notebook, 0, 6, 5, 6, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0); - + page = paint_page(); label = gtk_label_new("Paint"); gtk_widget_show(label); @@ -4926,8 +4867,8 @@ gfig_dialog () gtk_widget_show(page); - gtk_widget_show(frame); - gtk_widget_show(table); + gtk_widget_show(frame); + gtk_widget_show(table); gtk_widget_show (top_level_dlg); dialog_update_preview(); @@ -4941,7 +4882,7 @@ gfig_dialog () /* Tool tips and colors */ if(gdk_color_parse("bisque",&color) == FALSE || !gdk_color_alloc(xxx,&color)) - gtk_tooltips_set_colors(gfig_tooltips,&top_level_dlg->style->white,&top_level_dlg->style->black); + gtk_tooltips_set_colors(gfig_tooltips,&top_level_dlg->style->white,&top_level_dlg->style->black); else gtk_tooltips_set_colors(gfig_tooltips,&color,&top_level_dlg->style->black); @@ -4962,7 +4903,7 @@ gfig_close_callback (GtkWidget *widget, } static void -done_ok_window(GtkWidget * widget, +done_ok_window(GtkWidget * widget, gpointer data) { gfig_run = TRUE; @@ -4981,7 +4922,7 @@ done_warn_dialog (GtkWidget *w,gint count) gtk_window_set_title (GTK_WINDOW (window), "Warning"); gtk_container_border_width (GTK_CONTAINER (window), 0); - + button = gtk_button_new_with_label ("OK"); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) done_ok_window, @@ -5109,7 +5050,7 @@ adjust_pic_coords(gint coord,gint ratio) return((SMALL_PREVIEW_SZ * coord)/pratio); } - + static gint gfig_preview_events ( GtkWidget *widget, GdkEvent *event ) @@ -5196,7 +5137,7 @@ gfig_preview_events ( GtkWidget *widget, else break; } - + /* make small preview reflect changes ?*/ list_button_update(current_obj); @@ -5272,7 +5213,7 @@ gfig_list_add(GFIGOBJ *obj) GtkWidget *list_pix; list_pix = gfig_new_pixmap(gfig_gtk_list,Floppy6_xpm); - list_item = gfig_list_item_new_with_label_and_pixmap(obj,obj->draw_name,list_pix); + list_item = gfig_list_item_new_with_label_and_pixmap(obj,obj->draw_name,list_pix); gtk_object_set_user_data (GTK_OBJECT (list_item), (gpointer)obj); @@ -5281,8 +5222,8 @@ gfig_list_add(GFIGOBJ *obj) list = g_list_append(NULL, list_item); gtk_list_insert_items(GTK_LIST(gfig_gtk_list), list, pos); gtk_widget_show (list_item); - gtk_list_select_item(GTK_LIST(gfig_gtk_list), pos); - + gtk_list_select_item(GTK_LIST(gfig_gtk_list), pos); + gtk_signal_connect(GTK_OBJECT(list_item), "button_press_event", (GtkSignalFunc) list_button_press, (gpointer)obj); @@ -5315,7 +5256,7 @@ gfig_list_ok_callback (GtkWidget *w, #endif /* DEBUG */ /* Need to reorder the list */ - /* gtk_label_set_text (GTK_LABEL (options->layer_widget->label), layer->name);*/ + /* gtk_label_set (GTK_LABEL (options->layer_widget->label), layer->name);*/ pos = gtk_list_child_position(GTK_LIST(gfig_gtk_list),list); #ifdef DEBUG @@ -5387,7 +5328,7 @@ gfig_dialog_edit_list (GtkWidget *lwidget,GFIGOBJ *obj,gint created) options->name_entry = gtk_entry_new (); gtk_box_pack_start (GTK_BOX (hbox), options->name_entry, TRUE, TRUE, 0); gtk_entry_set_text (GTK_ENTRY (options->name_entry),obj->draw_name); - + gtk_widget_show (options->name_entry); gtk_widget_show (hbox); @@ -5428,7 +5369,7 @@ gfig_rescan_ok_callback (GtkWidget *w, GList *list; list = rescan_list; - while (list) + while (list) { #ifdef DEBUG printf("(ADD) list->data = %s\n",(gchar *)list->data); @@ -5436,7 +5377,7 @@ gfig_rescan_ok_callback (GtkWidget *w, list = list->next; } list = gfig_path_list; - while (list) + while (list) { #ifdef DEBUG printf("(CONF) list->data = %s\n",(gchar *)list->data); @@ -5469,15 +5410,15 @@ gfig_rescan_file_selection_ok(GtkWidget *w, if (!S_ISDIR(filestat.st_mode)) { g_warning("Entry %.100s is not a directory\n",filenamebuf); - } + } else { list_item = gtk_list_item_new_with_label(filenamebuf); gtk_widget_show(list_item); - + gtk_list_prepend_items(GTK_LIST(lw),g_list_append(NULL, list_item)); - + rescan_list = g_list_prepend(rescan_list,g_strdup(filenamebuf)); } @@ -5544,8 +5485,7 @@ gfig_rescan_list (void) list_widget = gtk_list_new (); gtk_list_set_selection_mode (GTK_LIST (list_widget), GTK_SELECTION_BROWSE); - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), - list_widget); + gtk_container_add (GTK_CONTAINER (scrolled_win), list_widget); gtk_widget_show (list_widget); gtk_box_pack_start (GTK_BOX (vbox), list_frame, TRUE, TRUE, 0); @@ -5571,7 +5511,7 @@ gfig_rescan_list (void) /* Clear the old list out */ if((list = rescan_list)) { - while (list) + while (list) { g_free(list->data); list = list->next; @@ -5636,7 +5576,7 @@ gfig_load_file_selection_ok(GtkWidget *w, #endif /* DEBUG */ err = stat (filename, &filestat); - + if (!err && S_ISREG (filestat.st_mode)) { /* Hack - current object MUST be NULL to prevent setup_undo() @@ -5646,13 +5586,13 @@ gfig_load_file_selection_ok(GtkWidget *w, current_obj = NULL; gfig = gfig_load (filename,filename); current_obj = current_saved; - + if (gfig) { /* Read only ?*/ if(access(filename,W_OK)) gfig->obj_status |= GFIG_READONLY; - + gfig_list_add(gfig); new_obj_2edit(gfig); } @@ -5691,7 +5631,7 @@ load_button_press(GtkWidget *widget, } #if 0 /* NOT USED */ -static void +static void mygimp_edit_clear(gint32 image_ID, gint32 layer_ID) { GParam *return_vals; @@ -5701,7 +5641,7 @@ mygimp_edit_clear(gint32 image_ID, gint32 layer_ID) PARAM_IMAGE, image_ID, PARAM_DRAWABLE, layer_ID, PARAM_END); - gimp_destroy_params (return_vals, nreturn_vals); + gimp_destroy_params (return_vals, nreturn_vals); } #endif /* NOT USED */ @@ -5770,9 +5710,9 @@ paint_layer_new(gchar *new_name) gimp_image_add_layer(gfig_image,layer_id,-1); gimp_drawable_fill(layer_id,1); } - + gfig_drawable = layer_id; - + switch(selvals.onlayerbg) { case LAYER_TRANS_BG: @@ -5806,6 +5746,7 @@ paint_layer_fill() return_vals = gimp_run_procedure ("gimp_bucket_fill", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_INT32, selopt.fill_type, /* Fill mode */ PARAM_INT32, 0, /* NORMAL */ @@ -5818,7 +5759,7 @@ paint_layer_fill() gimp_destroy_params (return_vals, nreturn_vals); } - + static void gfig_paint_callback(GtkWidget *widget, gpointer data) @@ -5849,7 +5790,7 @@ gfig_paint_callback(GtkWidget *widget, if(ccount == obj_show_single || obj_show_single == -1) { sprintf(buf,"Gfig Layer %d",layer_count++); - + if(selvals.painttype != PAINT_SELECTION_TYPE) { switch(selvals.onlayers) @@ -5877,26 +5818,26 @@ gfig_paint_callback(GtkWidget *widget, break; } } - + objs->obj->paintfunc(objs->obj); - + /* Fill layer if required */ - if(selvals.painttype == PAINT_SELECTION_FILL_TYPE + if(selvals.painttype == PAINT_SELECTION_FILL_TYPE && selopt.fill_when == FILL_EACH) paint_layer_fill(); } objs = objs->next; - + ccount++; -#if 0 +#if 0 gtk_progress_bar_update(GTK_PROGRESS_BAR(progress_widget),(gfloat)ccount/(gfloat)count); gtk_widget_draw(GTK_WIDGET(progress_widget),NULL); #endif /* 0 */ } /* Fill layer if required */ - if(selvals.painttype == PAINT_SELECTION_FILL_TYPE + if(selvals.painttype == PAINT_SELECTION_FILL_TYPE && selopt.fill_when == FILL_AFTER) paint_layer_fill(); @@ -5931,7 +5872,7 @@ about_button_press(GtkWidget *widget, gtk_window_set_title (GTK_WINDOW (window), "About"); gtk_container_border_width (GTK_CONTAINER (window), 0); - + button = gtk_button_new_with_label ("OK"); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) ok_warn_window, @@ -6027,7 +5968,7 @@ new_gfig_obj(gchar * name) /* Leave options as before */ pic_obj = current_obj = gfig; - + new_list_item = gfig_list_add(gfig); tmp_bezier = obj_creating = tmp_line = NULL; @@ -6044,7 +5985,7 @@ new_button_press(GtkWidget *widget, gpointer data) { GtkWidget * new_list_item; - + new_list_item = new_gfig_obj((gchar*)data); gfig_dialog_edit_list(new_list_item,current_obj,TRUE); @@ -6080,7 +6021,7 @@ delete_button_press_ok(GtkWidget *widget, /* Get the list and which item is selected */ /* Only allow single selections */ - sellist = GTK_LIST(list)->selection; + sellist = GTK_LIST(list)->selection; sel_obj = (GFIGOBJ *)gtk_object_get_user_data(GTK_OBJECT((GtkWidget *)(sellist->data))); @@ -6098,7 +6039,7 @@ delete_button_press_ok(GtkWidget *widget, { clear_undo(); } - + /* Free current obj */ gfig_free_everything(sel_obj); @@ -6107,7 +6048,7 @@ delete_button_press_ok(GtkWidget *widget, pos--; if(pos < 0 && g_list_length(gfig_list) == 0) - { + { /* Warning - we have a problem here * since we are not really "creating an entry" * why call gfig_new? @@ -6124,7 +6065,7 @@ delete_button_press_ok(GtkWidget *widget, delete_dialog = NULL; - gtk_list_select_item(GTK_LIST(gfig_gtk_list), pos); + gtk_list_select_item(GTK_LIST(gfig_gtk_list), pos); current_obj = g_list_nth(gfig_list,pos)->data; @@ -6151,7 +6092,7 @@ gfig_delete_gfig_callback(GtkWidget *widget, GFIGOBJ * sel_obj; - sellist = GTK_LIST(list)->selection; + sellist = GTK_LIST(list)->selection; sel_obj = (GFIGOBJ *)gtk_object_get_user_data(GTK_OBJECT((GtkWidget *)(sellist->data))); if(delete_dialog) @@ -6161,31 +6102,31 @@ gfig_delete_gfig_callback(GtkWidget *widget, gtk_window_set_title(GTK_WINDOW(delete_dialog), "Delete gfig drawing"); gtk_window_position(GTK_WINDOW(delete_dialog), GTK_WIN_POS_MOUSE); gtk_container_border_width(GTK_CONTAINER(delete_dialog), 0); - + vbox = gtk_vbox_new(FALSE, 0); gtk_container_border_width(GTK_CONTAINER(vbox), 8); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(delete_dialog)->vbox), vbox, FALSE, FALSE, 0); gtk_widget_show(vbox); - + /* Question */ - + label = gtk_label_new("Are you sure you want to delete"); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_widget_show(label); - + str = g_malloc((strlen(sel_obj->draw_name) + 32 * sizeof(char))); - + sprintf(str, "\"%s\" from the list and from disk?", sel_obj->draw_name); - + label = gtk_label_new(str); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_widget_show(label); - + g_free(str); - + /* Buttons */ button = gtk_button_new_with_label ("Delete"); gtk_signal_connect (GTK_OBJECT (button), "clicked", @@ -6196,7 +6137,7 @@ gfig_delete_gfig_callback(GtkWidget *widget, gtk_widget_grab_default (button); gtk_object_set_user_data(GTK_OBJECT(button),widget); gtk_widget_show (button); - + button = gtk_button_new_with_label ("Cancel"); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) delete_button_press_cancel, @@ -6206,14 +6147,14 @@ gfig_delete_gfig_callback(GtkWidget *widget, gtk_widget_grab_default (button); gtk_object_set_user_data(GTK_OBJECT(button),widget); gtk_widget_show (button); - + /* Show! */ - + gtk_widget_set_sensitive(GTK_WIDGET(delete_frame_to_freeze), FALSE); gtk_widget_show(delete_dialog); return(FALSE); -} +} static void gfig_update_stat_labels() @@ -6225,14 +6166,14 @@ gfig_update_stat_labels() else sprintf(str,""); - gtk_label_set_text(GTK_LABEL(status_label_dname),str); + gtk_label_set(GTK_LABEL(status_label_dname),str); if(current_obj->filename) { gint slen; gchar *hm = getenv("HOME"); gchar *dfn = g_strdup(current_obj->filename); - + if(!strncmp(dfn,hm,strlen(hm)-1)) { strcpy(dfn,"~"); @@ -6253,11 +6194,11 @@ gfig_update_stat_labels() else sprintf(str,""); - gtk_label_set_text(GTK_LABEL(status_label_fname),str); + gtk_label_set(GTK_LABEL(status_label_fname),str); } -static void +static void new_obj_2edit(GFIGOBJ *obj) { GFIGOBJ * old_current = current_obj; @@ -6277,7 +6218,7 @@ new_obj_2edit(GFIGOBJ *obj) /* Change options */ update_options(old_current); - /* If have old object and NOT scaleing currently then force + /* If have old object and NOT scaleing currently then force * back to saved coord type. */ @@ -6287,7 +6228,7 @@ new_obj_2edit(GFIGOBJ *obj) update_draw_area(gfig_preview,NULL); /* And preview */ list_button_update(current_obj); - + if(obj->obj_status & GFIG_READONLY) { create_warn_dialog("Editing read-only object - you will not be able to save it"); @@ -6315,10 +6256,10 @@ edit_button_press(GtkWidget *widget, /* Get the list and which item is selected */ /* Only allow single selections */ - sellist = GTK_LIST(list)->selection; + sellist = GTK_LIST(list)->selection; sel_obj = (GFIGOBJ *)gtk_object_get_user_data(GTK_OBJECT((GtkWidget *)(sellist->data))); - + if(sel_obj) new_obj_2edit(sel_obj); else @@ -6344,7 +6285,7 @@ merge_button_press(GtkWidget *widget, /* Get the list and which item is selected */ /* Only allow single selections */ - sellist = GTK_LIST(list)->selection; + sellist = GTK_LIST(list)->selection; sel_obj = (GFIGOBJ *)gtk_object_get_user_data(GTK_OBJECT((GtkWidget *)(sellist->data))); if(sel_obj && sel_obj->obj_list && sel_obj != current_obj) @@ -6433,7 +6374,7 @@ gfig_op_menu_create(GtkWidget *window) (GtkSignalFunc)gfig_save_menu_callback, NULL); -#if 0 +#if 0 gtk_widget_install_accelerator(menu_item, accelerator_table, "activate",'S',0); @@ -6446,7 +6387,7 @@ gfig_op_menu_create(GtkWidget *window) (GtkSignalFunc)gfig_rename_menu_callback, NULL); -#if 0 +#if 0 gtk_widget_install_accelerator(menu_item, accelerator_table, "activate",'A',0); @@ -6459,7 +6400,7 @@ gfig_op_menu_create(GtkWidget *window) (GtkSignalFunc)gfig_copy_menu_callback, NULL); -#if 0 +#if 0 gtk_widget_install_accelerator(menu_item, accelerator_table, "activate",'C',0); @@ -6472,7 +6413,7 @@ gfig_op_menu_create(GtkWidget *window) (GtkSignalFunc)gfig_edit_menu_callback, NULL); -#if 0 +#if 0 gtk_widget_install_accelerator(menu_item, accelerator_table, "activate",'E',0); @@ -6538,43 +6479,43 @@ gfig_entry_update(GtkWidget *widget, gint *value) { GtkAdjustment *adjustment; gdouble new_value; - + new_value = atoi(gtk_entry_get_text(GTK_ENTRY(widget))); - + if (*value != new_value) { adjustment = gtk_object_get_user_data(GTK_OBJECT(widget)); - + if ((new_value >= adjustment->lower) && (new_value <= adjustment->upper)) { *value = new_value; adjustment->value = new_value; - + gtk_signal_emit_by_name(GTK_OBJECT(adjustment), "value_changed"); - + /*dialog_update_preview();*/ - } - } -} + } + } +} static void gfig_scale_update(GtkAdjustment *adjustment, gint *value) { GtkWidget *entry; char buf[256]; - + if (*value != adjustment->value) { *value = adjustment->value; - + entry = gtk_object_get_user_data(GTK_OBJECT(adjustment)); sprintf(buf,"%d",*value); - + gtk_signal_handler_block_by_data(GTK_OBJECT(entry), value); gtk_entry_set_text(GTK_ENTRY(entry), buf); gtk_signal_handler_unblock_by_data(GTK_OBJECT(entry), value); - + /*dialog_update_preview(); */ } -} +} static void @@ -6590,7 +6531,7 @@ gfig_scale_update_scale(GtkAdjustment *adjustment, gdouble *value) update_draw_area(gfig_preview,NULL); } } -} +} static void @@ -6598,23 +6539,23 @@ gfig_scale_update_fp(GtkAdjustment *adjustment, gdouble *value) { GtkWidget *entry; char buf[256]; - + if (*value != adjustment->value) { *value = adjustment->value; - + entry = gtk_object_get_user_data(GTK_OBJECT(adjustment)); if(entry) { sprintf(buf,"%0.3f",*value); - + gtk_signal_handler_block_by_data(GTK_OBJECT(entry), value); gtk_entry_set_text(GTK_ENTRY(entry), buf); gtk_signal_handler_unblock_by_data(GTK_OBJECT(entry), value); } - + /*dialog_update_preview(); */ } -} +} #if 0 /* NOT USED */ @@ -6623,23 +6564,23 @@ gfig_entry_update_fp(GtkWidget *widget, gdouble *value) { GtkAdjustment *adjustment; gdouble new_value; - + new_value = (double)atof(gtk_entry_get_text(GTK_ENTRY(widget))); - + if (*value != new_value) { adjustment = gtk_object_get_user_data(GTK_OBJECT(widget)); - + if ((new_value >= adjustment->lower) && (new_value <= adjustment->upper)) { *value = new_value; adjustment->value = new_value; - + gtk_signal_emit_by_name(GTK_OBJECT(adjustment), "value_changed"); - + /*dialog_update_preview();*/ - } - } -} + } + } +} #endif /* NOT USED */ /* Use to toggle the toggles */ @@ -6687,7 +6628,7 @@ gfig_toggle_update(GtkWidget *widget, /* Given a row then srink it down a bit */ static void -do_gfig_preview(guchar *dest_row, +do_gfig_preview(guchar *dest_row, guchar *src_row, gint width, gint dh, @@ -6701,11 +6642,11 @@ static void dialog_update_preview(void) { gint y; - gint check,check_0,check_1; + gint check,check_0,check_1; if(!selvals.showimage) { - memset(preview_row,-1,preview_width*4); + memset(preview_row,-1,preview_width*4); for (y = 0; y < preview_height; y++) { gtk_preview_draw_row(GTK_PREVIEW(gfig_preview), preview_row, 0, y, preview_width); } @@ -6718,7 +6659,7 @@ dialog_update_preview(void) } for (y = 0; y < preview_height; y++) { - + if ((y / CHECK_SIZE) & 1) { check_0 = CHECK_DARK; check_1 = CHECK_LIGHT; @@ -6744,18 +6685,18 @@ dialog_update_preview(void) check = check_0; else check = check_1; - + alphaval = preview_row[i + 3]; - - preview_row[j] = + + preview_row[j] = check + (((preview_row[i] - check)*alphaval)/255); - preview_row[j + 1] = + preview_row[j + 1] = check + (((preview_row[i + 1] - check)*alphaval)/255); - preview_row[j + 2] = + preview_row[j + 2] = check + (((preview_row[i + 2] - check)*alphaval)/255); } } - + gtk_preview_draw_row(GTK_PREVIEW(gfig_preview), preview_row, 0, y, preview_width); } } @@ -6775,7 +6716,7 @@ gfig_new_gc() gdk_gc_set_line_attributes (gfig_gc, 1, GDK_LINE_SOLID,GDK_CAP_BUTT,GDK_JOIN_MITER); } -static gint +static gint get_num_radials() { gint gridsp = MAX_GRID + MIN_GRID; @@ -6788,7 +6729,7 @@ get_num_radials() #define SQ_SIZE 8 -static gint +static gint inside_sqr(GdkPoint *cpnt, GdkPoint *testpnt) { /* Return TRUE if testpnt is near cpnt */ @@ -6815,15 +6756,15 @@ find_grid_pos(GdkPoint *p,GdkPoint *gp,guint is_butt3) static gdouble cons_radius; static gdouble cons_ang; static gboolean cons_center; - + if(selvals.opts.gridtype == RECT_GRID) { if(p->x % selvals.opts.gridspacing > selvals.opts.gridspacing/2) x += selvals.opts.gridspacing; - + if(p->y % selvals.opts.gridspacing > selvals.opts.gridspacing/2) y += selvals.opts.gridspacing; - + gp->x = (x/selvals.opts.gridspacing)*selvals.opts.gridspacing; gp->y = (y/selvals.opts.gridspacing)*selvals.opts.gridspacing; @@ -6841,7 +6782,7 @@ find_grid_pos(GdkPoint *p,GdkPoint *gp,guint is_butt3) } } else if(selvals.opts.gridtype == POLAR_GRID) - { + { gdouble ang_grid; gdouble ang_radius; gdouble real_radius; @@ -6985,14 +6926,14 @@ find_grid_pos(GdkPoint *p,GdkPoint *gp,guint is_butt3) if(y % selvals.opts.gridspacing > selvals.opts.gridspacing/2) y += selvals.opts.gridspacing; - + gp->y = (selvals.opts.gridspacing/2) + ((y/selvals.opts.gridspacing)*selvals.opts.gridspacing); } else { if(y % selvals.opts.gridspacing > selvals.opts.gridspacing/2) y += selvals.opts.gridspacing; - + gp->y = (y/selvals.opts.gridspacing)*selvals.opts.gridspacing; } @@ -7106,7 +7047,7 @@ toggle_obj_type(GtkWidget *widget, { GdkCursorType ctype = GDK_LAST_CURSOR; static GdkCursor* p_cursors[DEL_OBJ + 1]; - + if(selvals.otype != (DOBJTYPE)data) { @@ -7199,7 +7140,7 @@ draw_grid_polar(GdkGC *drawgc) gint lx,ly; ang_loop = loop * ang_grid; - + lx = (gint)rint(ang_radius * cos(ang_loop)); ly = (gint)rint(ang_radius * sin(ang_loop)); @@ -7254,9 +7195,9 @@ draw_grid_iso(GdkGC *drawgc) gint diagonal_end; gint diagonal_width; gint diagonal_height; - + step = selvals.opts.gridspacing; - + /* Draw the vertical lines */ for (loop = 0 ; loop < preview_width ; loop += step) { @@ -7271,13 +7212,13 @@ draw_grid_iso(GdkGC *drawgc) diagonal_start = preview_width/2; diagonal_start = diagonal_start - (diagonal_start % step); diagonal_start = -diagonal_start; - + diagonal_end = preview_height + (preview_width/2); diagonal_end = diagonal_end - (diagonal_end % step); - + diagonal_width = preview_width; diagonal_height = diagonal_width/2; - + /* Draw diagonal lines */ for (loop = diagonal_start ; loop < diagonal_end ; loop += step) { @@ -7367,10 +7308,10 @@ do_gfig(void) /* Stuff for the generation/deletion of objects. */ -/* Objects are easy one they are created - you just go down the object - * list calling the draw function for each object but... when they - * are been created we have to be a little more careful. When - * the first point is placed on the canvas we create the object, +/* Objects are easy one they are created - you just go down the object + * list calling the draw function for each object but... when they + * are been created we have to be a little more careful. When + * the first point is placed on the canvas we create the object, * the mouse position then defines the next point that can move around. * careful how we draw this position. */ @@ -7387,7 +7328,7 @@ free_all_objs(DALLOBJS * objs) { /* Free all objects */ DALLOBJS * next; - + while(objs) { free_one_obj(objs->obj); @@ -7418,7 +7359,7 @@ get_line(gchar *buf,gint s,FILE * from,gint init) /* The last newline is a pain */ if(slen > 0) buf[slen - 1] = '\0'; - + if(ferror(from)) { g_warning("Error reading file"); @@ -7482,7 +7423,7 @@ clear_undo() { int lv; - for(lv = undo_water_mark; lv >= 0; lv--) + for(lv = undo_water_mark; lv >= 0; lv--) { if(undo_table[lv]) free_all_objs(undo_table[lv]); @@ -7499,7 +7440,7 @@ setup_undo() /* Copy object list to undo buffer */ #if DEBUG printf("setup undo level [%d]\n",undo_water_mark); -#endif /*DEBUG*/ +#endif /*DEBUG*/ if(!current_obj) { @@ -7524,7 +7465,7 @@ setup_undo() } undo_table[undo_water_mark] = copy_all_objs(current_obj->obj_list); gtk_widget_set_sensitive(undo_widget,TRUE); - + gfig_obj_modified(current_obj,GFIG_MODIFIED); current_obj->obj_status |= GFIG_MODIFIED; } @@ -7613,8 +7554,8 @@ void reverse_pairs_list(gdouble *list, gint size) { int i; - struct cs { - gdouble i1; + struct cs { + gdouble i1; gdouble i2; } copyit,*orglist; @@ -7733,7 +7674,7 @@ remove_obj_from_list(GFIGOBJ *obj,DOBJECT *del_obj) /* Nearest object to given point or NULL */ DALLOBJS *all; DALLOBJS *prev_all = NULL; - + g_assert(del_obj != NULL); all = obj->obj_list; @@ -7780,10 +7721,10 @@ get_diffs(DOBJECT *obj,gint16 *xdiff, gint16 *ydiff, GdkPoint *to_pnt) g_assert(obj != NULL); spnt = obj->points; - + if(!spnt) return(NULL); /* no-line */ - + /* Slow slow slowwwwww....*/ while(spnt) { @@ -7810,7 +7751,7 @@ update_pnts(DOBJECT *obj,gint16 xdiff, gint16 ydiff) if(!spnt) return; /* no-line */ - + /* Go around all the points drawing a line from one to the next */ while(spnt) { @@ -7830,13 +7771,13 @@ do_move_all_obj(GdkPoint *to_pnt) DOBJECT *obj; gint16 xdiff = 0; gint16 ydiff = 0; - + xdiff = move_all_pnt->x - to_pnt->x; ydiff = move_all_pnt->y - to_pnt->y; - + if(!xdiff && !ydiff) return; - + all = current_obj->obj_list; while(all) @@ -7845,9 +7786,9 @@ do_move_all_obj(GdkPoint *to_pnt) /* undraw ! */ draw_one_obj(obj); - + update_pnts(obj,xdiff,ydiff); - + /* Draw in new pos */ draw_one_obj(obj); @@ -7865,20 +7806,20 @@ do_move_obj(DOBJECT *obj,GdkPoint *to_pnt) /* Then draw in new pos */ gint16 xdiff = 0; gint16 ydiff = 0; - + get_diffs(obj,&xdiff,&ydiff,to_pnt); - + if(!xdiff && !ydiff) return; - + /* undraw ! */ draw_one_obj(obj); - + update_pnts(obj,xdiff,ydiff); - + /* Draw in new pos */ draw_one_obj(obj); - + } static void @@ -7889,21 +7830,21 @@ do_move_obj_pnt(DOBJECT *obj,GdkPoint *to_pnt) DOBJPOINTS *spnt; gint16 xdiff = 0; gint16 ydiff = 0; - + spnt = get_diffs(obj,&xdiff,&ydiff,to_pnt); - + if((!xdiff && !ydiff) || !spnt) return; - + /* undraw ! */ draw_one_obj(obj); spnt->pnt.x = spnt->pnt.x - xdiff; spnt->pnt.y = spnt->pnt.y - ydiff; - + /* Draw in new pos */ draw_one_obj(obj); - + } /* Save a line away to the specified stream */ @@ -7927,7 +7868,7 @@ d_save_line(DOBJECT * obj, FILE *to) (gint)spnt->pnt.y); spnt = spnt->next; } - + fprintf(to,"\n"); } @@ -7979,7 +7920,7 @@ d_copy_line(DOBJECT *obj) g_assert(obj->type == LINE); nl = d_new_line(obj->points->pnt.x,obj->points->pnt.y); - + nl->points->next = d_copy_dobjpoints(obj->points->next); return(nl); @@ -8035,7 +7976,7 @@ d_draw_line(DOBJECT * obj) draw_sqr(&spnt->pnt); } -static void +static void d_paint_line(DOBJECT *obj) { DOBJPOINTS * spnt; @@ -8062,7 +8003,7 @@ d_paint_line(DOBJECT *obj) /* The second *2 to get around bug in GIMP */ line_pnts = g_malloc0(GFIG_LCC*(2*seg_count + 1)*sizeof(gdouble)); - + /* Go around all the points drawing a line from one to the next */ while(spnt) { @@ -8088,49 +8029,53 @@ d_paint_line(DOBJECT *obj) { case BRUSH_BRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_paintbrush", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_FLOAT,(gdouble)selvals.brushfade, PARAM_INT32,seg_count*2*GFIG_LCC,/* GIMP BUG should be 2!!!!*/ - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PENCIL_TYPE: return_vals = gimp_run_procedure ("gimp_pencil", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_INT32,seg_count*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_AIRBRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_airbrush", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_FLOAT,(gdouble)selvals.airbrushpressure, PARAM_INT32,seg_count*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PATTERN_TYPE: return_vals = gimp_run_procedure ("gimp_clone", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_DRAWABLE, gfig_drawable, PARAM_INT32, 1, PARAM_FLOAT,(gdouble)0.0, PARAM_FLOAT,(gdouble)0.0, PARAM_INT32,seg_count*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; default: break; } } - else + else { /* We want to do a selection */ return_vals = gimp_run_procedure ("gimp_free_select", &nreturn_vals, PARAM_IMAGE, gfig_image, PARAM_INT32,seg_count*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_INT32,selopt.type, PARAM_INT32,selopt.antia, PARAM_INT32,selopt.feather, @@ -8144,7 +8089,7 @@ d_paint_line(DOBJECT *obj) } -/* Create a new line object. starting at the x,y point might add styles +/* Create a new line object. starting at the x,y point might add styles * later. */ @@ -8153,7 +8098,7 @@ d_new_line(gint x, gint y) { DOBJECT *nobj; DOBJPOINTS *npnt; - + /* Get new object and starting point */ /* Start point */ @@ -8194,7 +8139,7 @@ d_delete_line(DOBJECT * obj) * pos = -1 = tail * 0 < pos = nth position */ - + static void d_pnt_add_line(DOBJECT *obj, gint x, gint y, gint pos) { @@ -8204,7 +8149,7 @@ d_pnt_add_line(DOBJECT *obj, gint x, gint y, gint pos) npnts->pnt.x = x; npnts->pnt.y = y; - + if(!pos) { /* Add to head */ @@ -8244,7 +8189,7 @@ d_update_line(GdkPoint *pnt) /* Get start of segments */ spnt = obj_creating->points; - + if(!spnt) return; /* No points */ @@ -8253,7 +8198,7 @@ d_update_line(GdkPoint *pnt) /* undraw current */ /* Draw square on point */ draw_circle(&epnt->pnt); - + gdk_draw_line(gfig_preview->window, /*gfig_preview->style->bg_gc[GTK_STATE_NORMAL],*/ gfig_gc, @@ -8263,7 +8208,7 @@ d_update_line(GdkPoint *pnt) (gint)epnt->pnt.y); g_free(epnt); } - + /* draw new */ /* Draw circle on point */ draw_circle(pnt); @@ -8295,7 +8240,7 @@ d_line_start(GdkPoint *pnt,gint shift_down) else { /* Contniuation */ - d_update_line(pnt); + d_update_line(pnt); } } @@ -8326,7 +8271,7 @@ d_line_end(GdkPoint *pnt,gint shift_down) tmp_line = obj_creating; add_to_all_obj(current_obj,obj_creating); } - + obj_creating = d_new_line(pnt->x,pnt->y); } else @@ -8376,7 +8321,7 @@ d_save_circle(DOBJECT * obj, FILE *to) (gint)spnt->pnt.y); spnt = spnt->next; } - + fprintf(to,"\n"); } @@ -8415,10 +8360,10 @@ d_load_circle(FILE *from) DOBJPOINTS *edge_pnt; /* Circles only have two points */ edge_pnt = (DOBJPOINTS *)g_malloc0(sizeof(DOBJPOINTS)); - + edge_pnt->pnt.x = xpnt; edge_pnt->pnt.y = ypnt; - + new_obj->points->next = edge_pnt; } } @@ -8504,7 +8449,7 @@ d_paint_circle(DOBJECT *obj) #endif /* DEBUG */ d_paint_poly(obj); return; - } + } /* Drawing circles is hard . @@ -8549,7 +8494,7 @@ d_paint_circle(DOBJECT *obj) PARAM_INT32,selopt.feather, PARAM_FLOAT,(gdouble)selopt.feather_radius, PARAM_END); - + gimp_destroy_params (return_vals, nreturn_vals); /* Is selection all we need ? */ @@ -8557,6 +8502,7 @@ d_paint_circle(DOBJECT *obj) return; return_vals = gimp_run_procedure ("gimp_edit_stroke", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_END); @@ -8565,7 +8511,7 @@ d_paint_circle(DOBJECT *obj) return_vals = gimp_run_procedure ("gimp_selection_clear", &nreturn_vals, PARAM_IMAGE, gfig_image, PARAM_END); - + gimp_destroy_params (return_vals, nreturn_vals); } @@ -8601,7 +8547,7 @@ d_new_circle(gint x, gint y) { DOBJECT *nobj; DOBJPOINTS *npnt; - + /* Get new object and starting point */ /* Start point */ @@ -8634,10 +8580,10 @@ d_update_circle(GdkPoint *pnt) /* Undraw last one then draw new one */ center_pnt = obj_creating->points; - + if(!center_pnt) return; /* No points */ - + if((edge_pnt = center_pnt->next)) { /* Undraw current */ @@ -8646,7 +8592,7 @@ d_update_circle(GdkPoint *pnt) (center_pnt->pnt.x - edge_pnt->pnt.x)) + ((center_pnt->pnt.y - edge_pnt->pnt.y) * (center_pnt->pnt.y - edge_pnt->pnt.y))); - + gdk_draw_arc (gfig_preview->window, gfig_gc, 0, @@ -8669,7 +8615,7 @@ d_update_circle(GdkPoint *pnt) (center_pnt->pnt.x - edge_pnt->pnt.x)) + ((center_pnt->pnt.y - edge_pnt->pnt.y) * (center_pnt->pnt.y - edge_pnt->pnt.y))); - + gdk_draw_arc (gfig_preview->window, gfig_gc, 0, @@ -8728,7 +8674,7 @@ d_save_ellipse(DOBJECT * obj, FILE *to) (gint)spnt->pnt.y); spnt = spnt->next; } - + fprintf(to,"\n"); } @@ -8767,10 +8713,10 @@ d_load_ellipse(FILE *from) DOBJPOINTS *edge_pnt; /* Circles only have two points */ edge_pnt = (DOBJPOINTS *)g_malloc0(sizeof(DOBJPOINTS)); - + edge_pnt->pnt.x = xpnt; edge_pnt->pnt.y = ypnt; - + new_obj->points->next = edge_pnt; } } @@ -8810,7 +8756,7 @@ d_draw_ellipse(DOBJECT * obj) top_x = 2*center_pnt->pnt.x - edge_pnt->pnt.x; else top_x = edge_pnt->pnt.x; - + if(edge_pnt->pnt.y > center_pnt->pnt.y) top_y = 2*center_pnt->pnt.y - edge_pnt->pnt.y; else @@ -8879,7 +8825,7 @@ d_paint_approx_ellipse(DOBJECT *obj) /* The second 2* to get around bug in GIMP */ line_pnts = g_malloc0(GFIG_LCC*(2*seg_count + 1)*sizeof(gdouble)); - + /* Go around all the points drawing a line from one to the next */ radius_pnt = center_pnt->next; /* this defines the vetices */ @@ -8895,11 +8841,11 @@ d_paint_approx_ellipse(DOBJECT *obj) { gdouble lx,ly; GdkPoint calc_pnt; - + ang_loop = (gdouble)loop * ang_grid; radius = a_axis*b_axis/(sqrt(cos(ang_loop)*cos(ang_loop)*(b_axis*b_axis - a_axis*a_axis) + a_axis*a_axis)); - + lx = radius * cos(ang_loop); ly = radius * sin(ang_loop); @@ -8946,36 +8892,40 @@ d_paint_approx_ellipse(DOBJECT *obj) { case BRUSH_BRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_paintbrush", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_FLOAT,(gdouble)selvals.brushfade, PARAM_INT32,(i/2)*2*GFIG_LCC,/* GIMP BUG should be 2!!!!*/ - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PENCIL_TYPE: return_vals = gimp_run_procedure ("gimp_pencil", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_AIRBRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_airbrush", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_FLOAT,(gdouble)selvals.airbrushpressure, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PATTERN_TYPE: return_vals = gimp_run_procedure ("gimp_clone", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_DRAWABLE, gfig_drawable, PARAM_INT32, 1, PARAM_FLOAT,(gdouble)0.0, PARAM_FLOAT,(gdouble)0.0, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; default: @@ -8988,7 +8938,7 @@ d_paint_approx_ellipse(DOBJECT *obj) return_vals = gimp_run_procedure ("gimp_free_select", &nreturn_vals, PARAM_IMAGE, gfig_image, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_INT32,selopt.type, PARAM_INT32,selopt.antia, PARAM_INT32,selopt.feather, @@ -9031,7 +8981,7 @@ d_paint_ellipse(DOBJECT *obj) #endif /* DEBUG */ d_paint_approx_ellipse(obj); return; - } + } center_pnt = obj->points; @@ -9052,7 +9002,7 @@ d_paint_ellipse(DOBJECT *obj) top_x = 2*center_pnt->pnt.x - edge_pnt->pnt.x; else top_x = edge_pnt->pnt.x; - + if(edge_pnt->pnt.y > center_pnt->pnt.y) top_y = 2*center_pnt->pnt.y - edge_pnt->pnt.y; else @@ -9081,7 +9031,7 @@ d_paint_ellipse(DOBJECT *obj) PARAM_INT32,selopt.feather, PARAM_FLOAT,(gdouble)selopt.feather_radius, PARAM_END); - + gimp_destroy_params (return_vals, nreturn_vals); /* Is selection all we need ? */ @@ -9089,6 +9039,7 @@ d_paint_ellipse(DOBJECT *obj) return; return_vals = gimp_run_procedure ("gimp_edit_stroke", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_END); @@ -9097,7 +9048,7 @@ d_paint_ellipse(DOBJECT *obj) return_vals = gimp_run_procedure ("gimp_selection_clear", &nreturn_vals, PARAM_IMAGE, gfig_image, PARAM_END); - + gimp_destroy_params (return_vals, nreturn_vals); } @@ -9133,7 +9084,7 @@ d_new_ellipse(gint x, gint y) { DOBJECT *nobj; DOBJPOINTS *npnt; - + /* Get new object and starting point */ /* Start point */ @@ -9169,29 +9120,29 @@ d_update_ellipse(GdkPoint *pnt) /* Undraw last one then draw new one */ center_pnt = obj_creating->points; - + if(!center_pnt) return; /* No points */ - + if((edge_pnt = center_pnt->next)) { /* Undraw current */ bound_wx = abs(center_pnt->pnt.x - edge_pnt->pnt.x)*2; bound_wy = abs(center_pnt->pnt.y - edge_pnt->pnt.y)*2; - + if(edge_pnt->pnt.x > center_pnt->pnt.x) top_x = 2*center_pnt->pnt.x - edge_pnt->pnt.x; else top_x = edge_pnt->pnt.x; - + if(edge_pnt->pnt.y > center_pnt->pnt.y) top_y = 2*center_pnt->pnt.y - edge_pnt->pnt.y; else top_y = edge_pnt->pnt.y; draw_circle(&edge_pnt->pnt); - + gdk_draw_arc (gfig_preview->window, gfig_gc, 0, @@ -9217,12 +9168,12 @@ d_update_ellipse(GdkPoint *pnt) top_x = 2*center_pnt->pnt.x - edge_pnt->pnt.x; else top_x = edge_pnt->pnt.x; - + if(edge_pnt->pnt.y > center_pnt->pnt.y) top_y = 2* center_pnt->pnt.y - edge_pnt->pnt.y; else top_y = edge_pnt->pnt.y; - + gdk_draw_arc (gfig_preview->window, gfig_gc, 0, @@ -9232,7 +9183,7 @@ d_update_ellipse(GdkPoint *pnt) bound_wy, 0, 360*64); - + center_pnt->next = edge_pnt; } @@ -9266,7 +9217,7 @@ void d_save_poly(DOBJECT * obj, FILE *to) { DOBJPOINTS * spnt; - + spnt = obj->points; if(!spnt) @@ -9281,7 +9232,7 @@ d_save_poly(DOBJECT * obj, FILE *to) (gint)spnt->pnt.y); spnt = spnt->next; } - + fprintf(to,"\n"); fprintf(to,"%d\n\n",(gint)obj->type_data); fprintf(to,"\n"); @@ -9331,7 +9282,7 @@ d_load_poly(FILE *from) g_warning("[%d] Internal load error while loading poly", line_no); return(NULL); - } + } /* Go around and read the last line */ continue; } @@ -9343,7 +9294,7 @@ d_load_poly(FILE *from) } return(new_obj); } - + if(!new_obj) new_obj = d_new_poly(xpnt,ypnt); else @@ -9409,7 +9360,7 @@ d_draw_poly(DOBJECT *obj) GdkPoint calc_pnt; ang_loop = (gdouble)loop * ang_grid + offset_angle; - + lx = radius * cos(ang_loop); ly = radius * sin(ang_loop); @@ -9426,7 +9377,7 @@ d_draw_poly(DOBJECT *obj) if(drawing_pic) { gdk_draw_line(pic_preview->window, - pic_preview->style->black_gc, + pic_preview->style->black_gc, adjust_pic_coords(calc_pnt.x, preview_width), adjust_pic_coords(calc_pnt.y, @@ -9511,7 +9462,7 @@ d_paint_poly(DOBJECT *obj) /* The second 2* to get around bug in GIMP */ line_pnts = g_malloc0(GFIG_LCC*(2*seg_count + 1)*sizeof(gdouble)); - + /* Go around all the points drawing a line from one to the next */ radius_pnt = center_pnt->next; /* this defines the vetices */ @@ -9530,9 +9481,9 @@ d_paint_poly(DOBJECT *obj) { gdouble lx,ly; GdkPoint calc_pnt; - + ang_loop = (gdouble)loop * ang_grid + offset_angle; - + lx = radius * cos(ang_loop); ly = radius * sin(ang_loop); @@ -9579,36 +9530,40 @@ d_paint_poly(DOBJECT *obj) { case BRUSH_BRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_paintbrush", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_FLOAT,(gdouble)selvals.brushfade, PARAM_INT32,(i/2)*2*GFIG_LCC,/* GIMP BUG should be 2!!!!*/ - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PENCIL_TYPE: return_vals = gimp_run_procedure ("gimp_pencil", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_AIRBRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_airbrush", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_FLOAT,(gdouble)selvals.airbrushpressure, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PATTERN_TYPE: return_vals = gimp_run_procedure ("gimp_clone", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_DRAWABLE, gfig_drawable, PARAM_INT32, 1, PARAM_FLOAT,(gdouble)0.0, PARAM_FLOAT,(gdouble)0.0, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; default: @@ -9621,7 +9576,7 @@ d_paint_poly(DOBJECT *obj) return_vals = gimp_run_procedure ("gimp_free_select", &nreturn_vals, PARAM_IMAGE, gfig_image, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_INT32,selopt.type, PARAM_INT32,selopt.antia, PARAM_INT32,selopt.feather, @@ -9666,7 +9621,7 @@ d_poly2lines(DOBJECT *obj) if(!center_pnt) return; /* no-line */ - /* Undraw it to start with - removes control points */ + /* Undraw it to start with - removes control points */ obj->drawfunc(obj); /* NULL out these points free later */ @@ -9690,9 +9645,9 @@ d_poly2lines(DOBJECT *obj) { gdouble lx,ly; GdkPoint calc_pnt; - + ang_loop = (gdouble)loop * ang_grid + offset_angle; - + lx = radius * cos(ang_loop); ly = radius * sin(ang_loop); @@ -9770,7 +9725,7 @@ d_star2lines(DOBJECT *obj) if(!center_pnt) return; /* no-line */ - /* Undraw it to start with - removes control points */ + /* Undraw it to start with - removes control points */ obj->drawfunc(obj); /* NULL out these points free later */ @@ -9816,7 +9771,7 @@ d_star2lines(DOBJECT *obj) { gdouble lx,ly; GdkPoint calc_pnt; - + ang_loop = (gdouble)loop * ang_grid + offset_angle; if(loop%2) @@ -9900,7 +9855,7 @@ d_new_poly(gint x, gint y) { DOBJECT *nobj; DOBJPOINTS *npnt; - + /* Get new object and starting point */ /* Start point */ @@ -9934,7 +9889,7 @@ d_update_poly(GdkPoint *pnt) /* Undraw last one then draw new one */ center_pnt = obj_creating->points; - + if(!center_pnt) return; /* No points */ @@ -9943,7 +9898,7 @@ d_update_poly(GdkPoint *pnt) * Only undraw if already have edge point. */ - /* Hack - turn off cnt points in draw routine + /* Hack - turn off cnt points in draw routine * Looking back over the other update routines I could * use this trick again and cut down on code size! */ @@ -9976,7 +9931,7 @@ d_update_poly(GdkPoint *pnt) draw_circle(&edge_pnt->pnt); } -/* first point is center +/* first point is center * next defines the radius */ @@ -10022,7 +9977,7 @@ static double line_grad(double x1,double y1, double x2, double y2) { double dx,dy; - + dx = x1 - x2; dy = y1 - y2; @@ -10061,12 +10016,12 @@ line_definition(double x1, double y1, double x2, double y2, double *lgrad, doubl /* Invert grad for perpen gradient */ *lgrad = -1.0/grad1; - + *lconst = line_cons(midx,midy,*lgrad); } -/* Arch details - * Given three points get arc radius and the co-ords +/* Arch details + * Given three points get arc radius and the co-ords * of center point. */ @@ -10116,7 +10071,7 @@ arc_details(GdkPoint *vert_a,GdkPoint *vert_b, GdkPoint *vert_c,GdkPoint *center #ifdef DEBUG printf("Area of triangle = %f\n",area); #endif /* DEBUG */ - + /* Circumcircle */ circumcircle_R = len_a*len_b*len_c/(4*area); *radius = circumcircle_R; @@ -10137,7 +10092,7 @@ arc_details(GdkPoint *vert_a,GdkPoint *vert_b, GdkPoint *vert_c,GdkPoint *center if(by > maxy) maxy = by; - + if(by < miny) miny = by; @@ -10175,7 +10130,7 @@ arc_details(GdkPoint *vert_a,GdkPoint *vert_b, GdkPoint *vert_c,GdkPoint *center if(bx > maxx) maxx = bx; - + if(bx < minx) minx = bx; @@ -10271,7 +10226,7 @@ d_save_arc(DOBJECT * obj, FILE *to) (gint)spnt->pnt.y); spnt = spnt->next; } - + fprintf(to,"\n"); } @@ -10303,7 +10258,7 @@ d_load_arc(FILE *from) } return(new_obj); } - + num_pnts++; if(!new_obj) @@ -10385,7 +10340,7 @@ arc_drawing_details(DOBJECT *obj, } arc_details(&pnt1->pnt,&pnt2->pnt,&pnt3->pnt,center_pnt,radius); - + ang1 = arc_angle(&pnt1->pnt,center_pnt); ang2 = arc_angle(&pnt2->pnt,center_pnt); ang3 = arc_angle(&pnt3->pnt,center_pnt); @@ -10396,7 +10351,7 @@ arc_drawing_details(DOBJECT *obj, if(ang3 > maxang) maxang = ang3; - + *minang = ang1; if(ang3 < *minang) @@ -10420,7 +10375,7 @@ d_draw_arc(DOBJECT * obj) return; arc_drawing_details(obj,&minang,¢er_pnt,&arcang,&radius,TRUE,FALSE); - + #ifdef DEBUG printf("Min ang = %f Arc ang = %f\n",minang,arcang); #endif /* DEBUG */ @@ -10508,7 +10463,7 @@ d_paint_arc(DOBJECT *obj) { gdouble lx,ly; GdkPoint calc_pnt; - + ang_loop = (gdouble)loop * ang_grid + minang; lx = radius * cos(ang_loop); @@ -10548,36 +10503,40 @@ d_paint_arc(DOBJECT *obj) { case BRUSH_BRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_paintbrush", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_FLOAT,(gdouble)selvals.brushfade, PARAM_INT32,(i/2)*2*GFIG_LCC,/* GIMP BUG should be 2!!!!*/ - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PENCIL_TYPE: return_vals = gimp_run_procedure ("gimp_pencil", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_AIRBRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_airbrush", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_FLOAT,(gdouble)selvals.airbrushpressure, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PATTERN_TYPE: return_vals = gimp_run_procedure ("gimp_clone", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_DRAWABLE, gfig_drawable, PARAM_INT32, 1, PARAM_FLOAT,(gdouble)0.0, PARAM_FLOAT,(gdouble)0.0, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; default: @@ -10597,14 +10556,14 @@ d_paint_arc(DOBJECT *obj) return_vals = gimp_run_procedure ("gimp_free_select", &nreturn_vals, PARAM_IMAGE, gfig_image, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_INT32,selopt.type, PARAM_INT32,selopt.antia, PARAM_INT32,selopt.feather, PARAM_FLOAT,(gdouble)selopt.feather_radius, PARAM_END); } - + gimp_destroy_params (return_vals, nreturn_vals); g_free(line_pnts); @@ -10642,7 +10601,7 @@ d_new_arc(gint x, gint y) { DOBJECT *nobj; DOBJPOINTS *npnt; - + /* Get new object and starting point */ /* Start point */ @@ -10748,7 +10707,7 @@ void d_save_star(DOBJECT * obj, FILE *to) { DOBJPOINTS * spnt; - + spnt = obj->points; if(!spnt) @@ -10763,7 +10722,7 @@ d_save_star(DOBJECT * obj, FILE *to) (gint)spnt->pnt.y); spnt = spnt->next; } - + fprintf(to,"\n"); fprintf(to,"%d\n\n",(gint)obj->type_data); fprintf(to,"\n"); @@ -10812,7 +10771,7 @@ d_load_star(FILE *from) g_warning("[%d] Internal load error while loading star", line_no); return(NULL); - } + } /* Go around and read the last line */ continue; } @@ -10824,7 +10783,7 @@ d_load_star(FILE *from) } return(new_obj); } - + if(!new_obj) new_obj = d_new_star(xpnt,ypnt); else @@ -10908,7 +10867,7 @@ d_draw_star(DOBJECT *obj) GdkPoint calc_pnt; ang_loop = (gdouble)loop * ang_grid + offset_angle; - + if(loop%2) { lx = inner_radius * cos(ang_loop); @@ -10933,7 +10892,7 @@ d_draw_star(DOBJECT *obj) if(drawing_pic) { gdk_draw_line(pic_preview->window, - pic_preview->style->black_gc, + pic_preview->style->black_gc, adjust_pic_coords(calc_pnt.x, preview_width), adjust_pic_coords(calc_pnt.y, @@ -11021,7 +10980,7 @@ d_paint_star(DOBJECT *obj) /* The second 2* to get around bug in GIMP */ line_pnts = g_malloc0(GFIG_LCC*(2*seg_count + 1)*sizeof(gdouble)); - + /* Go around all the points drawing a line from one to the next */ /* Next point defines the radius */ outer_radius_pnt = center_pnt->next; /* this defines the vetices */ @@ -11062,9 +11021,9 @@ d_paint_star(DOBJECT *obj) { gdouble lx,ly; GdkPoint calc_pnt; - + ang_loop = (gdouble)loop * ang_grid + offset_angle; - + if(loop%2) { lx = inner_radius * cos(ang_loop); @@ -11120,36 +11079,40 @@ d_paint_star(DOBJECT *obj) { case BRUSH_BRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_paintbrush", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_FLOAT,(gdouble)selvals.brushfade, PARAM_INT32,(i/2)*2*GFIG_LCC,/* GIMP BUG should be 2!!!!*/ - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PENCIL_TYPE: return_vals = gimp_run_procedure ("gimp_pencil", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_AIRBRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_airbrush", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_FLOAT,(gdouble)selvals.airbrushpressure, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PATTERN_TYPE: return_vals = gimp_run_procedure ("gimp_clone", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_DRAWABLE, gfig_drawable, PARAM_INT32, 1, PARAM_FLOAT,(gdouble)0.0, PARAM_FLOAT,(gdouble)0.0, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; default: @@ -11162,7 +11125,7 @@ d_paint_star(DOBJECT *obj) return_vals = gimp_run_procedure ("gimp_free_select", &nreturn_vals, PARAM_IMAGE, gfig_image, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_INT32,selopt.type, PARAM_INT32,selopt.antia, PARAM_INT32,selopt.feather, @@ -11206,7 +11169,7 @@ d_new_star(gint x, gint y) { DOBJECT *nobj; DOBJPOINTS *npnt; - + /* Get new object and starting point */ /* Start point */ @@ -11240,7 +11203,7 @@ d_update_star(GdkPoint *pnt) /* Undraw last one then draw new one */ center_pnt = obj_creating->points; - + if(!center_pnt) return; /* No points */ @@ -11249,7 +11212,7 @@ d_update_star(GdkPoint *pnt) * Only undraw if already have edge point. */ - /* Hack - turn off cnt points in draw routine + /* Hack - turn off cnt points in draw routine * Looking back over the other update routines I could * use this trick again and cut down on code size! */ @@ -11292,7 +11255,7 @@ d_update_star(GdkPoint *pnt) draw_circle(&inner_pnt->pnt); } -/* first point is center +/* first point is center * next defines the radius */ @@ -11320,7 +11283,7 @@ void d_save_spiral(DOBJECT * obj, FILE *to) { DOBJPOINTS * spnt; - + spnt = obj->points; if(!spnt) @@ -11335,7 +11298,7 @@ d_save_spiral(DOBJECT * obj, FILE *to) (gint)spnt->pnt.y); spnt = spnt->next; } - + fprintf(to,"\n"); fprintf(to,"%d\n\n",(gint)obj->type_data); fprintf(to,"\n"); @@ -11385,7 +11348,7 @@ d_load_spiral(FILE *from) g_warning("[%d] Internal load error while loading spiral", line_no); return(NULL); - } + } /* Go around and read the last line */ continue; } @@ -11397,7 +11360,7 @@ d_load_spiral(FILE *from) } return(new_obj); } - + if(!new_obj) new_obj = d_new_spiral(xpnt,ypnt); else @@ -11473,7 +11436,7 @@ d_draw_spiral(DOBJECT *obj) GdkPoint calc_pnt; ang_loop = (gdouble)loop * ang_grid; - + lx = sp_cons * ang_loop * cos(ang_loop)*clock_wise; ly = sp_cons * ang_loop * sin(ang_loop); @@ -11490,7 +11453,7 @@ d_draw_spiral(DOBJECT *obj) if(drawing_pic) { gdk_draw_line(pic_preview->window, - pic_preview->style->black_gc, + pic_preview->style->black_gc, adjust_pic_coords(calc_pnt.x, preview_width), adjust_pic_coords(calc_pnt.y, @@ -11585,7 +11548,7 @@ d_paint_spiral(DOBJECT *obj) GdkPoint calc_pnt; ang_loop = (gdouble)loop * ang_grid; - + lx = sp_cons * ang_loop * cos(ang_loop)*clock_wise; ly = sp_cons * ang_loop * sin(ang_loop); @@ -11623,36 +11586,40 @@ d_paint_spiral(DOBJECT *obj) { case BRUSH_BRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_paintbrush", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_FLOAT,(gdouble)selvals.brushfade, PARAM_INT32,(i/2)*2*GFIG_LCC,/* GIMP BUG should be 2!!!!*/ - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PENCIL_TYPE: return_vals = gimp_run_procedure ("gimp_pencil", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_AIRBRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_airbrush", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_FLOAT,(gdouble)selvals.airbrushpressure, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PATTERN_TYPE: return_vals = gimp_run_procedure ("gimp_clone", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_DRAWABLE, gfig_drawable, PARAM_INT32, 1, PARAM_FLOAT,(gdouble)0.0, PARAM_FLOAT,(gdouble)0.0, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; default: @@ -11665,7 +11632,7 @@ d_paint_spiral(DOBJECT *obj) return_vals = gimp_run_procedure ("gimp_free_select", &nreturn_vals, PARAM_IMAGE, gfig_image, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_INT32,selopt.type, PARAM_INT32,selopt.antia, PARAM_INT32,selopt.feather, @@ -11709,7 +11676,7 @@ d_new_spiral(gint x, gint y) { DOBJECT *nobj; DOBJPOINTS *npnt; - + /* Get new object and starting point */ /* Start point */ @@ -11743,7 +11710,7 @@ d_update_spiral(GdkPoint *pnt) /* Undraw last one then draw new one */ center_pnt = obj_creating->points; - + if(!center_pnt) return; /* No points */ @@ -11752,7 +11719,7 @@ d_update_spiral(GdkPoint *pnt) * Only undraw if already have edge point. */ - /* Hack - turn off cnt points in draw routine + /* Hack - turn off cnt points in draw routine * Looking back over the other update routines I could * use this trick again and cut down on code size! */ @@ -11785,7 +11752,7 @@ d_update_spiral(GdkPoint *pnt) draw_circle(&edge_pnt->pnt); } -/* first point is center +/* first point is center * next defines the radius */ @@ -11812,7 +11779,7 @@ void d_save_bezier(DOBJECT * obj, FILE *to) { DOBJPOINTS * spnt; - + spnt = obj->points; if(!spnt) @@ -11827,7 +11794,7 @@ d_save_bezier(DOBJECT * obj, FILE *to) (gint)spnt->pnt.y); spnt = spnt->next; } - + fprintf(to,"\n"); fprintf(to,"%d\n\n",(gint)obj->type_data); fprintf(to,"\n"); @@ -11877,7 +11844,7 @@ d_load_bezier(FILE *from) g_warning("[%d] Internal load error while loading bezier", line_no); return(NULL); - } + } /* Go around and read the last line */ continue; } @@ -11889,7 +11856,7 @@ d_load_bezier(FILE *from) } return(new_obj); } - + if(!new_obj) new_obj = d_new_bezier(xpnt,ypnt); else @@ -11946,7 +11913,7 @@ d_bz_get_array(gint *sz) static void d_bz_line() { - gint i,x0,y0,x1,y1; + gint i,x0,y0,x1,y1; g_assert((fp_pnt_cnt%4) == 0); @@ -11989,10 +11956,10 @@ typedef gdouble (*fp_pnt)[2]; void DrawBezier (gdouble (*points)[2], gint np, gdouble mid, gint depth) { - gint i,j,x0=0,y0=0,x1,y1; + gint i,j,x0=0,y0=0,x1,y1; fp_pnt left; fp_pnt right; - + if (depth==0) /* draw polyline */ { for (i=0; i=1; j--) @@ -12152,36 +12119,40 @@ d_paint_bezier(DOBJECT *obj) { case BRUSH_BRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_paintbrush", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_FLOAT,(gdouble)selvals.brushfade, PARAM_INT32,(i/2)*2*GFIG_LCC,/* GIMP BUG should be 2!!!!*/ - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PENCIL_TYPE: return_vals = gimp_run_procedure ("gimp_pencil", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_AIRBRUSH_TYPE: return_vals = gimp_run_procedure ("gimp_airbrush", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_FLOAT,(gdouble)selvals.airbrushpressure, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; case BRUSH_PATTERN_TYPE: return_vals = gimp_run_procedure ("gimp_clone", &nreturn_vals, + PARAM_IMAGE, gfig_image, PARAM_DRAWABLE, gfig_drawable, PARAM_DRAWABLE, gfig_drawable, PARAM_INT32, 1, PARAM_FLOAT,(gdouble)0.0, PARAM_FLOAT,(gdouble)0.0, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_END); break; default: @@ -12194,7 +12165,7 @@ d_paint_bezier(DOBJECT *obj) return_vals = gimp_run_procedure ("gimp_free_select", &nreturn_vals, PARAM_IMAGE, gfig_image, PARAM_INT32,(i/2)*2, - PARAM_FLOATARRAY, &line_pnts[0], + PARAM_FLOATARRAY, &line_pnts[0], PARAM_INT32,selopt.type, PARAM_INT32,selopt.antia, PARAM_INT32,selopt.feather, @@ -12239,7 +12210,7 @@ d_new_bezier(gint x, gint y) { DOBJECT *nobj; DOBJPOINTS *npnt; - + /* Get new object and starting point */ /* Start point */ @@ -12275,11 +12246,11 @@ d_update_bezier(GdkPoint *pnt) /* Undraw last one then draw new one */ s_pnt = tmp_bezier->points; - + if(!s_pnt) return; /* No points */ - /* Hack - turn off cnt points in draw routine + /* Hack - turn off cnt points in draw routine */ if((l_pnt = s_pnt->next)) @@ -12313,7 +12284,7 @@ d_update_bezier(GdkPoint *pnt) draw_circle(&l_pnt->pnt); } -/* first point is center +/* first point is center * next defines the radius */ @@ -12338,10 +12309,10 @@ d_bezier_end(GdkPoint *pnt, gint shift_down) { tmp_bezier = obj_creating; } - + l_pnt = tmp_bezier->points->next; - if(!l_pnt) + if(!l_pnt) return; if(shift_down) @@ -12440,7 +12411,7 @@ draw_one_obj(DOBJECT * obj) void draw_objects(DALLOBJS * objs,gint show_single) { - /* Show_single - only one object to draw Unless shift + /* Show_single - only one object to draw Unless shift * is down in whcih case show all. */ @@ -12482,7 +12453,7 @@ static void add_to_all_obj(GFIGOBJ * fobj,DOBJECT *obj) { DALLOBJS *nobj; - + nobj = g_malloc0(sizeof(DALLOBJS)); nobj->obj = obj; @@ -12535,7 +12506,7 @@ object_operation_start(GdkPoint *pnt,gint shift_down) d_draw_bezier(operation_obj); } /* If shift is down the break into sep lines */ - if((operation_obj->type == POLY + if((operation_obj->type == POLY || operation_obj->type == STAR) && shift_down) { @@ -12728,7 +12699,7 @@ object_start(GdkPoint *pnt,gint shift_down) break; } } - + /* Real object now !*/ void object_end(GdkPoint *pnt,gint shift_down) diff --git a/plug-ins/script-fu/script-fu-server.c b/plug-ins/script-fu/script-fu-server.c index be4f0e6282..346fa742b6 100644 --- a/plug-ins/script-fu/script-fu-server.c +++ b/plug-ins/script-fu/script-fu-server.c @@ -115,7 +115,6 @@ static void server_start (gint port, static gint execute_command (SFCommand *cmd); static gint read_from_client (gint filedes); static gint make_socket (guint port); -static guint clientname_hash (gpointer key); static void server_log (gchar *format, ...); static void server_quit (void); @@ -296,7 +295,7 @@ server_start (gint port, SFCommand *cmd; /* Set up the clientname hash table */ - clientname_ht = g_hash_table_new (clientname_hash, NULL); + clientname_ht = g_hash_table_new (g_direct_hash, NULL); /* Setup up the server log file */ if (logfile) @@ -502,12 +501,6 @@ make_socket (guint port) return sock; } -static guint -clientname_hash (gpointer key) -{ - return (int) key; -} - static void server_log (gchar *format, ...) {