Commit 243cdf53 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

renamed gimp_palette_[gs]et_n_columns to

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

	* app/core/gimppalette.[ch]: renamed gimp_palette_[gs]et_n_columns
	to gimp_palette_[gs]et_num_columns().

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

	* tools/pdbgen/pdb/palette.pdb: added new PDB function to control
	the number of columns used when displaying a palette (bug #169370).

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

	* libgimp/gimp.def: updated.
parent 3c36e2b8
2005-03-08 Sven Neumann <sven@gimp.org>
* app/core/gimppalette.[ch]: renamed gimp_palette_[gs]et_n_columns
to gimp_palette_[gs]et_num_columns().
* app/dialogs/palette-import-dialog.c
* app/widgets/gimppaletteeditor.c: changed accordingly.
* tools/pdbgen/pdb/palette.pdb: added new PDB function to control
the number of columns used when displaying a palette (bug #169370).
* app/pdb/internal_procs.c
* app/pdb/palette_cmds.c
* libgimp/gimppalette_pdb.[ch]: regenerated.
* libgimp/gimp.def: updated.
2005-03-08 Sven Neumann <sven@gimp.org>
* app/tools/gimpcurvestool.c (gimp_curves_tool_dialog)
......
......@@ -692,23 +692,23 @@ gimp_palette_delete_entry (GimpPalette *palette,
}
void
gimp_palette_set_n_columns (GimpPalette *palette,
gint n_columns)
gimp_palette_set_num_columns (GimpPalette *palette,
gint columns)
{
g_return_if_fail (GIMP_IS_PALETTE (palette));
n_columns = CLAMP (n_columns, 0, 64);
columns = CLAMP (columns, 0, 64);
if (palette->n_columns != n_columns)
if (palette->n_columns != columns)
{
palette->n_columns = n_columns;
palette->n_columns = columns;
gimp_data_dirty (GIMP_DATA (palette));
}
}
gint
gimp_palette_get_n_columns (GimpPalette *palette)
gimp_palette_get_num_columns (GimpPalette *palette)
{
g_return_val_if_fail (GIMP_IS_PALETTE (palette), 0);
......
......@@ -692,23 +692,23 @@ gimp_palette_delete_entry (GimpPalette *palette,
}
void
gimp_palette_set_n_columns (GimpPalette *palette,
gint n_columns)
gimp_palette_set_num_columns (GimpPalette *palette,
gint columns)
{
g_return_if_fail (GIMP_IS_PALETTE (palette));
n_columns = CLAMP (n_columns, 0, 64);
columns = CLAMP (columns, 0, 64);
if (palette->n_columns != n_columns)
if (palette->n_columns != columns)
{
palette->n_columns = n_columns;
palette->n_columns = columns;
gimp_data_dirty (GIMP_DATA (palette));
}
}
gint
gimp_palette_get_n_columns (GimpPalette *palette)
gimp_palette_get_num_columns (GimpPalette *palette)
{
g_return_val_if_fail (GIMP_IS_PALETTE (palette), 0);
......
......@@ -692,23 +692,23 @@ gimp_palette_delete_entry (GimpPalette *palette,
}
void
gimp_palette_set_n_columns (GimpPalette *palette,
gint n_columns)
gimp_palette_set_num_columns (GimpPalette *palette,
gint columns)
{
g_return_if_fail (GIMP_IS_PALETTE (palette));
n_columns = CLAMP (n_columns, 0, 64);
columns = CLAMP (columns, 0, 64);
if (palette->n_columns != n_columns)
if (palette->n_columns != columns)
{
palette->n_columns = n_columns;
palette->n_columns = columns;
gimp_data_dirty (GIMP_DATA (palette));
}
}
gint
gimp_palette_get_n_columns (GimpPalette *palette)
gimp_palette_get_num_columns (GimpPalette *palette)
{
g_return_val_if_fail (GIMP_IS_PALETTE (palette), 0);
......
......@@ -62,25 +62,25 @@ struct _GimpPaletteClass
};
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);
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_n_columns (GimpPalette *palette,
gint n_columns);
gint gimp_palette_get_n_columns (GimpPalette *palette);
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);
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);
#endif /* __GIMP_PALETTE_H__ */
......@@ -645,8 +645,8 @@ palette_import_columns_changed (GtkAdjustment *adjustment,
ImportDialog *import_dialog)
{
if (import_dialog->palette)
gimp_palette_set_n_columns (import_dialog->palette,
ROUND (adjustment->value));
gimp_palette_set_num_columns (import_dialog->palette,
ROUND (adjustment->value));
}
/* functions & callbacks to keep the import dialog uptodate ****************/
......
......@@ -74,7 +74,7 @@ void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 453 procedures registered total */
/* 454 procedures registered total */
void
internal_procs_init (Gimp *gimp,
......@@ -86,7 +86,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (_("Internal Procedures"), _("Brush"), 0.0);
register_brush_procs (gimp);
(* status_callback) (NULL, _("Brush UI"), 0.049);
(* status_callback) (NULL, _("Brush UI"), 0.048);
register_brush_select_procs (gimp);
(* status_callback) (NULL, _("Brushes"), 0.055);
......@@ -95,73 +95,73 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Channel"), 0.068);
register_channel_procs (gimp);
(* status_callback) (NULL, _("Color"), 0.091);
(* status_callback) (NULL, _("Color"), 0.09);
register_color_procs (gimp);
(* status_callback) (NULL, _("Context"), 0.124);
(* status_callback) (NULL, _("Context"), 0.123);
register_context_procs (gimp);
(* status_callback) (NULL, _("Convert"), 0.172);
register_convert_procs (gimp);
(* status_callback) (NULL, _("Display procedures"), 0.179);
(* status_callback) (NULL, _("Display procedures"), 0.178);
register_display_procs (gimp);
(* status_callback) (NULL, _("Drawable procedures"), 0.188);
(* status_callback) (NULL, _("Drawable procedures"), 0.187);
register_drawable_procs (gimp);
(* status_callback) (NULL, _("Transformation procedures"), 0.263);
(* status_callback) (NULL, _("Transformation procedures"), 0.262);
register_drawable_transform_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.298);
(* status_callback) (NULL, _("Edit procedures"), 0.297);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.318);
(* status_callback) (NULL, _("File Operations"), 0.317);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.34);
(* status_callback) (NULL, _("Floating selections"), 0.339);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.353);
(* status_callback) (NULL, _("Font UI"), 0.352);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Fonts"), 0.36);
(* status_callback) (NULL, _("Fonts"), 0.359);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.364);
(* status_callback) (NULL, _("Gimprc procedures"), 0.363);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient"), 0.377);
register_gradient_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.444);
(* status_callback) (NULL, _("Gradient UI"), 0.443);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.45);
(* status_callback) (NULL, _("Gradients"), 0.449);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.461);
(* status_callback) (NULL, _("Guide procedures"), 0.46);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.475);
(* status_callback) (NULL, _("Help procedures"), 0.474);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.477);
(* status_callback) (NULL, _("Image"), 0.476);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.614);
(* status_callback) (NULL, _("Layer"), 0.612);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.673);
(* status_callback) (NULL, _("Message procedures"), 0.672);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.68);
(* status_callback) (NULL, _("Miscellaneous"), 0.678);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.684);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.683);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.717);
(* status_callback) (NULL, _("Palette"), 0.716);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.744);
......@@ -170,19 +170,19 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Palettes"), 0.751);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.759);
(* status_callback) (NULL, _("Parasite procedures"), 0.76);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.786);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern"), 0.821);
(* status_callback) (NULL, _("Pattern"), 0.822);
register_pattern_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.826);
register_pattern_select_procs (gimp);
(* status_callback) (NULL, _("Patterns"), 0.832);
(* status_callback) (NULL, _("Patterns"), 0.833);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.841);
......@@ -194,7 +194,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Progress"), 0.872);
register_progress_procs (gimp);
(* status_callback) (NULL, _("Image mask"), 0.887);
(* status_callback) (NULL, _("Image mask"), 0.888);
register_selection_procs (gimp);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.925);
......
......@@ -41,6 +41,7 @@ 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_add_entry_proc;
static ProcRecord palette_delete_entry_proc;
static ProcRecord palette_entry_get_color_proc;
......@@ -57,6 +58,7 @@ 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_add_entry_proc);
procedural_db_register (gimp, &palette_delete_entry_proc);
procedural_db_register (gimp, &palette_entry_get_color_proc);
......@@ -487,6 +489,70 @@ static ProcRecord palette_get_info_proc =
{ { palette_get_info_invoker } }
};
static Argument *
palette_set_num_columns_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
gchar *name;
gint32 columns;
GimpPalette *palette = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
columns = args[1].value.pdb_int;
if (columns < 0 || columns > 64)
success = FALSE;
if (success)
{
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette && GIMP_DATA (palette)->writable)
gimp_palette_set_num_columns (palette, columns);
else
success = FALSE;
}
return procedural_db_return_args (&palette_set_num_columns_proc, success);
}
static ProcArg palette_set_num_columns_inargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The palette name."
},
{
GIMP_PDB_INT32,
"columns",
"The new number of columns"
}
};
static ProcRecord palette_set_num_columns_proc =
{
"gimp_palette_set_num_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>",
"Sven Neumann",
"2005",
NULL,
GIMP_INTERNAL,
2,
palette_set_num_columns_inargs,
0,
NULL,
{ { palette_set_num_columns_invoker } }
};
static Argument *
palette_add_entry_invoker (Gimp *gimp,
GimpContext *context,
......
......@@ -1054,7 +1054,7 @@ palette_editor_columns_changed (GtkAdjustment *adj,
{
GimpPalette *palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
gimp_palette_set_n_columns (palette, ROUND (adj->value));
gimp_palette_set_num_columns (palette, ROUND (adj->value));
}
}
......
......@@ -1198,8 +1198,8 @@ gimp_palette_get_standard
gimp_palette_load
gimp_palette_add_entry
gimp_palette_delete_entry
gimp_palette_set_n_columns
gimp_palette_get_n_columns
gimp_palette_set_num_columns
gimp_palette_get_num_columns
<SUBSECTION Standard>
GimpPaletteClass
GIMP_PALETTE
......
......@@ -564,6 +564,7 @@ gimp_palette_duplicate
gimp_palette_rename
gimp_palette_delete
gimp_palette_get_info
gimp_palette_set_num_columns
gimp_palette_add_entry
gimp_palette_delete_entry
gimp_palette_entry_get_color
......
......@@ -61,6 +61,16 @@ Functions operating on a single palette.
@Returns:
<!-- ##### FUNCTION gimp_palette_set_num_columns ##### -->
<para>
</para>
@name:
@columns:
@Returns:
<!-- ##### FUNCTION gimp_palette_add_entry ##### -->
<para>
......
......@@ -404,6 +404,7 @@ EXPORTS
gimp_palette_set_background
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
......
......@@ -226,6 +226,42 @@ gimp_palette_get_info (const gchar *name,
return success;
}
/**
* gimp_palette_set_num_columns:
* @name: The palette name.
* @columns: The new number of 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.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_palette_set_num_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",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_INT32, columns,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_palette_add_entry:
* @name: The palette name.
......
......@@ -37,6 +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 columns);
gboolean gimp_palette_add_entry (const gchar *name,
const gchar *entry_name,
const GimpRGB *color,
......
......@@ -31,6 +31,13 @@ sub mitch_misc {
$since = '2.2';
}
sub neo_misc {
$author = 'Sven Neumann <sven@gimp.org>';
$copyright = 'Sven Neumann';
$date = '2005';
$since = '2.4';
}
sub palette_arg () {{
name => 'name',
type => 'string',
......@@ -261,6 +268,38 @@ CODE
);
}
sub palette_set_num_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
palette is being displayed. This value can only be changed if the palette
is writable. The maximum allowed value is 64.
HELP
&neo_misc;
@inargs = (
&palette_arg,
{ name => 'columns', type => '0 <= int32 <= 64',
desc => "The new number of columns" }
);
%invoke = (
vars => [ 'GimpPalette *palette = NULL' ],
code => <<'CODE'
{
palette = (GimpPalette *)
gimp_container_get_child_by_name (gimp->palette_factory->container, name);
if (palette && GIMP_DATA (palette)->writable)
gimp_palette_set_num_columns (palette, columns);
else
success = FALSE;
}
CODE
);
}
sub palette_add_entry {
$blurb = 'Adds a palette entry to the specified palette.';
......@@ -533,8 +572,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_add_entry palette_delete_entry
palette_is_editable palette_get_info palette_set_num_columns
palette_add_entry palette_delete_entry
palette_entry_get_color palette_entry_set_color
palette_entry_get_name palette_entry_set_name);
%exports = (app => [@procs], lib => [@procs]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment