renamed again, to gimp_palette_[gs]et_columns this time.

2005-03-09  Sven Neumann  <sven@gimp.org>

	* app/core/gimppalette.[ch]: renamed again, to
	gimp_palette_[gs]et_columns this time.

	* app/dialogs/palette-import-dialog.c
	* app/widgets/gimppaletteeditor.c: changed accordingly.

	* tools/pdbgen/pdb/palette.pdb: renamed newly added PDB function.
	Also added a getter for the columns.

	* app/pdb/internal_procs.c
	* app/pdb/palette_cmds.c
	* libgimp/gimppalette_pdb.[ch]: regenerated.

	* libgimp/gimp.def: updated.
This commit is contained in:
Sven Neumann 2005-03-09 00:50:09 +00:00 committed by Sven Neumann
parent f41e059067
commit 3285ee6ef5
15 changed files with 237 additions and 75 deletions

View File

@ -1,3 +1,20 @@
2005-03-09 Sven Neumann <sven@gimp.org>
* app/core/gimppalette.[ch]: renamed again, to
gimp_palette_[gs]et_columns this time.
* app/dialogs/palette-import-dialog.c
* app/widgets/gimppaletteeditor.c: changed accordingly.
* tools/pdbgen/pdb/palette.pdb: renamed newly added PDB function.
Also added a getter for the columns.
* app/pdb/internal_procs.c
* app/pdb/palette_cmds.c
* libgimp/gimppalette_pdb.[ch]: regenerated.
* libgimp/gimp.def: updated.
2005-03-09 Michael Natterer <mitch@gimp.org>
More sample point stuff. Addresses bug #137776.

View File

@ -692,8 +692,8 @@ gimp_palette_delete_entry (GimpPalette *palette,
}
void
gimp_palette_set_num_columns (GimpPalette *palette,
gint columns)
gimp_palette_set_columns (GimpPalette *palette,
gint columns)
{
g_return_if_fail (GIMP_IS_PALETTE (palette));
@ -708,7 +708,7 @@ gimp_palette_set_num_columns (GimpPalette *palette,
}
gint
gimp_palette_get_num_columns (GimpPalette *palette)
gimp_palette_get_columns (GimpPalette *palette)
{
g_return_val_if_fail (GIMP_IS_PALETTE (palette), 0);

View File

@ -692,8 +692,8 @@ gimp_palette_delete_entry (GimpPalette *palette,
}
void
gimp_palette_set_num_columns (GimpPalette *palette,
gint columns)
gimp_palette_set_columns (GimpPalette *palette,
gint columns)
{
g_return_if_fail (GIMP_IS_PALETTE (palette));
@ -708,7 +708,7 @@ gimp_palette_set_num_columns (GimpPalette *palette,
}
gint
gimp_palette_get_num_columns (GimpPalette *palette)
gimp_palette_get_columns (GimpPalette *palette)
{
g_return_val_if_fail (GIMP_IS_PALETTE (palette), 0);

View File

@ -692,8 +692,8 @@ gimp_palette_delete_entry (GimpPalette *palette,
}
void
gimp_palette_set_num_columns (GimpPalette *palette,
gint columns)
gimp_palette_set_columns (GimpPalette *palette,
gint columns)
{
g_return_if_fail (GIMP_IS_PALETTE (palette));
@ -708,7 +708,7 @@ gimp_palette_set_num_columns (GimpPalette *palette,
}
gint
gimp_palette_get_num_columns (GimpPalette *palette)
gimp_palette_get_columns (GimpPalette *palette)
{
g_return_val_if_fail (GIMP_IS_PALETTE (palette), 0);

View File

@ -62,25 +62,25 @@ struct _GimpPaletteClass
};
GType gimp_palette_get_type (void) G_GNUC_CONST;
GType gimp_palette_get_type (void) G_GNUC_CONST;
GimpData * gimp_palette_new (const gchar *name,
gboolean stingy_memory_use);
GimpData * gimp_palette_get_standard (void);
GList * gimp_palette_load (const gchar *filename,
gboolean stingy_memory_use,
GError **error);
GimpData * gimp_palette_new (const gchar *name,
gboolean stingy_memory_use);
GimpData * gimp_palette_get_standard (void);
GList * gimp_palette_load (const gchar *filename,
gboolean stingy_memory_use,
GError **error);
GimpPaletteEntry * gimp_palette_add_entry (GimpPalette *palette,
gint position,
const gchar *name,
const GimpRGB *color);
void gimp_palette_delete_entry (GimpPalette *palette,
GimpPaletteEntry *entry);
GimpPaletteEntry * gimp_palette_add_entry (GimpPalette *palette,
gint position,
const gchar *name,
const GimpRGB *color);
void gimp_palette_delete_entry (GimpPalette *palette,
GimpPaletteEntry *entry);
void gimp_palette_set_num_columns (GimpPalette *palette,
gint columns);
gint gimp_palette_get_num_columns (GimpPalette *palette);
void gimp_palette_set_columns (GimpPalette *palette,
gint columns);
gint gimp_palette_get_columns (GimpPalette *palette);
#endif /* __GIMP_PALETTE_H__ */

View File

@ -641,12 +641,11 @@ palette_import_file_callback (GtkWidget *widget,
}
static void
palette_import_columns_changed (GtkAdjustment *adjustment,
palette_import_columns_changed (GtkAdjustment *adj,
ImportDialog *import_dialog)
{
if (import_dialog->palette)
gimp_palette_set_num_columns (import_dialog->palette,
ROUND (adjustment->value));
gimp_palette_set_columns (import_dialog->palette, ROUND (adj->value));
}
/* functions & callbacks to keep the import dialog uptodate ****************/

View File

@ -74,7 +74,7 @@ void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 454 procedures registered total */
/* 455 procedures registered total */
void
internal_procs_init (Gimp *gimp,
@ -101,7 +101,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Context"), 0.123);
register_context_procs (gimp);
(* status_callback) (NULL, _("Convert"), 0.172);
(* status_callback) (NULL, _("Convert"), 0.171);
register_convert_procs (gimp);
(* status_callback) (NULL, _("Display procedures"), 0.178);
@ -116,64 +116,64 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Edit procedures"), 0.297);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.317);
(* status_callback) (NULL, _("File Operations"), 0.316);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.339);
(* status_callback) (NULL, _("Floating selections"), 0.338);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.352);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Fonts"), 0.359);
(* status_callback) (NULL, _("Fonts"), 0.358);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.363);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient"), 0.377);
(* status_callback) (NULL, _("Gradient"), 0.376);
register_gradient_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.443);
(* status_callback) (NULL, _("Gradient UI"), 0.442);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.449);
(* status_callback) (NULL, _("Gradients"), 0.448);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.46);
(* status_callback) (NULL, _("Guide procedures"), 0.459);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.474);
(* status_callback) (NULL, _("Help procedures"), 0.473);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.476);
(* status_callback) (NULL, _("Image"), 0.475);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.612);
(* status_callback) (NULL, _("Layer"), 0.611);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.672);
(* status_callback) (NULL, _("Message procedures"), 0.67);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.678);
(* status_callback) (NULL, _("Miscellaneous"), 0.677);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.683);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.681);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.716);
(* status_callback) (NULL, _("Palette"), 0.714);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.744);
(* status_callback) (NULL, _("Palette UI"), 0.745);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.751);
(* status_callback) (NULL, _("Palettes"), 0.752);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.76);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.786);
(* status_callback) (NULL, _("Paths"), 0.787);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern"), 0.822);
@ -185,13 +185,13 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Patterns"), 0.833);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.841);
(* status_callback) (NULL, _("Plug-in"), 0.842);
register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.852);
(* status_callback) (NULL, _("Procedural database"), 0.853);
register_procedural_db_procs (gimp);
(* status_callback) (NULL, _("Progress"), 0.872);
(* status_callback) (NULL, _("Progress"), 0.873);
register_progress_procs (gimp);
(* status_callback) (NULL, _("Image mask"), 0.888);

View File

@ -41,7 +41,8 @@ static ProcRecord palette_rename_proc;
static ProcRecord palette_delete_proc;
static ProcRecord palette_is_editable_proc;
static ProcRecord palette_get_info_proc;
static ProcRecord palette_set_num_columns_proc;
static ProcRecord palette_get_columns_proc;
static ProcRecord palette_set_columns_proc;
static ProcRecord palette_add_entry_proc;
static ProcRecord palette_delete_entry_proc;
static ProcRecord palette_entry_get_color_proc;
@ -58,7 +59,8 @@ register_palette_procs (Gimp *gimp)
procedural_db_register (gimp, &palette_delete_proc);
procedural_db_register (gimp, &palette_is_editable_proc);
procedural_db_register (gimp, &palette_get_info_proc);
procedural_db_register (gimp, &palette_set_num_columns_proc);
procedural_db_register (gimp, &palette_get_columns_proc);
procedural_db_register (gimp, &palette_set_columns_proc);
procedural_db_register (gimp, &palette_add_entry_proc);
procedural_db_register (gimp, &palette_delete_entry_proc);
procedural_db_register (gimp, &palette_entry_get_color_proc);
@ -490,10 +492,76 @@ static ProcRecord palette_get_info_proc =
};
static Argument *
palette_set_num_columns_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
palette_get_columns_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar *name;
GimpPalette *palette = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
if (success)
{
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name);
success = (palette != NULL);
}
return_args = procedural_db_return_args (&palette_get_columns_proc, success);
if (success)
return_args[1].value.pdb_int = palette->n_columns;
return return_args;
}
static ProcArg palette_get_columns_inargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The palette name."
}
};
static ProcArg palette_get_columns_outargs[] =
{
{
GIMP_PDB_INT32,
"num_columns",
"The number of columns used to display this palette"
}
};
static ProcRecord palette_get_columns_proc =
{
"gimp_palette_get_columns",
"Retrieves the number of columns to use to display this palette",
"This procedures retrieves the prefered number of columns to use when the palette is being displayed.",
"Sven Neumann <sven@gimp.org>",
"Sven Neumann",
"2005",
NULL,
GIMP_INTERNAL,
1,
palette_get_columns_inargs,
1,
palette_get_columns_outargs,
{ { palette_get_columns_invoker } }
};
static Argument *
palette_set_columns_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
gchar *name;
@ -514,15 +582,15 @@ palette_set_num_columns_invoker (Gimp *gimp,
gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette && GIMP_DATA (palette)->writable)
gimp_palette_set_num_columns (palette, columns);
gimp_palette_set_columns (palette, columns);
else
success = FALSE;
}
return procedural_db_return_args (&palette_set_num_columns_proc, success);
return procedural_db_return_args (&palette_set_columns_proc, success);
}
static ProcArg palette_set_num_columns_inargs[] =
static ProcArg palette_set_columns_inargs[] =
{
{
GIMP_PDB_STRING,
@ -536,9 +604,9 @@ static ProcArg palette_set_num_columns_inargs[] =
}
};
static ProcRecord palette_set_num_columns_proc =
static ProcRecord palette_set_columns_proc =
{
"gimp_palette_set_num_columns",
"gimp_palette_set_columns",
"Sets the number of columns to use when displaying the palette",
"This procedures allows to control how many colors are shown per row when the palette is being displayed. This value can only be changed if the palette is writable. The maximum allowed value is 64.",
"Sven Neumann <sven@gimp.org>",
@ -547,10 +615,10 @@ static ProcRecord palette_set_num_columns_proc =
NULL,
GIMP_INTERNAL,
2,
palette_set_num_columns_inargs,
palette_set_columns_inargs,
0,
NULL,
{ { palette_set_num_columns_invoker } }
{ { palette_set_columns_invoker } }
};
static Argument *

View File

@ -1054,7 +1054,7 @@ palette_editor_columns_changed (GtkAdjustment *adj,
{
GimpPalette *palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
gimp_palette_set_num_columns (palette, ROUND (adj->value));
gimp_palette_set_columns (palette, ROUND (adj->value));
}
}

View File

@ -564,7 +564,8 @@ gimp_palette_duplicate
gimp_palette_rename
gimp_palette_delete
gimp_palette_get_info
gimp_palette_set_num_columns
gimp_palette_get_columns
gimp_palette_set_columns
gimp_palette_add_entry
gimp_palette_delete_entry
gimp_palette_entry_get_color

View File

@ -61,7 +61,16 @@ Functions operating on a single palette.
@Returns:
<!-- ##### FUNCTION gimp_palette_set_num_columns ##### -->
<!-- ##### FUNCTION gimp_palette_get_columns ##### -->
<para>
</para>
@name:
@Returns:
<!-- ##### FUNCTION gimp_palette_set_columns ##### -->
<para>
</para>

View File

@ -394,6 +394,7 @@ EXPORTS
gimp_palette_entry_set_color
gimp_palette_entry_set_name
gimp_palette_get_background
gimp_palette_get_columns
gimp_palette_get_foreground
gimp_palette_get_info
gimp_palette_is_editable
@ -402,9 +403,9 @@ EXPORTS
gimp_palette_select_destroy
gimp_palette_select_new
gimp_palette_set_background
gimp_palette_set_columns
gimp_palette_set_default_colors
gimp_palette_set_foreground
gimp_palette_set_num_columns
gimp_palette_swap_colors
gimp_palettes_close_popup
gimp_palettes_get_list

View File

@ -227,7 +227,40 @@ gimp_palette_get_info (const gchar *name,
}
/**
* gimp_palette_set_num_columns:
* gimp_palette_get_columns:
* @name: The palette name.
*
* Retrieves the number of columns to use to display this palette
*
* This procedures retrieves the prefered number of columns to use when
* the palette is being displayed.
*
* Returns: The number of columns used to display this palette.
*
* Since: GIMP 2.4
*/
gint
gimp_palette_get_columns (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gint num_columns = 0;
return_vals = gimp_run_procedure ("gimp_palette_get_columns",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
num_columns = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return num_columns;
}
/**
* gimp_palette_set_columns:
* @name: The palette name.
* @columns: The new number of columns.
*
@ -242,14 +275,14 @@ gimp_palette_get_info (const gchar *name,
* Since: GIMP 2.4
*/
gboolean
gimp_palette_set_num_columns (const gchar *name,
gint columns)
gimp_palette_set_columns (const gchar *name,
gint columns)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_palette_set_num_columns",
return_vals = gimp_run_procedure ("gimp_palette_set_columns",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_INT32, columns,

View File

@ -37,7 +37,8 @@ gboolean gimp_palette_delete (const gchar *name);
gboolean gimp_palette_is_editable (const gchar *name);
gboolean gimp_palette_get_info (const gchar *name,
gint *num_colors);
gboolean gimp_palette_set_num_columns (const gchar *name,
gint gimp_palette_get_columns (const gchar *name);
gboolean gimp_palette_set_columns (const gchar *name,
gint columns);
gboolean gimp_palette_add_entry (const gchar *name,
const gchar *entry_name,

View File

@ -268,7 +268,39 @@ CODE
);
}
sub palette_set_num_columns {
sub palette_get_columns {
$blurb = "Retrieves the number of columns to use to display this palette";
$help = <<'HELP';
This procedures retrieves the prefered number of columns to use when the
palette is being displayed.
HELP
&neo_misc;
@inargs = (
&palette_arg
);
@outargs = (
{ name => 'num_columns', type => 'int32', no_declare => '0',
alias => 'palette->n_columns',
desc => "The number of columns used to display this palette" }
);
%invoke = (
vars => [ 'GimpPalette *palette = NULL' ],
code => <<'CODE'
{
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name);
success = (palette != NULL);
}
CODE
);
}
sub palette_set_columns {
$blurb = "Sets the number of columns to use when displaying the palette";
$help = <<'HELP';
This procedures allows to control how many colors are shown per row when the
@ -292,7 +324,7 @@ HELP
gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette && GIMP_DATA (palette)->writable)
gimp_palette_set_num_columns (palette, columns);
gimp_palette_set_columns (palette, columns);
else
success = FALSE;
}
@ -572,7 +604,8 @@ CODE
"core/gimpdatafactory.h" "core/gimppalette.h");
@procs = qw(palette_new palette_duplicate palette_rename palette_delete
palette_is_editable palette_get_info palette_set_num_columns
palette_is_editable palette_get_info
palette_get_columns palette_set_columns
palette_add_entry palette_delete_entry
palette_entry_get_color palette_entry_set_color
palette_entry_get_name palette_entry_set_name);