gimp/app/pdb/palette_cmds.c
Michael Natterer 1bcd3e1834 app/Makefile.am removed.
2001-07-07  Michael Natterer  <mitch@gimp.org>

	* app/Makefile.am
	* app/context_manager.[ch]: removed.

	* app/app_procs.c: call tool_mananger instead of context_manager
	functions, pass "the_gimp" to some more functions.

	* app/drawable.[ch]: pass a GimpContext to drawable_fill().

	* app/errors.c: behave according to "stack_trace_mode" when using
	the debugging signal handler.

	* app/gimprc.[ch]: removed the core/ config variables.

	* app/selection.c: set the selection's state to INVISIBLE in
	selection_pause().

	* app/core/Makefile.am
	* app/core/gimpcoreconfig.[ch]: new files (the configuration
	variables used by core/).

	* app/core/gimpcontext.[ch]: removed the global contexts (user,
	default, ...) and their functions. It's no longer possible to pass
	NULL to the context functions to manipulate the current context
	(gimpcontext.c doesn't know the current context any more).

	* app/core/gimp.[ch]: added them here. The functions are now called
	gimp_[set|get]_*_context(). Added gimp_create_context() which is
	the only function to create contexts now.

	* app/gui/dialogs.[ch]
	* app/gui/gui.[ch]: pass "gimp" to all functions.

	* app/tools/tool_manager.[ch]
	* app/tools/tools.[ch]: pass "gimp" to lots of functions. Added
	the "global_tool_context" logic and the global/non-global paint
	options switching from the context_manager. Pass "gimp" to all
	tools' "register" functions.

	* app/tools/*: changed accordingly.

	* app/devices.c
	* app/disp_callbacks.c
	* app/file-open.[ch]
	* app/file-save.c
	* app/gdisplay.c
	* app/gimage.c
	* app/libgimp_glue.c
	* app/module_db.c
	* app/nav_window.c
	* app/plug_in.c
	* app/qmask.c
	* app/undo.c
	* app/base/base-config.c
	* app/core/gimpbrushpipe.c
	* app/core/gimpdrawable-offset.c
	* app/core/gimpgradient.c
	* app/core/gimpimage-duplicate.c
	* app/core/gimpimage-mask.c
	* app/core/gimpimage-new.c
	* app/core/gimpimage.c
	* app/core/gimppalette.c
	* app/core/gimptoolinfo.[ch]
	* app/core/gimpundo.c
	* app/gui/brush-select.c
	* app/gui/channels-commands.c
	* app/gui/color-area.c
	* app/gui/dialogs-constructors.c
	* app/gui/file-new-dialog.c
	* app/gui/file-open-dialog.c
	* app/gui/gradient-editor.c
	* app/gui/gradient-select.c
	* app/gui/info-window.c
	* app/gui/layers-commands.c
	* app/gui/menus.c
	* app/gui/palette-editor.c
	* app/gui/palette-import-dialog.c
	* app/gui/palette-select.c
	* app/gui/paths-dialog.c
	* app/gui/pattern-select.c
	* app/gui/preferences-dialog.c
	* app/gui/resize-dialog.c
	* app/gui/test-commands.c
	* app/gui/tool-options-dialog.c
	* app/gui/toolbox.c
	* app/gui/tools-commands.c
	* app/xcf/xcf-load.c
	* app/xcf/xcf-save.c
	* app/widgets/gimpchannellistview.c
	* app/widgets/gimpdnd.c
	* app/widgets/gimpdrawablelistview.[ch]
	* app/widgets/gimpimagedock.c
	* app/widgets/gimplayerlistview.c
	* app/pdb/brushes_cmds.c
	* app/pdb/drawable_cmds.c
	* app/pdb/gradient_select_cmds.c
	* app/pdb/gradients_cmds.c
	* app/pdb/palette_cmds.c
	* app/pdb/patterns_cmds.c
	* app/pdb/procedural_db.c
	* tools/pdbgen/pdb/brushes.pdb
	* tools/pdbgen/pdb/drawable.pdb
	* tools/pdbgen/pdb/gradient_select.pdb
	* tools/pdbgen/pdb/gradients.pdb
	* tools/pdbgen/pdb/palette.pdb
	* tools/pdbgen/pdb/patterns.pdb: changed accordingly: remove usage
	of gimp_context_[get|set]_*(NULL), create contexts with
	gimp_create_context(). Get the user/current context with
	gimp_get_[user|current]_context(). Added/removed access to the
	global "the_gimp" variable in some places. Get the core's config
	variables from "core_config".
2001-07-07 12:17:23 +00:00

296 lines
8.3 KiB
C

/* The GIMP -- an image manipulation program
* Copyright (C) 1995-2000 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* NOTE: This file is autogenerated by pdbgen.pl. */
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpbase/gimpbasetypes.h"
#include "core/core-types.h"
#include "procedural_db.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpdatafactory.h"
#include "libgimpcolor/gimpcolor.h"
static ProcRecord palette_get_foreground_proc;
static ProcRecord palette_get_background_proc;
static ProcRecord palette_set_foreground_proc;
static ProcRecord palette_set_background_proc;
static ProcRecord palette_set_default_colors_proc;
static ProcRecord palette_swap_colors_proc;
static ProcRecord palette_refresh_proc;
void
register_palette_procs (Gimp *gimp)
{
procedural_db_register (gimp, &palette_get_foreground_proc);
procedural_db_register (gimp, &palette_get_background_proc);
procedural_db_register (gimp, &palette_set_foreground_proc);
procedural_db_register (gimp, &palette_set_background_proc);
procedural_db_register (gimp, &palette_set_default_colors_proc);
procedural_db_register (gimp, &palette_swap_colors_proc);
procedural_db_register (gimp, &palette_refresh_proc);
}
static Argument *
palette_get_foreground_invoker (Gimp *gimp,
Argument *args)
{
Argument *return_args;
GimpRGB color;
gimp_context_get_foreground (gimp_get_current_context (gimp), &color);
return_args = procedural_db_return_args (&palette_get_foreground_proc, TRUE);
return_args[1].value.pdb_color = color;
return return_args;
}
static ProcArg palette_get_foreground_outargs[] =
{
{
GIMP_PDB_COLOR,
"foreground",
"The foreground color"
}
};
static ProcRecord palette_get_foreground_proc =
{
"gimp_palette_get_foreground",
"Get the current GIMP foreground color.",
"This procedure retrieves the current GIMP foreground color. The foreground color is used in a variety of tools such as paint tools, blending, and bucket fill.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
0,
NULL,
1,
palette_get_foreground_outargs,
{ { palette_get_foreground_invoker } }
};
static Argument *
palette_get_background_invoker (Gimp *gimp,
Argument *args)
{
Argument *return_args;
GimpRGB color;
gimp_context_get_background (gimp_get_current_context (gimp), &color);
return_args = procedural_db_return_args (&palette_get_background_proc, TRUE);
return_args[1].value.pdb_color = color;
return return_args;
}
static ProcArg palette_get_background_outargs[] =
{
{
GIMP_PDB_COLOR,
"background",
"The background color"
}
};
static ProcRecord palette_get_background_proc =
{
"gimp_palette_get_background",
"Get the current GIMP background color.",
"This procedure retrieves the current GIMP background color. The background color is used in a variety of tools such as blending, erasing (with non-alpha images), and image filling.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
0,
NULL,
1,
palette_get_background_outargs,
{ { palette_get_background_invoker } }
};
static Argument *
palette_set_foreground_invoker (Gimp *gimp,
Argument *args)
{
GimpRGB color;
color = args[0].value.pdb_color;
gimp_rgb_set_alpha (&color, 1.0);
gimp_context_set_foreground (gimp_get_current_context (gimp), &color);
return procedural_db_return_args (&palette_set_foreground_proc, TRUE);
}
static ProcArg palette_set_foreground_inargs[] =
{
{
GIMP_PDB_COLOR,
"foreground",
"The foreground color"
}
};
static ProcRecord palette_set_foreground_proc =
{
"gimp_palette_set_foreground",
"Set the current GIMP foreground color.",
"This procedure sets the current GIMP foreground color. After this is set, operations which use foreground such as paint tools, blending, and bucket fill will use the new value.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
1,
palette_set_foreground_inargs,
0,
NULL,
{ { palette_set_foreground_invoker } }
};
static Argument *
palette_set_background_invoker (Gimp *gimp,
Argument *args)
{
GimpRGB color;
color = args[0].value.pdb_color;
gimp_rgb_set_alpha (&color, 1.0);
gimp_context_set_background (gimp_get_current_context (gimp), &color);
return procedural_db_return_args (&palette_set_background_proc, TRUE);
}
static ProcArg palette_set_background_inargs[] =
{
{
GIMP_PDB_COLOR,
"background",
"The background color"
}
};
static ProcRecord palette_set_background_proc =
{
"gimp_palette_set_background",
"Set the current GIMP background color.",
"This procedure sets the current GIMP background color. After this is set, operations which use background such as blending, filling images, clearing, and erasing (in non-alpha images) will use the new value.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
1,
palette_set_background_inargs,
0,
NULL,
{ { palette_set_background_invoker } }
};
static Argument *
palette_set_default_colors_invoker (Gimp *gimp,
Argument *args)
{
gimp_context_set_default_colors (gimp_get_current_context (gimp));
return procedural_db_return_args (&palette_set_default_colors_proc, TRUE);
}
static ProcRecord palette_set_default_colors_proc =
{
"gimp_palette_set_default_colors",
"Set the current GIMP foreground and background colors to black and white.",
"This procedure sets the current GIMP foreground and background colors to their initial default values, black and white.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
0,
NULL,
0,
NULL,
{ { palette_set_default_colors_invoker } }
};
static Argument *
palette_swap_colors_invoker (Gimp *gimp,
Argument *args)
{
gimp_context_swap_colors (gimp_get_current_context (gimp));
return procedural_db_return_args (&palette_swap_colors_proc, TRUE);
}
static ProcRecord palette_swap_colors_proc =
{
"gimp_palette_swap_colors",
"Swap the current GIMP foreground and background colors.",
"This procedure swaps the current GIMP foreground and background colors, so that the new foreground color becomes the old background color and vice versa.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
0,
NULL,
0,
NULL,
{ { palette_swap_colors_invoker } }
};
static Argument *
palette_refresh_invoker (Gimp *gimp,
Argument *args)
{
/* FIXME: I've hardcoded success to be TRUE, because brushes_init() is a
* void function right now. It'd be nice if it returned a value at
* some future date, so we could tell if things blew up when reparsing
* the list (for whatever reason).
* - Seth "Yes, this is a kludge" Burgess
* <sjburges@ou.edu>
* -and shamelessly stolen by Adrian Likins for use here...
*/
gimp_data_factory_data_init (gimp->palette_factory, FALSE);
return procedural_db_return_args (&palette_refresh_proc, TRUE);
}
static ProcRecord palette_refresh_proc =
{
"gimp_palette_refresh",
"Refreshes current palettes.",
"This procedure incorporates all palettes currently in the users palette path.",
"Adrian Likins <adrian@gimp.org>",
"Adrian Likins",
"1998",
GIMP_INTERNAL,
0,
NULL,
0,
NULL,
{ { palette_refresh_invoker } }
};