diff --git a/ChangeLog b/ChangeLog index 9ebdc64344..1915989d27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2003-01-27 Maurits Rijk + + * plug-ins/common/sample_colorize.c: code clean-up, added a few more + mnemonics to dialogs. + + * plug-ins/gfig/gfig.c + * plug-ins/gflare/gflare.c + * plug-ins/FractalExplorer/FractalExplorer.c: use new + gimp_plug_in_parse_path routine. + + * libgimp/gimpmiscui.[ch] (gimp_plug_in_parse_path): new routine used + in several plug-ins. + 2003-01-27 Sven Neumann * app/gui/preferences-dialog.c: commented out debugging output. diff --git a/libgimp/gimpmiscui.c b/libgimp/gimpmiscui.c index ad7481e145..6ed40293a4 100644 --- a/libgimp/gimpmiscui.c +++ b/libgimp/gimpmiscui.c @@ -280,3 +280,64 @@ gimp_fixme_preview_fill (GimpFixMePreview *preview, g_free (src); } + +GList* +gimp_plug_in_parse_path (gchar *path_name, const gchar *dir_name) +{ + GList *path_list = NULL; + GList *fail_list = NULL; + GList *list; + gchar *path; + + path = gimp_gimprc_query (path_name); + + if (!path) + { + gchar *gimprc = gimp_personal_rc_file ("gimprc"); + gchar *full_path; + gchar *esc_path; + + full_path = g_strconcat + ("${gimp_dir}", G_DIR_SEPARATOR_S, dir_name, + G_SEARCHPATH_SEPARATOR_S, + "${gimp_data_dir}", G_DIR_SEPARATOR_S, dir_name, + NULL); + esc_path = g_strescape (full_path, NULL); + + g_message (_("No %s in gimprc:\n" + "You need to add an entry like\n" + "(%s \"%s\")\n" + "to your %s file."), path_name, path_name, esc_path, + gimprc); + + g_free (gimprc); + g_free (full_path); + g_free (esc_path); + return NULL; + } + + path_list = gimp_path_parse (path, 16, TRUE, &fail_list); + + g_free (path); + + if (fail_list) + { + GString *err = g_string_new (path_name); + g_string_append (err, _(" misconfigured - " + "the following folders were not found:")); + + for (list = fail_list; list; list = g_list_next (list)) + { + g_string_append_c (err, '\n'); + g_string_append (err, (gchar *) list->data); + } + + g_message (err->str); + + g_string_free (err, TRUE); + gimp_path_free (fail_list); + } + + return path_list; +} + diff --git a/libgimp/gimpmiscui.h b/libgimp/gimpmiscui.h index 79b6cdbff1..120d712690 100644 --- a/libgimp/gimpmiscui.h +++ b/libgimp/gimpmiscui.h @@ -68,6 +68,7 @@ void gimp_fixme_preview_do_row (GimpFixMePreview *preview, gint width, guchar *src); +GList *gimp_plug_in_parse_path (gchar *path_name, const gchar *dir_name); G_END_DECLS diff --git a/plug-ins/FractalExplorer/FractalExplorer.c b/plug-ins/FractalExplorer/FractalExplorer.c index c947c04210..0b26d412f5 100644 --- a/plug-ins/FractalExplorer/FractalExplorer.c +++ b/plug-ins/FractalExplorer/FractalExplorer.c @@ -711,11 +711,9 @@ delete_dialog_callback (GtkWidget *widget, } delete_dialog = NULL; - - return; } -static gint +static gboolean delete_fractal_callback (GtkWidget *widget, gpointer data) { @@ -765,10 +763,7 @@ fractalexplorer_list_ok_callback (GtkWidget *widget, list = options->list_entry; /* Set the new layer name */ - if (options->obj->draw_name) - { - g_free(options->obj->draw_name); - } + g_free(options->obj->draw_name); options->obj->draw_name = g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry))); @@ -785,7 +780,6 @@ fractalexplorer_list_ok_callback (GtkWidget *widget, gtk_widget_destroy (options->query_box); g_free (options); - } static void @@ -795,7 +789,7 @@ fractalexplorer_list_cancel_callback (GtkWidget *widget, fractalexplorerListOptions *options; options = (fractalexplorerListOptions *) data; - if(options->created) + if (options->created) { /* We are creating an entry so if cancelled * must del the list item as well @@ -909,9 +903,8 @@ new_button_press (GtkWidget *widget, } /* - * Load all fractalexplorer, which are founded in fractalexplorer-path-list, into fractalexplorer_list. - * fractalexplorer-path-list must be initialized first. (plug_in_parse_fractalexplorer_path ()) - * based on code from Gflare. + * Load all fractalexplorer, which are founded in fractalexplorer-path-list, + * into fractalexplorer_list. */ static gint @@ -932,7 +925,6 @@ fractalexplorer_list_pos (fractalexplorerOBJ *fractalexplorer) n++; } - return n; } @@ -1043,17 +1035,13 @@ static void list_button_update (fractalexplorerOBJ *obj) { g_return_if_fail (obj != NULL); - pic_obj = (fractalexplorerOBJ *)obj; + pic_obj = obj; } fractalexplorerOBJ * fractalexplorer_new (void) { - fractalexplorerOBJ * new; - - new = g_new0 (fractalexplorerOBJ, 1); - - return new; + return g_new0 (fractalexplorerOBJ, 1); } void @@ -1127,62 +1115,11 @@ list_button_press (GtkWidget *widget, return FALSE; } -/* - * Query gimprc for fractalexplorer-path, and parse it. - * This code is based on script_fu_find_scripts () - * and the Gflare plugin. - */ void plug_in_parse_fractalexplorer_path (void) { - GList *fail_list = NULL; - GList *list; - gchar *fractalexplorer_path; - - gimp_path_free (fractalexplorer_path_list); - fractalexplorer_path_list = NULL; - - fractalexplorer_path = gimp_gimprc_query ("fractalexplorer-path"); - - if (!fractalexplorer_path) - { - gchar *gimprc = gimp_personal_rc_file ("gimprc"); - gchar *path = g_strescape - ("${gimp_dir}" G_DIR_SEPARATOR_S "fractalexplorer" - G_SEARCHPATH_SEPARATOR_S - "${gimp_data_dir}" G_DIR_SEPARATOR_S "fractalexplorer", - NULL); - g_message (_("No fractalexplorer-path in gimprc:\n" - "You need to add an entry like\n" - "(fractalexplorer-path \"%s\")\n" - "to your %s file."), path, gimprc); - g_free (gimprc); - g_free (path); - return; - } - - fractalexplorer_path_list = gimp_path_parse (fractalexplorer_path, - 16, TRUE, &fail_list); - - g_free (fractalexplorer_path); - - if (fail_list) - { - GString *err = - g_string_new (_("fractalexplorer-path misconfigured - " - "the following folders were not found:")); - - for (list = fail_list; list; list = g_list_next (list)) - { - g_string_append_c (err, '\n'); - g_string_append (err, (gchar *) list->data); - } - - g_message (err->str); - - g_string_free (err, TRUE); - gimp_path_free (fail_list); - } + fractalexplorer_path_list = + gimp_plug_in_parse_path ("fractalexplorer-path", "fractalexplorer"); } static void @@ -1201,7 +1138,7 @@ fractalexplorer_free_everything (fractalexplorerOBJ *fractalexplorer) { g_assert (fractalexplorer != NULL); - if(fractalexplorer->filename) + if (fractalexplorer->filename) { remove (fractalexplorer->filename); } @@ -1211,15 +1148,7 @@ fractalexplorer_free_everything (fractalexplorerOBJ *fractalexplorer) static void fractalexplorer_list_free_all (void) { - GList * list; - fractalexplorerOBJ * fractalexplorer; - - for (list = fractalexplorer_list; list; list = g_list_next (list)) - { - fractalexplorer = (fractalexplorerOBJ *) list->data; - fractalexplorer_free (fractalexplorer); - } - + g_list_foreach (fractalexplorer_list, (GFunc) fractalexplorer_free, NULL); g_list_free (fractalexplorer_list); fractalexplorer_list = NULL; } @@ -1332,7 +1261,7 @@ fractalexplorer_list_load_all (GList *plist) } } - if(!fractalexplorer_list) + if (!fractalexplorer_list) { /* lets have at least one! */ fractalexplorer = fractalexplorer_new (); @@ -1340,7 +1269,6 @@ fractalexplorer_list_load_all (GList *plist) fractalexplorer_list_insert (fractalexplorer); } pic_obj = current_obj = fractalexplorer_list->data; /* set to first entry */ - } GtkWidget * @@ -1457,7 +1385,6 @@ fractalexplorer_rescan_list (void) return; } - /* the dialog */ dlg = gimp_dialog_new (_("Rescan for Fractals"), "fractalexplorer", gimp_standard_help_func, "filters/fractalexplorer.html", GTK_WIN_POS_MOUSE, diff --git a/plug-ins/common/sample_colorize.c b/plug-ins/common/sample_colorize.c index 394144c586..127566e0c1 100644 --- a/plug-ins/common/sample_colorize.c +++ b/plug-ins/common/sample_colorize.c @@ -191,6 +191,7 @@ typedef struct { * Some globals */ +static GimpRunMode run_mode; static t_samp_interface g_di; /* global dialog interface varables */ static t_values g_values = { -1, -1, 1, 1, 0, 1, 0, 255, 1.0, 0, 255, 5.5 }; static t_samp_table_elem g_lum_tab[256]; @@ -322,7 +323,6 @@ run (gchar *name, { static GimpParam values[1]; GimpDrawable *dst_drawable; - GimpRunMode run_mode; GimpPDBStatusType status = GIMP_PDB_SUCCESS; const gchar *l_env; @@ -1117,8 +1117,6 @@ p_levels_update (gint update) } } /* end p_levels_update */ - - static gint p_level_in_events (GtkWidget *widget, GdkEvent *event, @@ -2019,8 +2017,6 @@ p_get_pixel( t_GDRW *gdrw, gint32 x, gint32 y, guchar *pixel ) return; } - /* gimp_pixel_rgn_get_pixel(&gdrw->pr, pixel, x, y); */ - col = x / gdrw->tile_width; row = y / gdrw->tile_height; offx = x % gdrw->tile_width; @@ -2528,7 +2524,7 @@ p_get_gradient (gint mode) g_free (f_samples); } /* end p_get_gradient */ -gint32 +static gint32 p_is_layer_alive(gint32 drawable_id) { /* return -1 if layer has become invalid */ @@ -2539,9 +2535,9 @@ p_is_layer_alive(gint32 drawable_id) gint l_idi, l_idl; gint l_found; - if(drawable_id < 0) + if (drawable_id < 0) { - return (-1); + return -1; } /* gimp_layer_get_image_id: crash in gimp 1.1.2 if called with invalid drawable_id @@ -2555,69 +2551,59 @@ p_is_layer_alive(gint32 drawable_id) * } */ - images = gimp_image_list(&nimages); + images = gimp_image_list (&nimages); l_idi = nimages -1; l_found = FALSE; - while((l_idi >= 0) && images) + while ((l_idi >= 0) && images) { layers = gimp_image_get_layers (images[l_idi], &nlayers); - l_idl = nlayers -1; - while((l_idl >= 0) && layers) + l_idl = nlayers - 1; + while ((l_idl >= 0) && layers) { - if(drawable_id == layers[l_idl]) + if (drawable_id == layers[l_idl]) { l_found = TRUE; break; } l_idl--; } - g_free(layers); + g_free (layers); l_idi--; } - if(images) g_free(images); - if(!l_found) + g_free(images); + if (!l_found) { - printf("sample colorize: unknown layer_id %d (Image closed?)\n", (int)drawable_id); - return (-1); + printf("sample colorize: unknown layer_id %d (Image closed?)\n", + (int)drawable_id); + return -1; } - - return(drawable_id); + return drawable_id; } /* end p_is_layer_alive */ - -void +static void p_end_gdrw(t_GDRW *gdrw) { - t_GDRW *l_sel_gdrw; + t_GDRW *sel_gdrw; - if(g_Sdebug) printf("\np_end_gdrw: drawable %p ID: %d\n", gdrw->drawable, (int)gdrw->drawable->drawable_id); - - if(gdrw->tile) + if (gdrw->tile) { - if(g_Sdebug) printf("p_end_gdrw: tile unref\n"); - gimp_tile_unref( gdrw->tile, gdrw->tile_dirty); + gimp_tile_unref (gdrw->tile, gdrw->tile_dirty); gdrw->tile = NULL; } - l_sel_gdrw = (t_GDRW *)(gdrw->sel_gdrw); - if(l_sel_gdrw) + sel_gdrw = (t_GDRW*)(gdrw->sel_gdrw); + if (sel_gdrw) { - if(l_sel_gdrw->tile) + if(sel_gdrw->tile) { - if(g_Sdebug) printf("p_end_gdrw: sel_tile unref\n"); - gimp_tile_unref( l_sel_gdrw->tile, l_sel_gdrw->tile_dirty); - l_sel_gdrw->tile = NULL; - if(g_Sdebug) printf("p_end_gdrw:SEL_TILE_SWAPCOUNT: %d\n", (int)l_sel_gdrw->tile_swapcount); + gimp_tile_unref (sel_gdrw->tile, sel_gdrw->tile_dirty); + sel_gdrw->tile = NULL; } gdrw->sel_gdrw = NULL; } - - if(g_Sdebug) printf("p_end_gdrw:TILE_SWAPCOUNT: %d\n", (int)gdrw->tile_swapcount); +} -} /* end p_end_gdrw */ - - -void +static void p_init_gdrw(t_GDRW *gdrw, GimpDrawable *drawable, gint dirty, gint shadow) { gint32 l_image_id; @@ -2643,13 +2629,6 @@ p_init_gdrw(t_GDRW *gdrw, GimpDrawable *drawable, gint dirty, gint shadow) gimp_drawable_mask_bounds (drawable->drawable_id, &gdrw->x1, &gdrw->y1, &gdrw->x2, &gdrw->y2); -/* - * gimp_pixel_rgn_init (&gdrw->pr, drawable, - * gdrw->x1, gdrw->y1, gdrw->x2 - gdrw->x1, gdrw->y2 - gdrw->y1, - * dirty, shadow); - */ - - gdrw->bpp = drawable->bpp; if (gimp_drawable_has_alpha(drawable->drawable_id)) { @@ -2660,8 +2639,7 @@ p_init_gdrw(t_GDRW *gdrw, GimpDrawable *drawable, gint dirty, gint shadow) { gdrw->index_alpha = 0; /* there is no alpha channel */ } - - + l_image_id = gimp_layer_get_image_id(drawable->drawable_id); /* check and see if we have a selection mask */ @@ -2719,12 +2697,11 @@ p_init_gdrw(t_GDRW *gdrw, GimpDrawable *drawable, gint dirty, gint shadow) else { gdrw->sel_gdrw = NULL; /* selection is FALSE */ - } - + } } /* end p_init_gdrw */ /* analyze the colors in the sample_drawable */ -int +static int p_sample_analyze(t_GDRW *sample_gdrw) { gint32 l_sample_pixels; @@ -2748,8 +2725,6 @@ p_sample_analyze(t_GDRW *sample_gdrw) l_progress = 0.0; if(g_show_progress) gimp_progress_init (_("Sample Analyze...")); - - prot_fp = NULL; if(g_Sdebug) prot_fp = fopen("sample_colors.dump", "w"); p_print_values(prot_fp); @@ -2837,7 +2812,7 @@ p_sample_analyze(t_GDRW *sample_gdrw) if(prot_fp) fclose(prot_fp); /* check if there was at least one visible pixel */ - if(l_sample_pixels == 0) + if (l_sample_pixels == 0) { printf("Error: Source sample has no visible Pixel\n"); return -1; @@ -2845,7 +2820,7 @@ p_sample_analyze(t_GDRW *sample_gdrw) return 0; } /* end p_sample_analyze */ -void +static void p_rnd_remap(gint32 lum, guchar *mapped_color) { t_samp_color_elem *l_col_ptr; @@ -2853,7 +2828,7 @@ p_rnd_remap(gint32 lum, guchar *mapped_color) gint l_ct; gint l_idx; - if(g_lum_tab[lum].all_samples > 1) + if (g_lum_tab[lum].all_samples > 1) { l_rnd = g_random_int_range (0, g_lum_tab[lum].all_samples); l_ct = 0; @@ -2879,8 +2854,7 @@ p_rnd_remap(gint32 lum, guchar *mapped_color) memcpy(mapped_color, &g_sample_color_tab[lum + lum + lum], 3); } /* end p_rnd_remap */ - -void +static void p_remap_pixel(guchar *pixel, guchar *original, gint bpp2) { guchar mapped_color[4]; @@ -2891,24 +2865,30 @@ p_remap_pixel(guchar *pixel, guchar *original, gint bpp2) double l_dg, l_dr, l_db; double l_dlum; - - l_lum = g_out_trans_tab[g_lvl_trans_tab[LUMINOSITY_1(original)]]; /* get brightness from (uncolorized) original */ - if(g_values.rnd_subcolors) + /* get brightness from (uncolorized) original */ + l_lum = g_out_trans_tab[g_lvl_trans_tab[LUMINOSITY_1(original)]]; + if (g_values.rnd_subcolors) { - p_rnd_remap(l_lum, mapped_color); + p_rnd_remap (l_lum, mapped_color); } else { - memcpy(mapped_color, &g_sample_color_tab[l_lum + l_lum + l_lum], 3); + memcpy (mapped_color, &g_sample_color_tab[l_lum + l_lum + l_lum], 3); } - if(g_values.hold_inten) + if (g_values.hold_inten) { - if(g_values.orig_inten) { l_orig_lum = LUMINOSITY_0(original); } - else { l_orig_lum = 100.0 * g_lvl_trans_tab[LUMINOSITY_1(original)]; } + if (g_values.orig_inten) + { + l_orig_lum = LUMINOSITY_0(original); + } + else + { + l_orig_lum = 100.0 * g_lvl_trans_tab[LUMINOSITY_1(original)]; + } l_mapped_lum = LUMINOSITY_0(mapped_color); - if(l_mapped_lum == 0) + if (l_mapped_lum == 0) { /* convert black to greylevel with desired brightness value */ mapped_color[0] = l_orig_lum / 100.0; @@ -3028,12 +3008,12 @@ p_remap_pixel(guchar *pixel, guchar *original, gint bpp2) { /* overflow in the blue channel (compensate with green and red) */ l_dlum = (l_blu - 255.0) * 11.0; - if(l_mg > 0) + if (l_mg > 0) { l_dg = l_dlum / (59.0 + (30.0 * l_mr / l_mg)); l_dr = l_dg * l_mr / l_mg; } - else if(l_mr > 0) + else if (l_mr > 0) { l_dr = l_dlum / (30.0 + (59.0 * l_mg / l_mr)); l_dg = l_dr * l_mg / l_mr; @@ -3061,10 +3041,9 @@ p_remap_pixel(guchar *pixel, guchar *original, gint bpp2) } } - - mapped_color[0] = CLAMP(l_red + 0.5, 0, 255); - mapped_color[1] = CLAMP(l_grn + 0.5, 0, 255); - mapped_color[2] = CLAMP(l_blu + 0.5, 0, 255); + mapped_color[0] = CLAMP0255(l_red + 0.5); + mapped_color[1] = CLAMP0255(l_grn + 0.5); + mapped_color[2] = CLAMP0255(l_blu + 0.5); } } @@ -3073,96 +3052,40 @@ p_remap_pixel(guchar *pixel, guchar *original, gint bpp2) memcpy(pixel, &mapped_color[0], bpp2); } /* end p_remap_pixel */ +static void +colorize_func(guchar *src, guchar *dest, gint bpp, gpointer data) +{ + gboolean has_alpha = (gboolean) data; -void + if (has_alpha) + { + bpp--; + dest[bpp] = src[bpp]; + } + p_remap_pixel(dest, src, bpp); +} + +static void p_colorize_drawable(gint32 drawable_id) { GimpDrawable *drawable; - GimpPixelRgn pixel_rgn; - GimpPixelRgn shadow_rgn; - gpointer pr; - gint l_row, l_col; - gint l_bpp2; - gint l_has_alpha; - gint l_idx_alpha; - guchar *l_ptr; - guchar *l_row_ptr; - guchar *l_sh_ptr; - guchar *l_sh_row_ptr; - gint32 l_x1, l_x2, l_y1, l_y2; - float l_progress_step; - float l_progress; + gboolean has_alpha; - if(drawable_id < 1) return; drawable = gimp_drawable_get (drawable_id); - if(drawable == NULL) return; + has_alpha = gimp_drawable_has_alpha(drawable->drawable_id); - gimp_drawable_mask_bounds (drawable->drawable_id, &l_x1, &l_y1, &l_x2, &l_y2); - gimp_pixel_rgn_init (&pixel_rgn, drawable, - l_x1, l_y1, l_x2 - l_x1, l_y2 - l_y1, - FALSE, /* dirty */ - FALSE /* shadow */ - ); - gimp_pixel_rgn_init (&shadow_rgn, drawable, - l_x1, l_y1, l_x2 - l_x1, l_y2 - l_y1, - TRUE, /* dirty */ - TRUE /* shadow */ - ); - /* init progress */ - l_progress_step = 1.0 / ((1 + l_y2 - l_y1) * (1+ ((l_x2 - l_x1)/gimp_tile_width ()))); - l_progress = 0.0; - if(g_show_progress) gimp_progress_init (_("Remap Colorized...")); + if (g_show_progress) + gimp_progress_init (_("Remap Colorized...")); - l_bpp2 = pixel_rgn.bpp; - l_idx_alpha = pixel_rgn.bpp -1; - l_has_alpha = gimp_drawable_has_alpha(drawable->drawable_id); - if(l_has_alpha) - { - l_bpp2--; /* do not remap the alpha channel bytes */ - } - - for (pr = gimp_pixel_rgns_register (2, &pixel_rgn, &shadow_rgn); - pr != NULL; pr = gimp_pixel_rgns_process (pr)) - { - l_row_ptr = pixel_rgn.data; - l_sh_row_ptr = shadow_rgn.data; - for ( l_row = 0; l_row < pixel_rgn.h; l_row++ ) - { - l_ptr = l_row_ptr; - l_sh_ptr = l_sh_row_ptr; - for( l_col = 0; l_col < pixel_rgn.w; l_col++) - { - /* if this is a visible (non-transparent) pixel */ - if(l_has_alpha) - { - l_sh_ptr[l_idx_alpha] = l_ptr[l_idx_alpha]; - } - p_remap_pixel(l_sh_ptr, l_ptr, l_bpp2); /* set colorized pixel in shadow pr */ + gimp_rgn_iterate2 (drawable, run_mode, colorize_func, + GINT_TO_POINTER (has_alpha)); - l_ptr += pixel_rgn.bpp; - l_sh_ptr += shadow_rgn.bpp; - } - l_row_ptr += pixel_rgn.rowstride; - l_sh_row_ptr += shadow_rgn.rowstride; - if(g_show_progress) gimp_progress_update (l_progress += l_progress_step); - - } - - if(g_Sdebug) printf ("ROWS done, progress :%f\n", (float)l_progress); - } - - /* reset the progress to zero to indiciate that the plug-in has done its job */ if (g_show_progress) gimp_progress_update (0.0); - - gimp_drawable_flush (drawable); - gimp_drawable_merge_shadow (drawable->drawable_id, TRUE); - gimp_drawable_update (drawable->drawable_id, l_x1, l_y1, l_x2 - l_x1, l_y2 - l_y1); - -} /* end p_colorize_drawable */ +} /* colorize dst_drawable like sample_drawable */ -int +static int p_main_colorize(gint mc_flags) { GimpDrawable *dst_drawable; @@ -3183,41 +3106,47 @@ p_main_colorize(gint mc_flags) l_rc = 0; - if(mc_flags & MC_GET_SAMPLE_COLORS) + if (mc_flags & MC_GET_SAMPLE_COLORS) { l_id = g_values.sample_id; - if((l_id == SMP_GRADIENT) || (l_id == SMP_INV_GRADIENT)) + if ((l_id == SMP_GRADIENT) || (l_id == SMP_INV_GRADIENT)) { p_get_gradient(l_id); } else { - if(p_is_layer_alive(l_id) < 0) { return (-1); } + if (p_is_layer_alive(l_id) < 0) + { + return -1; + } sample_drawable = gimp_drawable_get (l_id); - p_init_gdrw(&l_sample_gdrw, sample_drawable, FALSE, FALSE); - p_free_colors(); - l_rc = p_sample_analyze(&l_sample_gdrw); + p_init_gdrw (&l_sample_gdrw, sample_drawable, FALSE, FALSE); + p_free_colors (); + l_rc = p_sample_analyze (&l_sample_gdrw); } } - - if((mc_flags & MC_DST_REMAP) && (l_rc == 0)) + + if ((mc_flags & MC_DST_REMAP) && (l_rc == 0)) { - if(p_is_layer_alive(g_values.dst_id) < 0) { return (-1); } + if (p_is_layer_alive(g_values.dst_id) < 0) + { + return -1; + } dst_drawable = gimp_drawable_get (g_values.dst_id); - if(gimp_drawable_is_gray(g_values.dst_id)) + if (gimp_drawable_is_gray (g_values.dst_id)) { - if(mc_flags & MC_DST_REMAP) + if (mc_flags & MC_DST_REMAP) { - gimp_convert_rgb(gimp_layer_get_image_id(g_values.dst_id)); + gimp_convert_rgb (gimp_layer_get_image_id (g_values.dst_id)); } } - p_colorize_drawable(dst_drawable->drawable_id); - } - - if(sample_drawable) - { - p_end_gdrw(&l_sample_gdrw); + p_colorize_drawable (dst_drawable->drawable_id); } - return (l_rc); + if (sample_drawable) + { + p_end_gdrw (&l_sample_gdrw); + } + + return l_rc; } /* end p_main_colorize */ diff --git a/plug-ins/gfig/gfig.c b/plug-ins/gfig/gfig.c index c301efef22..eb7c2387d1 100644 --- a/plug-ins/gfig/gfig.c +++ b/plug-ins/gfig/gfig.c @@ -769,66 +769,6 @@ run (gchar *name, gimp_drawable_detach (drawable); } -/* - * Query gimprc for gfig-path, and parse it. - */ - -static void -plug_in_parse_gfig_path (void) -{ - GList *fail_list = NULL; - GList *list; - gchar *gfig_path; - - if (gfig_path_list) - gimp_path_free (gfig_path_list); - - gfig_path_list = NULL; - - gfig_path = gimp_gimprc_query ("gfig-path"); - - if (!gfig_path) - { - gchar *gimprc = gimp_personal_rc_file ("gimprc"); - gchar *path = g_strescape - ("${gimp_dir}" G_DIR_SEPARATOR_S "gfig" - G_SEARCHPATH_SEPARATOR_S - "${gimp_data_dir}" G_DIR_SEPARATOR_S "gfig", - NULL); - g_message (_("No gfig-path in gimprc:\n" - "You need to add an entry like\n" - "(gfig-path \"%s\")\n" - "to your %s file."), - path, gimprc); - g_free (gimprc); - g_free (path); - return; - } - - gfig_path_list = gimp_path_parse (gfig_path, 16, TRUE, &fail_list); - - g_free (gfig_path); - - if (fail_list) - { - GString *err = - g_string_new (_("gfig-path misconfigured - " - "the following folders were not found:")); - - for (list = fail_list; list; list = g_list_next (list)) - { - g_string_append_c (err, '\n'); - g_string_append (err, (gchar *) list->data); - } - - g_message (err->str); - - g_string_free (err, TRUE); - gimp_path_free (fail_list); - } -} - - /* Translate SPACE to "\\040", etc. Taken from gflare plugin @@ -901,27 +841,22 @@ gfig_list_pos (GFigObj *gfig) n++; } - return n; } +/* + * Insert gfigs in alphabetical order + */ + static gint gfig_list_insert (GFigObj *gfig) { gint n; - /* - * Insert gfigs in alphabetical order - */ - n = gfig_list_pos (gfig); gfig_list = g_list_insert (gfig_list, gfig, n); -#ifdef DEBUG - printf ("gfig_list_insert %s => %d\n", gfig->draw_name, n); -#endif /* DEBUG */ - return n; } @@ -930,8 +865,7 @@ gfig_free (GFigObj *gfig) { g_assert (gfig != NULL); - if (gfig->obj_list) - free_all_objs (gfig->obj_list); + free_all_objs (gfig->obj_list); g_free (gfig->name); g_free (gfig->filename); @@ -947,28 +881,15 @@ gfig_free_everything (GFigObj *gfig) if (gfig->filename) { -#ifdef DEBUG - printf ("Removing filename '%s'\n", gfig->filename); -#endif /* DEBUG */ - remove (gfig->filename); } - gfig_free (gfig); } static void gfig_list_free_all (void) { - GList *list; - GFigObj *gfig; - - for (list = gfig_list; list; list = g_list_next (list)) - { - gfig = (GFigObj *) list->data; - gfig_free (gfig); - } - + g_list_foreach (gfig_list, (GFunc) gfig_free, NULL); g_list_free (gfig_list); gfig_list = NULL; } @@ -1040,11 +961,7 @@ gfig_list_load_all (GList *plist) static GFigObj * gfig_new (void) { - GFigObj * new; - - new = g_new0 (GFigObj, 1); - - return new; + return g_new0 (GFigObj, 1); } static void @@ -1409,13 +1326,10 @@ gfig_obj_counts (DAllObjs *objs) { gint count = 0; - while (objs) - { - count++; - objs = objs->next; - } + for (; objs; objs = objs->next) + count++; - return (count); + return count; } static void @@ -1626,16 +1540,7 @@ cache_preview (void) img_bpp = real_img_bpp; } - switch (gimp_drawable_type (gfig_select_drawable->drawable_id)) - { - case GIMP_GRAYA_IMAGE: - case GIMP_GRAY_IMAGE: - isgrey = 1; - default: - break; - } - - /*memset (p,-1, preview_width*preview_height*4); return;*/ + isgrey = gimp_drawable_is_gray (gfig_select_drawable->drawable_id); for (y = 0; y < preview_height; y++) { @@ -1748,13 +1653,8 @@ select_button_clicked (GtkWidget *widget, if (current_obj) { - objs = current_obj->obj_list; - - while (objs) - { - objs = objs->next; - count++; - } + for (objs = current_obj->obj_list; objs; objs = objs->next) + count++; } switch (type) @@ -2398,10 +2298,7 @@ gfig_brush_fill_preview (GtkWidget *pw, GimpDrawable *brushdrawable; gint bcount = 3; - if (bdesc->pv_buf) - { - g_free (bdesc->pv_buf); /* Free old area */ - } + g_free (bdesc->pv_buf); /* Free old area */ brushdrawable = gimp_drawable_get (layer_ID); @@ -3909,7 +3806,7 @@ gfig_dialog (void) yyy = gdk_rgb_get_visual (); xxx = gdk_rgb_get_colormap (); - plug_in_parse_gfig_path (); + gfig_path_list = gimp_plug_in_parse_path ("gfig-path", "gfig"); /*cache_preview (); Get the preview image and store it also set has_alpha */ @@ -4279,11 +4176,9 @@ gfig_preview_events (GtkWidget *widget, default: break; } - return FALSE; } - /* * The edit gfig name attributes dialog * Modified from Gimp source - layer edit. @@ -4338,29 +4233,15 @@ gfig_list_ok_callback (GtkWidget *widget, list = options->list_entry; /* Set the new layer name */ -#ifdef DEBUG - printf ("Found obj %s\n", options->obj->draw_name); -#endif /* DEBUG */ - - if (options->obj->draw_name) - g_free (options->obj->draw_name); + g_free (options->obj->draw_name); options->obj->draw_name = g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry))); -#ifdef DEBUG - printf ("NEW name %s\n", options->obj->draw_name); -#endif /* DEBUG */ - /* Need to reorder the list */ /* gtk_label_set_text (GTK_LABEL (options->layer_widget->label), layer->name);*/ - pos = gtk_list_child_position (GTK_LIST (gfig_gtk_list), list); -#ifdef DEBUG - printf ("pos = %d\n", pos); -#endif /* DEBUG */ - gtk_list_clear_items (GTK_LIST (gfig_gtk_list), pos, pos + 1); /* remove/Add again */ @@ -6197,8 +6078,7 @@ clear_undo (void) for (lv = undo_water_mark; lv >= 0; lv--) { - if (undo_table[lv]) - free_all_objs (undo_table[lv]); + free_all_objs (undo_table[lv]); undo_table[lv] = NULL; } @@ -6504,23 +6384,16 @@ get_diffs (Dobject *obj, g_assert (obj != NULL); - spnt = obj->points; - - if (!spnt) - return (NULL); /* no-line */ - - /* Slow slow slowwwwww....*/ - while (spnt) + for (spnt = obj->points; spnt; spnt = spnt->next) { if (spnt->found_me) { *xdiff = spnt->pnt.x - to_pnt->x; *ydiff = spnt->pnt.y - to_pnt->y; - return (spnt); + return spnt; } - spnt = spnt->next; } - return (NULL); + return NULL; } static void @@ -6533,58 +6406,42 @@ update_pnts (Dobject *obj, g_assert (obj != NULL); /* Update all pnts */ - spnt = obj->points; - - if (!spnt) - return; /* no-line */ - - /* Go around all the points drawing a line from one to the next */ - while (spnt) + for (spnt = obj->points; spnt; spnt = spnt->next) { - spnt->pnt.x = spnt->pnt.x - xdiff; - spnt->pnt.y = spnt->pnt.y - ydiff; - spnt = spnt->next; + spnt->pnt.x -= xdiff; + spnt->pnt.y -= ydiff; } } - static void do_move_all_obj (GdkPoint *to_pnt) { /* Move all objects in one go */ /* Undraw/then draw in new pos */ - DAllObjs *all; - Dobject *obj; - gint16 xdiff = 0; - gint16 ydiff = 0; + gint16 xdiff = move_all_pnt->x - to_pnt->x; + gint16 ydiff = move_all_pnt->y - to_pnt->y; - 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) + if (xdiff || ydiff) { - obj = all->obj; - - /* undraw ! */ - draw_one_obj (obj); + DAllObjs *all; + + for (all = current_obj->obj_list; all; all = all->next) + { + Dobject *obj = all->obj; + + /* undraw ! */ + draw_one_obj (obj); + + update_pnts (obj, xdiff, ydiff); + + /* Draw in new pos */ + draw_one_obj (obj); + } - update_pnts (obj, xdiff, ydiff); - - /* Draw in new pos */ - draw_one_obj (obj); - - all = all->next; + *move_all_pnt = *to_pnt; } - - *move_all_pnt = *to_pnt; /* Structure copy */ } - static void do_move_obj (Dobject *obj, GdkPoint *to_pnt) @@ -6596,17 +6453,16 @@ do_move_obj (Dobject *obj, 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); - + if (xdiff || ydiff) + { + /* undraw ! */ + draw_one_obj (obj); + + update_pnts (obj, xdiff, ydiff); + + /* Draw in new pos */ + draw_one_obj (obj); + } } static void @@ -6703,7 +6559,7 @@ d_copy_line (Dobject *obj) Dobject *nl; if (!obj) - return (NULL); + return NULL; g_assert (obj->type == LINE); @@ -6711,7 +6567,7 @@ d_copy_line (Dobject *obj) nl->points->next = d_copy_dobjpoints (obj->points->next); - return (nl); + return nl; } /* Draw the given line -- */ @@ -6772,29 +6628,19 @@ d_paint_line (Dobject *obj) gint seg_count = 0; gint i = 0; - spnt = obj->points; + for (spnt = obj->points; spnt; spnt = spnt->next) + seg_count++; - /* count */ - - while (spnt) - { - seg_count++; - spnt = spnt->next; - } - - spnt = obj->points; - - if (!spnt || !seg_count) + if (!seg_count) return; /* no-line */ line_pnts = g_new0 (gdouble, 2 * seg_count + 1); /* Go around all the points drawing a line from one to the next */ - while (spnt) + for (spnt = obj->points; spnt; spnt = spnt->next) { line_pnts[i++] = spnt->pnt.x; line_pnts[i++] = spnt->pnt.y; - spnt = spnt->next; } /* Reverse line if approp */ @@ -6827,7 +6673,6 @@ d_paint_line (Dobject *obj) g_free (line_pnts); } - /* Create a new line object. starting at the x, y point might add styles * later. */ @@ -6861,7 +6706,7 @@ d_new_line (gint x, nobj->paintfunc = d_paint_line; nobj->copyfunc = d_copy_line; - return (nobj); + return nobj; } /* You guessed it delete the object !*/ @@ -7252,10 +7097,6 @@ d_copy_circle (Dobject * obj) { Dobject *nc; -#if DEBUG - printf ("Copy circle\n"); -#endif /*DEBUG*/ - if (!obj) return NULL; @@ -7265,13 +7106,6 @@ d_copy_circle (Dobject * obj) nc->points->next = d_copy_dobjpoints (obj->points->next); -#if DEBUG - printf ("Circle (%x,%x) to (%x,%x)\n", - nc->points->pnt.x, obj->points->pnt.y, - nc->points->next->pnt.x, obj->points->next->pnt.y); - printf ("Done copy\n"); -#endif /*DEBUG*/ - return nc; } @@ -7287,10 +7121,6 @@ d_new_circle (gint x, /* Start point */ npnt = g_new0 (DobjPoints, 1); -#if DEBUG - printf ("New circle start at (%x,%x)\n", x, y); -#endif /* DEBUG */ - npnt->pnt.x = x; npnt->pnt.y = y; @@ -7405,13 +7235,8 @@ d_save_ellipse (Dobject *obj, fprintf (to, "\n"); - while (spnt) - { - fprintf (to, "%d %d\n", - spnt->pnt.x, - spnt->pnt.y); - spnt = spnt->next; - } + for (; spnt; spnt = spnt->next) + fprintf (to, "%d %d\n", spnt->pnt.x, spnt->pnt.y); fprintf (to, "\n"); } @@ -7604,8 +7429,7 @@ d_paint_approx_ellipse (Dobject *obj) if (first) { - first_pnt.x = calc_pnt.x; - first_pnt.y = calc_pnt.y; + first_pnt = calc_pnt; first = 0; } } @@ -7732,10 +7556,6 @@ d_copy_ellipse (Dobject * obj) { Dobject *nc; -#if DEBUG - printf ("Copy ellipse\n"); -#endif /*DEBUG*/ - if (!obj) return (NULL); @@ -7745,14 +7565,7 @@ d_copy_ellipse (Dobject * obj) nc->points->next = d_copy_dobjpoints (obj->points->next); -#if DEBUG - printf ("Ellipse (%x,%x) to (%x,%x)\n", - nc->points->pnt.x, obj->points->pnt.y, - nc->points->next->pnt.x, obj->points->next->pnt.y); - printf ("Done copy\n"); -#endif /* DEBUG */ - - return (nc); + return nc; } static Dobject * @@ -7913,7 +7726,6 @@ d_save_poly (Dobject * obj, FILE *to) fprintf (to, "\n"); fprintf (to, "%d\n\n", obj->type_data); fprintf (to, "\n"); - } /* Load a circle from the specified stream */ @@ -8597,7 +8409,7 @@ dist (gdouble x1, double s1 = x1 - x2; double s2 = y1 - y2; - return (sqrt ((s1*s1) + (s2*s2))); + return sqrt (s1 * s1 + s2 * s2); } /* Mid point of line returned */ @@ -8625,10 +8437,7 @@ line_grad (gdouble x1, dx = x1 - x2; dy = y1 - y2; - if (dx == 0.0) - return (0.0); /* Infinite ! */ - - return (dy/dx); + return (dx == 0.0) ? 0.0 : dy / dx; } /* Constant of line that goes through x, y with grad lgrad */ @@ -8637,7 +8446,7 @@ line_cons (gdouble x, gdouble y, gdouble lgrad) { - return (y - lgrad*x); + return y - lgrad * x; } /*Get grad & const for perpend. line to given points */ @@ -9145,8 +8954,7 @@ d_paint_arc (Dobject *obj) if (first) { - first_pnt.x = calc_pnt.x; - first_pnt.y = calc_pnt.y; + first_pnt = calc_pnt; first = 0; } } @@ -9328,7 +9136,7 @@ static void d_save_star (Dobject *obj, FILE *to) { - DobjPoints * spnt; + DobjPoints *spnt; spnt = obj->points; @@ -9671,8 +9479,7 @@ d_paint_star (Dobject *obj) if (first) { - first_pnt.x = calc_pnt.x; - first_pnt.y = calc_pnt.y; + first_pnt = calc_pnt; first = 0; } } @@ -9734,7 +9541,7 @@ d_copy_star (Dobject * obj) printf ("Done star copy\n"); #endif /* DEBUG */ - return (np); + return np; } static Dobject * @@ -9767,7 +9574,7 @@ d_new_star (gint x, nobj->paintfunc = d_paint_star; nobj->copyfunc = d_copy_star; - return (nobj); + return nobj; } static void @@ -10555,28 +10362,20 @@ d_draw_bezier (Dobject *obj) spnt = obj->points; /* First count the number of points */ + for (spnt = obj->points; spnt; spnt = spnt->next) + seg_count++; - /* count */ - while (spnt) - { - seg_count++; - spnt = spnt->next; - } - - spnt = obj->points; - - if (!spnt || !seg_count) + if (!seg_count) return; /* no-line */ line_pnts = (fp_pnt) g_new0 (gdouble, 2 * seg_count + 1); /* Go around all the points drawing a line from one to the next */ - while (spnt) + for (spnt = obj->points; spnt; spnt = spnt->next) { draw_sqr (&spnt->pnt); line_pnts[i][0] = spnt->pnt.x; line_pnts[i++][1] = spnt->pnt.y; - spnt = spnt->next; } /* Generate an array of doubles which are the control points */ @@ -10603,33 +10402,22 @@ d_paint_bezier (Dobject *obj) gdouble (*bz_line_pnts)[2]; DobjPoints *spnt; gint seg_count = 0; - gint i = 0; - spnt = obj->points; - /* First count the number of points */ + for (spnt = obj->points; spnt; spnt = spnt->next) + seg_count++; - /* count */ - while (spnt) - { - seg_count++; - spnt = spnt->next; - } - - spnt = obj->points; - - if (!spnt || !seg_count) + if (!seg_count) return; /* no-line */ bz_line_pnts = (fp_pnt) g_new0 (gdouble, 2 * seg_count + 1); /* Go around all the points drawing a line from one to the next */ - while (spnt) + for (spnt = obj->points; spnt; spnt = spnt->next) { bz_line_pnts[i][0] = spnt->pnt.x; bz_line_pnts[i++][1] = spnt->pnt.y; - spnt = spnt->next; } fp_pnt_start (); @@ -10723,7 +10511,7 @@ d_new_bezier (gint x, gint y) nobj->paintfunc = d_paint_bezier; nobj->copyfunc = d_copy_bezier; - return (nobj); + return nobj; } static void diff --git a/plug-ins/gflare/gflare.c b/plug-ins/gflare/gflare.c index 4bb8b8b789..e069b433b1 100644 --- a/plug-ins/gflare/gflare.c +++ b/plug-ins/gflare/gflare.c @@ -408,13 +408,11 @@ static void plugin_run (gchar *name, gint *nreturn_vals, GimpParam **return_vals); -static void plug_in_parse_gflare_path (void); - static GFlare * gflare_new_with_default (const gchar *new_name); -static GFlare * gflare_dup (GFlare *src, +static GFlare * gflare_dup (const GFlare *src, const gchar *new_name); static void gflare_copy (GFlare *dest, - GFlare *src); + const GFlare *src); static GFlare * gflare_load (const gchar *filename, const gchar *name); static void gflare_save (GFlare *gflare); @@ -480,9 +478,6 @@ static void gradient_menu_rescan (void); static GradientMenu * gradient_menu_new (GradientMenuCallback callback, gpointer callback_data, gchar *default_gradient_name); -/* -static void gradient_menu_destroy (GradientMenu *gm); -*/ static void gradient_name_copy (gchar *dest, const gchar *src); static void gradient_name_encode (gchar *dest, @@ -595,8 +590,8 @@ static gchar *gflare_menu_modes[] = static gint32 image_ID; static GimpDrawable *drawable; static DrawableInfo dinfo; -static TileKeeper *tk_read; -static TileKeeper *tk_write; +static GimpPixelFetcher *tk_read; +static GimpPixelFetcher *tk_write; static GFlareDialog *dlg = NULL; static GFlareEditor *ed = NULL; static GList *gflares_list = NULL; @@ -643,13 +638,6 @@ static void plugin_progress_func (gint y1, gint curr_y, gpointer data); -static TileKeeper *tile_keeper_new (gint shadow); -static guchar *tile_keeper_provide (TileKeeper *tk, - gint ix, - gint iy, - gint dirty); -static void tile_keeper_free (TileKeeper *tk); - static GFlare * gflare_new (void); static void gflare_free (GFlare *gflare); static void gflare_read_int (gint *intvar, @@ -694,12 +682,8 @@ static void calc_overlay (guchar *dest, static void dlg_ok_callback (GtkWidget *widget, gpointer data); static void dlg_setup_gflare (void); -static void dlg_page_map_callback (GtkWidget *widget, - gpointer data); -static gint dlg_preview_handle_event (GtkWidget *widget, - GdkEvent *event); -static gint ed_preview_handle_event (GtkWidget *widget, - GdkEvent *event); +static gboolean dlg_preview_handle_event (GtkWidget *widget, + GdkEvent *event); static void dlg_preview_update (void); static gint dlg_preview_init_func (Preview *preview, gpointer data); @@ -863,8 +847,6 @@ plugin_query (void) "Eiichi Takamori", "Eiichi Takamori, and a lot of GIMP people", "1997", - /* don't translate , it's a special - * keyword for the gtk toolkit */ N_("/Filters/Light Effects/GFlare..."), "RGB*, GRAY*", GIMP_PLUGIN, @@ -915,7 +897,8 @@ plugin_run (gchar *name, * Parse gflare path from gimprc and load gflares */ - plug_in_parse_gflare_path (); + gflare_path_list = + gimp_plug_in_parse_path ("gflare-path", "gflare"); gflares_list_load_all (); gimp_tile_cache_ntiles (drawable->width / gimp_tile_width () + 2); @@ -1007,65 +990,6 @@ plugin_run (gchar *name, gimp_drawable_detach (drawable); } -/* - * Query gimprc for gflare-path, and parse it. - * This code is based on script_fu_find_scripts () - */ -void -plug_in_parse_gflare_path (void) -{ - gchar *gflare_path; - - GList *fail_list = NULL; - GList *list; - - gimp_path_free (gflare_path_list); - gflare_path_list = NULL; - - gflare_path = gimp_gimprc_query ("gflare-path"); - - if (!gflare_path) - { - gchar *gimprc = gimp_personal_rc_file ("gimprc"); - gchar *path = g_strescape ("${gimp_dir}" G_DIR_SEPARATOR_S "gflare" - G_SEARCHPATH_SEPARATOR_S - "${gimp_data_dir}" G_DIR_SEPARATOR_S "gflare", - NULL); - g_message (_("No gflare-path in gimprc:\n" - "You need to add an entry like\n" - "(gflare-path \"%s\")\n" - "to your %s file."), path, gimprc); - g_free (gimprc); - g_free (path); - - return; - } - - - gflare_path_list = gimp_path_parse (gflare_path, - 16, TRUE, &fail_list); - g_free (gflare_path); - - if (fail_list) - { - GString *err = - g_string_new (_("gflare-path misconfigured - " - "the following folders were not found:")); - - for (list = fail_list; list; list = g_list_next (list)) - { - g_string_append_c (err, '\n'); - g_string_append (err, (gchar *) list->data); - } - - g_message (err->str); - - g_string_free (err, TRUE); - gimp_path_free (fail_list); - } -} - - static void plugin_do (void) { @@ -1169,8 +1093,9 @@ plugin_do_non_asupsample (void) static void plugin_do_asupsample (void) { - tk_read = tile_keeper_new (FALSE); - tk_write = tile_keeper_new (TRUE); + tk_read = gimp_pixel_fetcher_new (drawable); + tk_write = gimp_pixel_fetcher_new (drawable); + gimp_pixel_fetcher_set_shadow (tk_write, TRUE); gimp_adaptive_supersample_area (dinfo.x1, dinfo.y1, dinfo.x2 - 1, dinfo.y2 - 1, pvals.asupsample_max_depth, @@ -1181,8 +1106,9 @@ plugin_do_asupsample (void) NULL, plugin_progress_func, NULL); - tile_keeper_free (tk_read); - tile_keeper_free (tk_write); + + gimp_pixel_fetcher_destroy (tk_write); + gimp_pixel_fetcher_destroy (tk_read); } /* @@ -1200,7 +1126,7 @@ plugin_render_func (gdouble x, { guchar src_pix[4]; guchar flare_pix[4]; - guchar *src; + guchar src[4]; gint b; gint ix, iy; @@ -1209,7 +1135,7 @@ plugin_render_func (gdouble x, ix = floor (x + 0.5); iy = floor (y + 0.5); - src = tile_keeper_provide (tk_read, ix, iy, FALSE); + gimp_pixel_fetcher_get_pixel2 (tk_read, ix, iy, PIXEL_BLACK, src); for (b = 0; b < 3; b++) src_pix[b] = dinfo.is_color ? src[b] : src[0]; @@ -1229,9 +1155,7 @@ plugin_put_pixel_func (gint ix, GimpRGB *color, gpointer data) { - guchar *dest; - - dest = tile_keeper_provide (tk_write, ix, iy, TRUE); + guchar dest[4]; if (dinfo.is_color) { @@ -1244,6 +1168,8 @@ plugin_put_pixel_func (gint ix, if (dinfo.has_alpha) dest[drawable->bpp - 1] = color->a * 255; + + gimp_pixel_fetcher_put_pixel (tk_write, ix, iy, dest); } static void @@ -1255,69 +1181,6 @@ plugin_progress_func (gint y1, gimp_progress_update ((double) curr_y / (double) (y2 - y1)); } -/** -*** The Tile Keeper -**/ - -static TileKeeper * -tile_keeper_new (gint shadow) -{ - TileKeeper *tk; - - tk = g_new0 (TileKeeper, 1); - tk->tile = NULL; - tk->col = 0; - tk->row = 0; - tk->shadow = shadow; - tk->dirty = FALSE; - - return tk; -} - -/* - Return the pointer to specified pixel in allocated tile - */ -static guchar * -tile_keeper_provide (TileKeeper *tk, gint ix, gint iy, gint dirty) -{ - static guchar black[4]; - gint col, row, offx, offy; - - if (ix < 0 || ix >= drawable->width || iy < 0 || iy >= drawable->height) - { - black[0] = black[1] = black[2] = black[3] = 0; - return black; - } - - col = ix / dinfo.tile_width; - row = iy / dinfo.tile_height; - offx = ix % dinfo.tile_width; - offy = iy % dinfo.tile_height; - - if (tk->tile == NULL || col != tk->col || row != tk->row) - { - if (tk->tile) - gimp_tile_unref (tk->tile, tk->dirty); - tk->col = col; - tk->row = row; - tk->tile = gimp_drawable_get_tile (drawable, tk->shadow, row, col); - tk->dirty = FALSE; - gimp_tile_ref (tk->tile); - } - - tk->dirty |= dirty; - return tk->tile->data + (offy * tk->tile->ewidth + offx) * tk->tile->bpp; -} - -static void -tile_keeper_free (TileKeeper *tk) -{ - if (tk->tile) - gimp_tile_unref (tk->tile, tk->dirty); - g_free (tk); -} - - /*************************************************************************/ /** **/ /** +++ GFlare Routines **/ @@ -1332,32 +1195,24 @@ tile_keeper_free (TileKeeper *tk) static GFlare * gflare_new () { - GFlare *gflare; - - gflare = g_new0 (GFlare, 1); + GFlare *gflare = g_new0 (GFlare, 1); gflare->name = NULL; gflare->filename = NULL; return gflare; } -GFlare * +static GFlare * gflare_new_with_default (const gchar *new_name) { - DEBUG_PRINT (("gflare_new_with_default %s\n", new_name)); - return gflare_dup (&default_gflare, new_name); } -GFlare * -gflare_dup (GFlare *src, const gchar *new_name) +static GFlare * +gflare_dup (const GFlare *src, const gchar *new_name) { - GFlare *dest; + GFlare *dest = g_new0 (GFlare, 1); - DEBUG_PRINT (("gflare_dup %s\n", new_name)); - - dest = g_new0 (GFlare, 1); - - memcpy (dest, src, sizeof(GFlare)); + *dest = *src; dest->name = g_strdup (new_name); dest->filename = NULL; @@ -1365,17 +1220,15 @@ gflare_dup (GFlare *src, const gchar *new_name) return dest; } -void -gflare_copy (GFlare *dest, GFlare *src) +static void +gflare_copy (GFlare *dest, const GFlare *src) { gchar *name, *filename; - DEBUG_PRINT (("gflare_copy\n")); - name = dest->name; filename = dest->filename; - memcpy (dest, src, sizeof (GFlare)); + *dest = *src; dest->name = name; dest->filename =filename; @@ -1400,7 +1253,6 @@ gflare_load (const gchar *filename, const gchar *name) GFlare *gflare; gchar header[256]; - DEBUG_PRINT (("gflare_load: %s, %s\n", filename, name)); g_assert (filename != NULL); fp = fopen (filename, "r"); @@ -1473,7 +1325,6 @@ gflare_load (const gchar *filename, const gchar *name) return NULL; } - DEBUG_PRINT (("Loaded %s\n", filename)); g_free (gf); return gflare; @@ -1519,7 +1370,6 @@ gflare_read_gradient_name (GradientName name, /* @GRADIENT_NAME */ gradient_name_decode (dec, tmp); gradient_name_copy (name, dec); - DEBUG_PRINT (("read_gradient_name: \"%s\" => \"%s\"\n", tmp, dec)); } else gf->error = TRUE; @@ -1569,7 +1419,7 @@ gflare_read_mode (GFlareMode *mode, gf->error = TRUE; } -void +static void gflare_save (GFlare *gflare) { FILE *fp; @@ -1657,7 +1507,6 @@ gflare_save (GFlare *gflare) fprintf (fp, "%s %d %d\n", gflare_shapes[gflare->sflare_shape], gflare->sflare_nverts, gflare->sflare_seed); fclose (fp); - DEBUG_PRINT (("Saved %s\n", gflare->filename)); } static void @@ -1671,102 +1520,63 @@ gflare_write_gradient_name (GradientName name, FILE *fp) gradient_name_encode (enc, name); fprintf (fp, "%s\n", enc); - DEBUG_PRINT (("write_gradient_name: \"%s\" => \"%s\"\n", name, enc)); } -void +static void gflare_name_copy (gchar *dest, const gchar *src) { strncpy (dest, src, GFLARE_NAME_MAX); dest[GFLARE_NAME_MAX-1] = '\0'; } - /*************************************************************************/ /** **/ /** +++ GFlares List **/ /** **/ /*************************************************************************/ -gint +static gint +gflare_compare (const GFlare *flare1, const GFlare *flare2) +{ + return strcmp (flare1->name, flare2->name); +} + +static gint gflares_list_insert (GFlare *gflare) { - GList *tmp; - GFlare *g; - int n; - - /* - * Insert gflare in alphabetical order - */ - - n = 0; - tmp = gflares_list; - - while (tmp) - { - g = tmp->data; - - if (strcmp (gflare->name, g->name) <= 0) - break; - n++; - tmp = tmp->next; - } - num_gflares++; - gflares_list = g_list_insert (gflares_list, gflare, n); - - DEBUG_PRINT (("gflares_list_insert %s => %d\n", gflare->name, n)); - - return n; + gflares_list = g_list_insert_sorted (gflares_list, gflare, + (GCompareFunc) gflare_compare); + return gflares_list_index (gflare); } -GFlare * +static gint +gflare_compare_name (const GFlare *flare, const gchar *name) +{ + return strcmp (flare->name, name); +} + +static GFlare * gflares_list_lookup (const gchar *name) { - GList *tmp; - GFlare *gflare; - - DEBUG_PRINT (("gflares_list_lookup %s\n", name)); - - tmp = gflares_list; - while (tmp) - { - gflare = tmp->data; - tmp = tmp->next; - if (strcmp (gflare->name, name) == 0) - return gflare; - } - return NULL; + GList *llink; + llink = g_list_find_custom (gflares_list, name, + (GCompareFunc) gflare_compare_name); + return (llink) ? llink->data : NULL; } -gint +static gint gflares_list_index (GFlare *gflare) { - GList *tmp; - gint n; - - DEBUG_PRINT (("gflares_list_index %s\n", gflare->name)); - - n = 0; - tmp = gflares_list; - while (tmp) - { - if (tmp->data == gflare) - return n; - tmp = tmp->next; - n++; - } - return -1; + return g_list_index (gflares_list, gflare); } -gint +static gint gflares_list_remove (GFlare *gflare) { GList *tmp; gint n; - DEBUG_PRINT (("gflares_list_remove %s\n", gflare->name)); - n = 0; tmp = gflares_list; while (tmp) @@ -1786,11 +1596,9 @@ gflares_list_remove (GFlare *gflare) } /* - Load all gflares, which are founded in gflare-path-list, into gflares_list. - - gflares-path-list must be initialized first. (plug_in_parse_gflare_path ()) + * Load all gflares, which are founded in gflare-path-list, into gflares_list. */ -void +static void gflares_list_load_all (void) { GFlare *gflare; @@ -1800,11 +1608,6 @@ gflares_list_load_all (void) GDir *dir; const gchar *dir_ent; -#if 0 /* @@@ */ - printf("Waiting... (pid %d)\n", getpid()); - kill(getpid(), 19); /* SIGSTOP */ -#endif - /* Make sure to clear any existing gflares */ gflares_list_free_all (); @@ -1841,26 +1644,14 @@ gflares_list_load_all (void) } } -void +static void gflares_list_free_all (void) { - GList *list; - GFlare *gflare; - - list = gflares_list; - while (list) - { - gflare = (GFlare *) list->data; - gflare_free (gflare); - list = list->next; - } - + g_list_foreach (gflares_list, (GFunc) gflare_free, NULL); g_list_free (gflares_list); gflares_list = NULL; } - - /*************************************************************************/ /** **/ /** +++ Calculator **/ @@ -1876,13 +1667,12 @@ gflares_list_free_all (void) * must call calc_deinit() when job is done. */ -void +static void calc_init_params (GFlare *gflare, gint calc_type, gdouble xcenter, gdouble ycenter, gdouble radius, gdouble rotation, gdouble hue, gdouble vangle, gdouble vlength) { - DEBUG_PRINT (("//// calc_init_params ////\n")); calc.type = calc_type; calc.gflare = gflare; calc.xcenter = xcenter; @@ -1941,7 +1731,7 @@ calc_init_params (GFlare *gflare, gint calc_type, calc.init = TRUE; } -int +static int calc_init_progress () { if (calc_sample_one_gradient ()) @@ -2057,8 +1847,6 @@ calc_place_sflare () if ((calc.type & CALC_SFLARE) == 0) return; - DEBUG_PRINT (("calc_place_sflare\n")); - gflare = calc.gflare; /* @@ -2113,26 +1901,16 @@ calc_place_sflare () g_rand_free (gr); } - -void +static void calc_deinit () { - GList *list; - - DEBUG_PRINT (("\\\\\\\\ calc_deinit \\\\\\\\ \n")); - if (!calc.init) { g_warning("calc_deinit: not initialized"); return; } - list = calc.sflare_list; - while (list) - { - g_free (list->data); - list = list->next; - } + g_list_foreach (calc.sflare_list, (GFunc) g_free, NULL); g_list_free (calc.sflare_list); g_free (calc.glow_radial); @@ -2196,7 +1974,7 @@ fmod_positive (gdouble x, gdouble m) * OUTPUT: * guchar pix[4] */ -void +static void calc_glow_pix (guchar *dest_pix, gdouble x, gdouble y) { gdouble radius, angle; @@ -2222,7 +2000,7 @@ calc_glow_pix (guchar *dest_pix, gdouble x, gdouble y) /* angular_size gradient was grayfied already */ angular_size = size_pix[0] / 255.0; radius /= (angular_size+0.0001); /* in case angular_size == 0.0 */ - if(radius < 0 || radius > 1) + if (radius < 0 || radius > 1) { memset (dest_pix, 0, 4); return; @@ -2239,7 +2017,7 @@ calc_glow_pix (guchar *dest_pix, gdouble x, gdouble y) * Calc rays's pixel (RGBA) value * */ -void +static void calc_rays_pix (guchar *dest_pix, gdouble x, gdouble y) { gdouble radius, angle; @@ -2284,10 +2062,8 @@ calc_rays_pix (guchar *dest_pix, gdouble x, gdouble y) for (i = 0; i < 3; i++) dest_pix[i] = radial_pix[i] * angular_pix[i] / 255; dest_pix[3] = spike_inten * radial_pix[3] * angular_pix[3] / 255; - } - /* * Calc sflare's pixel (RGBA) value * @@ -2343,9 +2119,7 @@ calc_sflare_pix (guchar *dest_pix, gdouble x, gdouble y, guchar *src_pix) } } - - -void +static void calc_gflare_pix (guchar *dest_pix, gdouble x, gdouble y, guchar *src_pix) { GFlare *gflare = calc.gflare; @@ -2485,7 +2259,7 @@ calc_overlay (guchar *dest, guchar *src1, guchar *src2) This is gflare main dialog, one which opens in first. */ -gint +static gint dlg_run (void) { GtkWidget *shell; @@ -2594,33 +2368,20 @@ dlg_run (void) */ notebook = dlg->notebook = gtk_notebook_new (); - gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP); gtk_box_pack_start (GTK_BOX (hbox), notebook, TRUE, TRUE, 0); gtk_widget_show (notebook); dlg_make_page_settings (dlg, notebook); dlg_make_page_selector (dlg, notebook); - DEBUG_PRINT (("shell is shown\n")); gtk_widget_show (shell); - /* - * Make sure the selector page is realized - * This idea is from app/layers_dialog.c - */ -#if 0 - gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 1); - gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 0); -#endif - /* * Initialization done */ dlg->init = FALSE; dlg_preview_update (); - DEBUG_PRINT (("dlg init done\n")); - gtk_main (); gdk_flush (); @@ -2631,7 +2392,6 @@ static void dlg_ok_callback (GtkWidget *widget, gpointer data) { - /* @GFLARE_NAME */ gflare_name_copy (pvals.gflare_name, dlg->gflare->name); pint.run = TRUE; @@ -2643,10 +2403,10 @@ dlg_setup_gflare (void) { dlg->gflare = gflares_list_lookup (pvals.gflare_name); - if (dlg->gflare == NULL) + if (!dlg->gflare) { dlg->gflare = gflares_list_lookup ("Default"); - if (dlg->gflare == NULL) + if (!dlg->gflare) { g_warning (_("`Default' is created.")); dlg->gflare = gflare_new_with_default (_("Default")); @@ -2655,12 +2415,6 @@ dlg_setup_gflare (void) } } -static void -dlg_page_map_callback (GtkWidget *widget, gpointer data) -{ - /* dlg_preview_update (); */ -} - /***********************************/ /** Main Dialog / Preview **/ /***********************************/ @@ -2728,7 +2482,7 @@ ed_preview_calc_window (void) } } -gint +static gboolean dlg_preview_handle_event (GtkWidget *widget, GdkEvent *event) { GdkEventButton *bevent; @@ -2746,53 +2500,6 @@ dlg_preview_handle_event (GtkWidget *widget, GdkEvent *event) * bx / DLG_PREVIEW_WIDTH; y = dlg->pwin.y0 + (double) (dlg->pwin.y1 - dlg->pwin.y0) * by / DLG_PREVIEW_HEIGHT; - DEBUG_PRINT (("dlg_preview_handle_event: bxy [%d,%d] xy [%d,%d]\n", - bx, by, x, y)); - - if ((x != pvals.xcenter || y != pvals.ycenter)) - { - if (x != pvals.xcenter) - { - pvals.xcenter = x; - gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (dlg->sizeentry), - 0, x); - } - if (y != pvals.ycenter) - { - pvals.ycenter = y; - gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (dlg->sizeentry), - 1, y); - } - dlg_preview_update (); - } - return TRUE; - default: - break; - } - return FALSE; -} - -gint -ed_preview_handle_event (GtkWidget *widget, - GdkEvent *event) -{ - GdkEventButton *bevent; - gint bx, by, x, y; - - switch (event->type) - { - case GDK_BUTTON_PRESS: - bevent = (GdkEventButton *) event; - bx = bevent->x; - by = bevent->y; - - /* convert widget coord to drawable coord */ - x = dlg->pwin.x0 + (double) (dlg->pwin.x1 - dlg->pwin.x0) - * bx / DLG_PREVIEW_WIDTH; - y = dlg->pwin.y0 + (double) (dlg->pwin.y1 - dlg->pwin.y0) - * by / DLG_PREVIEW_HEIGHT; - DEBUG_PRINT (("dlg_preview_handle_event: bxy [%d,%d] xy [%d,%d]\n", - bx, by, x, y)); if ((x != pvals.xcenter || y != pvals.ycenter)) { @@ -2820,10 +2527,7 @@ ed_preview_handle_event (GtkWidget *widget, static void dlg_preview_update () { - if (dlg->init) - return; - - if (dlg->update_preview) + if (!dlg->init && dlg->update_preview) { dlg->init_params_done = FALSE; preview_render_start (dlg->preview); @@ -3093,18 +2797,11 @@ dlg_make_page_settings (GFlareDialog *dlg, G_CALLBACK (gimp_double_adjustment_update), &pvals.asupsample_threshold); - /* - * Create Page - */ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), main_vbox, gtk_label_new_with_mnemonic (_("_Settings"))); - g_signal_connect (table, "map", - G_CALLBACK (dlg_page_map_callback), - (gpointer) PAGE_SETTINGS); gtk_widget_show (main_vbox); } - static void dlg_position_entry_callback (GtkWidget *widget, gpointer data) { @@ -3207,18 +2904,11 @@ dlg_make_page_selector (GFlareDialog *dlg, gtk_widget_show (vbox); - /* - * Create Page - */ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, gtk_label_new_with_mnemonic (_("S_elector"))); - g_signal_connect (vbox, "map", - G_CALLBACK (dlg_page_map_callback), - (gpointer) PAGE_SELECTOR); gtk_widget_show (vbox); } - /* * Set up selector's listbox, according to gflares_list */ @@ -3229,8 +2919,6 @@ dlg_selector_setup_listbox (void) GFlare *gflare; gint n; - DEBUG_PRINT (("dlg_selector_setup_listbox\n")); - list = gflares_list; n = 0; @@ -3262,8 +2950,6 @@ dlg_selector_insert (GFlare *gflare, GtkWidget *list_item; GList *list; - DEBUG_PRINT (("dlg_selector_insert %s %d\n", gflare->name, pos)); - list_item = gtk_list_item_new_with_label (gflare->name); /* gflare->list_item = list_item; */ g_signal_connect (list_item, "select", @@ -3282,15 +2968,13 @@ static void dlg_selector_list_item_callback (GtkWidget *widget, gpointer data) { - if (widget->state != GTK_STATE_SELECTED) - return; - - dlg->gflare = data; - - dlg_preview_update (); + if (widget->state == GTK_STATE_SELECTED) + { + dlg->gflare = data; + dlg_preview_update (); + } } - /* * "New" button in Selector page */ @@ -3587,7 +3271,7 @@ ed_run (GtkWindow *parent, gtk_widget_set_events (GTK_WIDGET (ed->preview->widget), DLG_PREVIEW_MASK); gtk_container_add (GTK_CONTAINER (frame), ed->preview->widget); g_signal_connect (ed->preview->widget, "event", - G_CALLBACK (ed_preview_handle_event), + G_CALLBACK (dlg_preview_handle_event), NULL); ed_preview_calc_window (); @@ -3744,11 +3428,8 @@ ed_make_page_general (GFlareEditor *ed, _("Paint Mode:"), 1.0, 0.5, option_menu, 1, TRUE); - /* - * Create Page - */ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, - gtk_label_new (_("General"))); + gtk_label_new (_("_General"))); g_signal_connect (vbox, "map", G_CALLBACK (ed_page_map_callback), (gpointer) PAGE_GENERAL); @@ -3852,11 +3533,8 @@ ed_make_page_glow (GFlareEditor *ed, gtk_widget_show (table); - /* - * Create Page - */ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, - gtk_label_new (_("Glow"))); + gtk_label_new (_("G_low"))); g_signal_connect (vbox, "map", G_CALLBACK (ed_page_map_callback), (gpointer) PAGE_GLOW); @@ -3987,11 +3665,8 @@ ed_make_page_rays (GFlareEditor *ed, gtk_widget_show (table); - /* - * Create Pages - */ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, - gtk_label_new (_("Rays"))); + gtk_label_new (_("_Rays"))); g_signal_connect (vbox, "map", G_CALLBACK (ed_page_map_callback), (gpointer) PAGE_RAYS); @@ -4185,11 +3860,8 @@ ed_make_page_sflare (GFlareEditor *ed, G_CALLBACK (ed_preview_update), NULL); - /* - * Create Pages - */ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, - gtk_label_new (_("Second Flares"))); + gtk_label_new (_("_Second Flares"))); g_signal_connect (vbox, "map", G_CALLBACK (ed_page_map_callback), (gpointer) PAGE_SFLARE); @@ -4415,7 +4087,6 @@ ed_preview_render_general (guchar *buffer, gint y) } } - static void ed_preview_render_glow (guchar *buffer, gint y) { @@ -4473,7 +4144,7 @@ ed_preview_render_sflare (guchar *buffer, gint y) /* Routines to render the preview in background */ -Preview * +static Preview * preview_new (gint width, gint height, PreviewInitFunc init_func, @@ -4506,7 +4177,7 @@ preview_new (gint width, return preview; } -void +static void preview_free (Preview *preview) { preview_render_end (preview); @@ -4515,16 +4186,13 @@ preview_free (Preview *preview) g_free (preview); } - /* Start rendering of the preview in background using an idle event. If already started and not yet finished, stop it first. */ -void +static void preview_render_start (Preview *preview) { - DEBUG_PRINT(("preview_render_start\n")); - preview_render_end (preview); preview->init_done = FALSE; @@ -4541,8 +4209,7 @@ preview_render_start_2 (Preview *preview) return FALSE; } - -void +static void preview_render_end (Preview *preview) { if (preview->timeout_tag > 0) @@ -4557,7 +4224,6 @@ preview_render_end (Preview *preview) gtk_idle_remove (preview->idle_tag); preview->idle_tag = 0; - DEBUG_PRINT(("preview_render_end\n\n")); } } @@ -4617,7 +4283,7 @@ preview_handle_idle (Preview *preview) output: guchar dest[3] RGB pixel */ -void +static void preview_rgba_to_rgb (guchar *dest, gint x, gint y, @@ -4662,14 +4328,14 @@ preview_rgba_to_rgb (guchar *dest, /** **/ /*************************************************************************/ -void +static void gradient_menu_init () { gm_gradient_get_list (); gradient_menus = NULL; } -void +static void gradient_menu_rescan () { GList *tmp; @@ -4722,7 +4388,7 @@ gradient_menu_rescan () } } -GradientMenu * +static GradientMenu * gradient_menu_new (GradientMenuCallback callback, gpointer callback_data, gchar *default_gradient_name) @@ -4757,17 +4423,6 @@ gradient_menu_new (GradientMenuCallback callback, return gm; } -/* -static void -gradient_menu_destroy (GradientMenu *gm) -{ - gtk_widget_destroy (gm->preview); - gtk_widget_destroy (gm->option_menu); - - g_free (gm); -} -*/ - /* Local Functions */ static void @@ -4979,7 +4634,7 @@ gm_option_menu_destroy_callback (GtkWidget *w, */ -void +static void gradient_name_copy (gchar *dest, const gchar *src) { @@ -4990,7 +4645,7 @@ gradient_name_copy (gchar *dest, /* Translate SPACE to "\\040", etc. */ -void +static void gradient_name_encode (gchar *dest, const gchar *src) { @@ -5012,7 +4667,7 @@ gradient_name_encode (gchar *dest, /* Translate "\\040" to SPACE, etc. */ -void +static void gradient_name_decode (gchar *dest, const gchar *src) { @@ -5033,21 +4688,20 @@ gradient_name_decode (gchar *dest, *dest = '\0'; } - -void +static void gradient_init (void) { gradient_cache_head = NULL; gradient_cache_count = 0; } -void +static void gradient_free (void) { gradient_cache_flush (); } -gchar ** +static gchar ** gradient_get_list (gint *num_gradients) { gchar **gradients; @@ -5074,13 +4728,11 @@ gradient_get_list (gint *num_gradients) return gradients; } -void +static void gradient_get_values (gchar *gradient_name, guchar *values, gint nvalues) { - /* DEBUG_PRINT (("gradient_get_values: %s %d\n", gradient_name, nvalues)); */ - /* Criteria to distinguish internal and external is rather simple here. It should be fixed later.