gimp/app/core/gimpcontext.c

2165 lines
56 KiB
C
Raw Normal View History

/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpcontext.c: Copyright (C) 1999 Michael Natterer <mitch@gimp.org>
*
* 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.
*/
#include "config.h"
#include <gtk/gtk.h>
Makefile.am configure.in added stuff for the new library below. 2001-01-23 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool.in: added stuff for the new library below. * libgimpcolor/.cvsignore * libgimpcolor/Makefile.am * libgimpcolor/gimpcolor.h * libgimpcolor/gimpcolorspace.c * libgimpcolor/gimpcolorspace.h * libgimpcolor/gimpcolortypes.h * libgimpcolor/gimphsv.c * libgimpcolor/gimphsv.h * libgimpcolor/gimprgb.c * libgimpcolor/gimprgb.h: new shared library which both the app and plug-ins link against. The library depends only on glib. * libgimpcolor/gimpcolor.def * libgimpcolor/makefile.mingw.in * libgimpcolor/makefile.msc: added Win32 build files which definitely don't work. * libgimp/Makefile.am * libgimp/gimpcolor.[ch] * libgimp/gimpcolorspace.[ch]: removed. * libgimp/gimp.h * libgimp/gimpadaptivesupersample.c * libgimp/gimpbilinear.c * libgimp/gimppalette.c * libgimp/gimptypes.h: include the stuff from libgimpcolor. Plug-Ins don't need to include <libgimpcolor/gimpcolor.h> explicitely. LibGimp depends on libgimpcolor and thus also includes it's headers. * libgimp/gimp.def * libgimp/makefile.mingw.in: fiddled around with Win32 stuff... * app/Makefile.am: link against libgimpcolor.la * app/apptypes.h: include "libgimpcolor/gimpcolortypes.h" * app/asupsample.c * app/channels_dialog.c * app/colormap_dialog.c * app/commands.c * app/convert.c * app/devices.c * app/disp_callbacks.c * app/drawable.c * app/gimpcontext.c * app/gimpdnd.c * app/gimpimage.c * app/gimppalette.c * app/gimprc.c * app/gradient.c * app/libgimp_glue.c * app/palette.c * app/palette_import.c * app/qmask.c * app/xcf.c * app/tools/paint_core.c * app/tools/paintbrush.c * app/tools/pencil.c: include "libgimpcolor/gimpcolor.h" before all gimp includes because it's a standalone library. * plug-ins/FractalExplorer/Makefile.am * plug-ins/Lighting/Makefile.am * plug-ins/MapObject/Makefile.am * plug-ins/bmp/Makefile.am * plug-ins/common/Makefile.am * plug-ins/common/mkgen.pl * plug-ins/dbbrowser/Makefile.am * plug-ins/faxg3/Makefile.am * plug-ins/fits/Makefile.am * plug-ins/flame/Makefile.am * plug-ins/fp/Makefile.am * plug-ins/gap/Makefile.am * plug-ins/gdyntext/Makefile.am * plug-ins/gfig/Makefile.am * plug-ins/gflare/Makefile.am * plug-ins/gfli/Makefile.am * plug-ins/gimpressionist/Makefile.am * plug-ins/helpbrowser/Makefile.am * plug-ins/ifscompose/Makefile.am * plug-ins/imagemap/Makefile.am * plug-ins/maze/Makefile.am * plug-ins/mosaic/Makefile.am * plug-ins/pagecurl/Makefile.am * plug-ins/print/Makefile.am * plug-ins/rcm/Makefile.am * plug-ins/script-fu/Makefile.am * plug-ins/sel2path/Makefile.am * plug-ins/sgi/Makefile.am * plug-ins/webbrowser/Makefile.am * plug-ins/xjt/Makefile.am: add libgimpcolor.la to LDADD. * INSTALL: don't recommend to --disable-shared for development. * TODO.xml: increased some percentages, added plug-in help stuff.
2001-01-24 02:49:44 +08:00
#include "libgimpcolor/gimpcolor.h"
#include "apptypes.h"
#include "brushes.h"
#include "context_manager.h"
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
#include "gdisplay.h"
1999-10-27 02:27:27 +08:00
#include "gimpbrush.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpgradient.h"
#include "gimpimage.h"
#include "gimpmarshal.h"
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
#include "gimppalette.h"
#include "gimppattern.h"
1999-10-27 02:27:27 +08:00
#include "gimprc.h"
#include "gradients.h"
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
#include "palettes.h"
1999-10-27 02:27:27 +08:00
#include "patterns.h"
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
#include "temp_buf.h"
1999-10-27 02:27:27 +08:00
typedef void (* GimpContextCopyArgFunc) (GimpContext *src,
GimpContext *dest);
#define context_return_if_fail(context) \
g_return_if_fail ((context) != NULL); \
g_return_if_fail (GIMP_IS_CONTEXT (context))
#define context_return_val_if_fail(context,val) \
g_return_val_if_fail ((context) != NULL, (val)); \
g_return_val_if_fail (GIMP_IS_CONTEXT (context), (val))
#define context_check_current(context) \
((context) = (context) ? (context) : current_context)
#define context_find_defined(context,arg_mask) \
while (!(((context)->defined_args) & arg_mask) && (context)->parent) \
(context) = (context)->parent
/* local function prototypes */
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
static void gimp_context_class_init (GimpContextClass *klass);
static void gimp_context_init (GimpContext *context);
static void gimp_context_destroy (GtkObject *object);
static void gimp_context_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gimp_context_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
/* image */
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
static void gimp_context_image_removed (GimpContainer *container,
GimpImage *image,
GimpContext *context);
static void gimp_context_real_set_image (GimpContext *context,
GimpImage *image);
static void gimp_context_copy_image (GimpContext *src,
GimpContext *dest);
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
/* display */
static void gimp_context_real_set_display (GimpContext *context,
GDisplay *display);
static void gimp_context_copy_display (GimpContext *src,
GimpContext *dest);
/* tool */
static void gimp_context_real_set_tool (GimpContext *context,
ToolType tool);
static void gimp_context_copy_tool (GimpContext *src,
GimpContext *dest);
/* foreground */
static void gimp_context_real_set_foreground (GimpContext *context,
const GimpRGB *color);
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
static void gimp_context_copy_foreground (GimpContext *src,
GimpContext *dest);
/* background */
static void gimp_context_real_set_background (GimpContext *context,
const GimpRGB *color);
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
static void gimp_context_copy_background (GimpContext *src,
GimpContext *dest);
/* opacity */
static void gimp_context_real_set_opacity (GimpContext *context,
gdouble opacity);
static void gimp_context_copy_opacity (GimpContext *src,
GimpContext *dest);
/* paint mode */
static void gimp_context_real_set_paint_mode (GimpContext *context,
LayerModeEffects paint_mode);
static void gimp_context_copy_paint_mode (GimpContext *src,
GimpContext *dest);
/* brush */
static void gimp_context_brush_dirty (GimpBrush *brush,
GimpContext *context);
static void gimp_context_brush_removed (GimpContainer *brush_list,
GimpBrush *brush,
GimpContext *context);
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
static void gimp_context_brush_list_thaw (GimpContainer *container,
GimpContext *context);
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
static void gimp_context_real_set_brush (GimpContext *context,
GimpBrush *brush);
static void gimp_context_copy_brush (GimpContext *src,
GimpContext *dest);
/* pattern */
static void gimp_context_pattern_dirty (GimpPattern *pattern,
GimpContext *context);
static void gimp_context_pattern_removed (GimpContainer *brush_list,
GimpPattern *pattern,
GimpContext *context);
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
static void gimp_context_pattern_list_thaw (GimpContainer *container,
GimpContext *context);
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
static void gimp_context_real_set_pattern (GimpContext *context,
GimpPattern *pattern);
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
static void gimp_context_copy_pattern (GimpContext *src,
GimpContext *dest);
/* gradient */
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
static void gimp_context_gradient_dirty (GimpGradient *gradient,
GimpContext *context);
static void gimp_context_gradient_removed (GimpContainer *container,
GimpGradient *gradient,
GimpContext *context);
static void gimp_context_gradient_list_thaw (GimpContainer *container,
GimpContext *context);
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
static void gimp_context_real_set_gradient (GimpContext *context,
GimpGradient *gradient);
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
static void gimp_context_copy_gradient (GimpContext *src,
GimpContext *dest);
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
/* palette */
static void gimp_context_palette_dirty (GimpPalette *palette,
GimpContext *context);
static void gimp_context_palette_removed (GimpContainer *brush_list,
GimpPalette *palatte,
GimpContext *context);
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
static void gimp_context_palette_list_thaw (GimpContainer *container,
GimpContext *context);
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
static void gimp_context_real_set_palette (GimpContext *context,
GimpPalette *palatte);
static void gimp_context_copy_palette (GimpContext *src,
GimpContext *dest);
/* arguments & signals */
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
1999-10-27 02:27:27 +08:00
enum
{
ARG_0,
ARG_IMAGE,
ARG_DISPLAY,
ARG_TOOL,
ARG_FOREGROUND,
ARG_BACKGROUND,
ARG_OPACITY,
ARG_PAINT_MODE,
ARG_BRUSH,
ARG_PATTERN,
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
ARG_GRADIENT,
ARG_PALETTE
};
enum
{
IMAGE_CHANGED,
DISPLAY_CHANGED,
TOOL_CHANGED,
FOREGROUND_CHANGED,
BACKGROUND_CHANGED,
OPACITY_CHANGED,
PAINT_MODE_CHANGED,
BRUSH_CHANGED,
PATTERN_CHANGED,
GRADIENT_CHANGED,
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
PALETTE_CHANGED,
LAST_SIGNAL
};
1999-10-27 02:27:27 +08:00
static gchar *gimp_context_arg_names[] =
{
"GimpContext::image",
"GimpContext::display",
"GimpContext::tool",
"GimpContext::foreground",
"GimpContext::background",
"GimpContext::opacity",
"GimpContext::paint_mode",
"GimpContext::brush",
"GimpContext::pattern",
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
"GimpContext::gradient",
"GimpContext::palette"
};
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
static GimpContextCopyArgFunc gimp_context_copy_arg_funcs[] =
{
gimp_context_copy_image,
gimp_context_copy_display,
gimp_context_copy_tool,
gimp_context_copy_foreground,
gimp_context_copy_background,
gimp_context_copy_opacity,
gimp_context_copy_paint_mode,
gimp_context_copy_brush,
gimp_context_copy_pattern,
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
gimp_context_copy_gradient,
gimp_context_copy_palette
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
};
static GtkType gimp_context_arg_types[] =
1999-10-27 02:27:27 +08:00
{
0,
GTK_TYPE_NONE,
GTK_TYPE_NONE,
GTK_TYPE_NONE,
GTK_TYPE_NONE,
GTK_TYPE_NONE,
GTK_TYPE_NONE,
0,
0,
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
0,
0
1999-10-27 02:27:27 +08:00
};
static gchar *gimp_context_signal_names[] =
{
"image_changed",
"display_changed",
"tool_changed",
"foreground_changed",
"background_changed",
"opacity_changed",
"paint_mode_changed",
"brush_changed",
"pattern_changed",
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
"gradient_changed",
"palette_changed"
};
1999-10-27 02:27:27 +08:00
static GtkSignalFunc gimp_context_signal_handlers[] =
{
gimp_context_real_set_image,
gimp_context_real_set_display,
gimp_context_real_set_tool,
gimp_context_real_set_foreground,
gimp_context_real_set_background,
gimp_context_real_set_opacity,
gimp_context_real_set_paint_mode,
gimp_context_real_set_brush,
gimp_context_real_set_pattern,
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
gimp_context_real_set_gradient,
gimp_context_real_set_palette
};
static guint gimp_context_signals[LAST_SIGNAL] = { 0 };
static GimpObjectClass * parent_class = NULL;
/* the currently active context */
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
static GimpContext *current_context = NULL;
/* the context user by the interface */
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
static GimpContext *user_context = NULL;
/* the default context which is initialized from gimprc */
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
static GimpContext *default_context = NULL;
/* the hardcoded standard context */
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
static GimpContext *standard_context = NULL;
1999-10-27 02:27:27 +08:00
/* the list of all contexts */
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
static GSList *context_list = NULL;
1999-10-27 02:27:27 +08:00
/*****************************************************************************/
/* private functions *******************************************************/
static void
gimp_context_class_init (GimpContextClass *klass)
{
GtkObjectClass *object_class;
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
object_class = GTK_OBJECT_CLASS (klass);
parent_class = gtk_type_class (GIMP_TYPE_OBJECT);
gimp_context_arg_types[GIMP_CONTEXT_ARG_IMAGE] = GIMP_TYPE_IMAGE;
gimp_context_arg_types[GIMP_CONTEXT_ARG_BRUSH] = GIMP_TYPE_BRUSH;
gimp_context_arg_types[GIMP_CONTEXT_ARG_PATTERN] = GIMP_TYPE_PATTERN;
gimp_context_arg_types[GIMP_CONTEXT_ARG_GRADIENT] = GIMP_TYPE_GRADIENT;
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
gimp_context_arg_types[GIMP_CONTEXT_ARG_PALETTE] = GIMP_TYPE_PALETTE;
gtk_object_add_arg_type (gimp_context_arg_names[IMAGE_CHANGED],
GTK_TYPE_POINTER, GTK_ARG_READWRITE,
ARG_IMAGE);
gtk_object_add_arg_type (gimp_context_arg_names[DISPLAY_CHANGED],
GTK_TYPE_POINTER, GTK_ARG_READWRITE,
ARG_DISPLAY);
gtk_object_add_arg_type (gimp_context_arg_names[TOOL_CHANGED],
GTK_TYPE_INT, GTK_ARG_READWRITE,
ARG_TOOL);
gtk_object_add_arg_type (gimp_context_arg_names[FOREGROUND_CHANGED],
GTK_TYPE_POINTER, GTK_ARG_READWRITE,
ARG_FOREGROUND);
gtk_object_add_arg_type (gimp_context_arg_names[BACKGROUND_CHANGED],
GTK_TYPE_POINTER, GTK_ARG_READWRITE,
ARG_BACKGROUND);
gtk_object_add_arg_type (gimp_context_arg_names[OPACITY_CHANGED],
GTK_TYPE_DOUBLE, GTK_ARG_READWRITE,
ARG_OPACITY);
gtk_object_add_arg_type (gimp_context_arg_names[PAINT_MODE_CHANGED],
GTK_TYPE_INT, GTK_ARG_READWRITE,
ARG_PAINT_MODE);
gtk_object_add_arg_type (gimp_context_arg_names[BRUSH_CHANGED],
GTK_TYPE_POINTER, GTK_ARG_READWRITE,
ARG_BRUSH);
gtk_object_add_arg_type (gimp_context_arg_names[PATTERN_CHANGED],
GTK_TYPE_POINTER, GTK_ARG_READWRITE,
ARG_PATTERN);
gtk_object_add_arg_type (gimp_context_arg_names[GRADIENT_CHANGED],
GTK_TYPE_POINTER, GTK_ARG_READWRITE,
ARG_GRADIENT);
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
gtk_object_add_arg_type (gimp_context_arg_names[PALETTE_CHANGED],
GTK_TYPE_POINTER, GTK_ARG_READWRITE,
ARG_PALETTE);
gimp_context_signals[IMAGE_CHANGED] =
gtk_signal_new (gimp_context_signal_names[IMAGE_CHANGED],
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContextClass,
image_changed),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gimp_context_signals[DISPLAY_CHANGED] =
gtk_signal_new (gimp_context_signal_names[DISPLAY_CHANGED],
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContextClass,
display_changed),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gimp_context_signals[TOOL_CHANGED] =
gtk_signal_new (gimp_context_signal_names[TOOL_CHANGED],
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContextClass,
tool_changed),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
gimp_context_signals[FOREGROUND_CHANGED] =
gtk_signal_new (gimp_context_signal_names[FOREGROUND_CHANGED],
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContextClass,
foreground_changed),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gimp_context_signals[BACKGROUND_CHANGED] =
gtk_signal_new (gimp_context_signal_names[BACKGROUND_CHANGED],
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContextClass,
background_changed),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gimp_context_signals[OPACITY_CHANGED] =
gtk_signal_new (gimp_context_signal_names[OPACITY_CHANGED],
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContextClass,
opacity_changed),
gimp_marshal_NONE__DOUBLE,
GTK_TYPE_NONE, 1,
GTK_TYPE_DOUBLE);
gimp_context_signals[PAINT_MODE_CHANGED] =
gtk_signal_new (gimp_context_signal_names[PAINT_MODE_CHANGED],
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContextClass,
paint_mode_changed),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
gimp_context_signals[BRUSH_CHANGED] =
gtk_signal_new (gimp_context_signal_names[BRUSH_CHANGED],
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContextClass,
brush_changed),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gimp_context_signals[PATTERN_CHANGED] =
gtk_signal_new (gimp_context_signal_names[PATTERN_CHANGED],
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContextClass,
pattern_changed),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gimp_context_signals[GRADIENT_CHANGED] =
gtk_signal_new (gimp_context_signal_names[GRADIENT_CHANGED],
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContextClass,
gradient_changed),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
gimp_context_signals[PALETTE_CHANGED] =
gtk_signal_new (gimp_context_signal_names[PALETTE_CHANGED],
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContextClass,
palette_changed),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gtk_object_class_add_signals (object_class, gimp_context_signals,
LAST_SIGNAL);
object_class->set_arg = gimp_context_set_arg;
object_class->get_arg = gimp_context_get_arg;
object_class->destroy = gimp_context_destroy;
klass->image_changed = NULL;
klass->display_changed = NULL;
klass->tool_changed = NULL;
klass->foreground_changed = NULL;
klass->background_changed = NULL;
klass->opacity_changed = NULL;
klass->paint_mode_changed = NULL;
klass->brush_changed = NULL;
klass->pattern_changed = NULL;
klass->gradient_changed = NULL;
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
klass->palette_changed = NULL;
}
static void
gimp_context_init (GimpContext *context)
{
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
context->parent = NULL;
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
context->defined_args = GIMP_CONTEXT_ALL_ARGS_MASK;
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
context->image = NULL;
context->display = NULL;
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
context->tool = RECT_SELECT;
gimp_rgba_set (&context->foreground, 0.0, 0.0, 0.0, 1.0);
gimp_rgba_set (&context->background, 1.0, 1.0, 1.0, 1.0);
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
context->opacity = 1.0;
context->paint_mode = NORMAL_MODE;
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
context->brush = NULL;
context->brush_name = NULL;
1999-10-27 02:27:27 +08:00
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
context->pattern = NULL;
context->pattern_name = NULL;
1999-10-27 02:27:27 +08:00
context->gradient = NULL;
context->gradient_name = NULL;
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
context->palette = NULL;
context->palette_name = NULL;
1999-10-27 02:27:27 +08:00
context_list = g_slist_prepend (context_list, context);
}
static void
gimp_context_destroy (GtkObject *object)
{
GimpContext *context;
context = GIMP_CONTEXT (object);
if (context->parent)
gimp_context_unset_parent (context);
if (context->brush)
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
gtk_object_unref (GTK_OBJECT (context->brush));
if (context->brush_name)
{
g_free (context->brush_name);
context->brush_name = NULL;
}
if (context->pattern)
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
gtk_object_unref (GTK_OBJECT (context->pattern));
if (context->pattern_name)
{
g_free (context->pattern_name);
context->pattern_name = NULL;
}
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
if (context->gradient)
gtk_object_unref (GTK_OBJECT (context->gradient));
if (context->gradient_name)
{
g_free (context->gradient_name);
context->gradient_name = NULL;
}
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
if (context->palette)
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
gtk_object_unref (GTK_OBJECT (context->palette));
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
if (context->palette_name)
{
g_free (context->palette_name);
context->palette_name = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
context_list = g_slist_remove (context_list, context);
}
static void
gimp_context_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
{
GimpContext *context;
context = GIMP_CONTEXT (object);
switch (arg_id)
{
case ARG_IMAGE:
gimp_context_set_image (context, GTK_VALUE_POINTER (*arg));
break;
case ARG_DISPLAY:
gimp_context_set_display (context, GTK_VALUE_POINTER (*arg));
break;
case ARG_TOOL:
gimp_context_set_tool (context, GTK_VALUE_INT (*arg));
break;
case ARG_FOREGROUND:
gimp_context_set_foreground (context, GTK_VALUE_POINTER (*arg));
break;
case ARG_BACKGROUND:
gimp_context_set_background (context, GTK_VALUE_POINTER (*arg));
break;
case ARG_OPACITY:
gimp_context_set_opacity (context, GTK_VALUE_DOUBLE (*arg));
break;
case ARG_PAINT_MODE:
gimp_context_set_paint_mode (context, GTK_VALUE_INT (*arg));
break;
case ARG_BRUSH:
gimp_context_set_brush (context, GTK_VALUE_POINTER (*arg));
break;
case ARG_PATTERN:
gimp_context_set_pattern (context, GTK_VALUE_POINTER (*arg));
break;
case ARG_GRADIENT:
gimp_context_set_gradient (context, GTK_VALUE_POINTER (*arg));
break;
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
case ARG_PALETTE:
gimp_context_set_palette (context, GTK_VALUE_POINTER (*arg));
break;
default:
break;
}
}
static void
gimp_context_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
{
GimpContext *context;
context = GIMP_CONTEXT (object);
switch (arg_id)
{
case ARG_IMAGE:
GTK_VALUE_POINTER (*arg) = gimp_context_get_image (context);
break;
case ARG_DISPLAY:
GTK_VALUE_POINTER (*arg) = gimp_context_get_display (context);
break;
case ARG_TOOL:
GTK_VALUE_INT (*arg) = gimp_context_get_tool (context);
break;
case ARG_FOREGROUND:
gimp_context_get_foreground (context, GTK_VALUE_POINTER (*arg));
break;
case ARG_BACKGROUND:
gimp_context_get_background (context, GTK_VALUE_POINTER (*arg));
break;
case ARG_OPACITY:
GTK_VALUE_DOUBLE (*arg) = gimp_context_get_opacity (context);
break;
case ARG_PAINT_MODE:
GTK_VALUE_INT (*arg) = gimp_context_get_paint_mode (context);
break;
case ARG_BRUSH:
GTK_VALUE_POINTER (*arg) = gimp_context_get_brush (context);
break;
case ARG_PATTERN:
GTK_VALUE_POINTER (*arg) = gimp_context_get_pattern (context);
break;
case ARG_GRADIENT:
GTK_VALUE_POINTER (*arg) = gimp_context_get_gradient (context);
break;
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
case ARG_PALETTE:
GTK_VALUE_POINTER (*arg) = gimp_context_get_palette (context);
break;
default:
arg->type = GTK_TYPE_INVALID;
break;
}
}
1999-10-27 02:27:27 +08:00
/*****************************************************************************/
/* public functions ********************************************************/
GtkType
gimp_context_get_type (void)
{
static GtkType context_type = 0;
if (! context_type)
{
GtkTypeInfo context_info =
{
"GimpContext",
sizeof (GimpContext),
sizeof (GimpContextClass),
(GtkClassInitFunc) gimp_context_class_init,
(GtkObjectInitFunc) gimp_context_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
};
context_type = gtk_type_unique (GIMP_TYPE_OBJECT, &context_info);
}
return context_type;
}
GimpContext *
gimp_context_new (const gchar *name,
GimpContext *template)
{
GimpContext *context;
g_return_val_if_fail (!template || GIMP_IS_CONTEXT (template), NULL);
context = gtk_type_new (GIMP_TYPE_CONTEXT);
/* FIXME: need unique names here */
if (! name)
name = "Unnamed";
gimp_object_set_name (GIMP_OBJECT (context), name);
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
gtk_signal_connect_while_alive (GTK_OBJECT (image_context), "remove",
GTK_SIGNAL_FUNC (gimp_context_image_removed),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_brush_list), "remove",
GTK_SIGNAL_FUNC (gimp_context_brush_removed),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_brush_list), "thaw",
GTK_SIGNAL_FUNC (gimp_context_brush_list_thaw),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_pattern_list), "remove",
GTK_SIGNAL_FUNC (gimp_context_pattern_removed),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_pattern_list), "thaw",
GTK_SIGNAL_FUNC (gimp_context_pattern_list_thaw),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_gradient_list), "remove",
GTK_SIGNAL_FUNC (gimp_context_gradient_removed),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_gradient_list), "thaw",
GTK_SIGNAL_FUNC (gimp_context_gradient_list_thaw),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_palette_list), "remove",
GTK_SIGNAL_FUNC (gimp_context_palette_removed),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_palette_list), "thaw",
GTK_SIGNAL_FUNC (gimp_context_palette_list_thaw),
context,
GTK_OBJECT (context));
if (template)
{
context->defined_args = template->defined_args;
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
gimp_context_copy_args (template, context, GIMP_CONTEXT_ALL_ARGS_MASK);
}
return context;
}
1999-10-27 02:27:27 +08:00
/*****************************************************************************/
/* getting/setting the special contexts ************************************/
GimpContext *
gimp_context_get_current (void)
{
return current_context;
}
void
gimp_context_set_current (GimpContext *context)
{
current_context = context;
}
GimpContext *
gimp_context_get_user (void)
{
return user_context;
}
void
gimp_context_set_user (GimpContext *context)
{
user_context = context;
}
GimpContext *
gimp_context_get_default (void)
{
return default_context;
}
void
gimp_context_set_default (GimpContext *context)
{
default_context = context;
}
GimpContext *
gimp_context_get_standard (void)
{
if (! standard_context)
{
standard_context = gimp_context_new ("Standard", NULL);
gtk_quit_add_destroy (TRUE, GTK_OBJECT (standard_context));
}
return standard_context;
}
1999-10-27 02:27:27 +08:00
/*****************************************************************************/
/* functions manipulating a single context *********************************/
const gchar *
gimp_context_get_name (const GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return gimp_object_get_name (GIMP_OBJECT (context));
}
1999-10-27 02:27:27 +08:00
void
gimp_context_set_name (GimpContext *context,
const gchar *name)
1999-10-27 02:27:27 +08:00
{
context_check_current (context);
context_return_if_fail (context);
if (! name)
name = "Unnamed";
1999-10-27 02:27:27 +08:00
gimp_object_set_name (GIMP_OBJECT (context), name);
1999-10-27 02:27:27 +08:00
}
GimpContext *
gimp_context_get_parent (const GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->parent;
}
void
gimp_context_set_parent (GimpContext *context,
GimpContext *parent)
{
GimpContextArgType arg;
context_check_current (context);
context_return_if_fail (context);
g_return_if_fail (!parent || GIMP_IS_CONTEXT (parent));
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
if (context == parent)
return;
for (arg = 0; arg < GIMP_CONTEXT_NUM_ARGS; arg++)
if (! ((1 << arg) & context->defined_args))
{
gimp_context_copy_arg (parent, context, arg);
gtk_signal_connect_object (GTK_OBJECT (parent),
gimp_context_signal_names[arg],
gimp_context_signal_handlers[arg],
GTK_OBJECT (context));
}
context->parent = parent;
}
void
gimp_context_unset_parent (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
if (context->parent)
{
if (context->defined_args != GIMP_CONTEXT_ALL_ARGS_MASK)
gtk_signal_disconnect_by_data (GTK_OBJECT (context->parent), context);
context->parent = NULL;
}
}
/* define / undefinine context arguments */
void
gimp_context_define_arg (GimpContext *context,
GimpContextArgType arg,
gboolean defined)
{
GimpContextArgMask mask;
context_check_current (context);
context_return_if_fail (context);
g_return_if_fail ((arg >= 0) && (arg < GIMP_CONTEXT_NUM_ARGS));
mask = (1 << arg);
if (defined)
{
if (! (context->defined_args & mask))
{
context->defined_args |= mask;
if (context->parent)
gtk_signal_disconnect_by_func (GTK_OBJECT (context->parent),
gimp_context_signal_handlers[arg],
context);
}
}
else
{
if (context->defined_args & mask)
{
context->defined_args &= ~mask;
if (context->parent)
{
gimp_context_copy_arg (context->parent, context, arg);
gtk_signal_connect_object (GTK_OBJECT (context->parent),
gimp_context_signal_names[arg],
gimp_context_signal_handlers[arg],
GTK_OBJECT (context));
}
}
}
}
gboolean
gimp_context_arg_defined (GimpContext *context,
GimpContextArgType arg)
{
context_check_current (context);
context_return_val_if_fail (context, FALSE);
return (context->defined_args & (1 << arg)) ? TRUE : FALSE;
}
void
gimp_context_define_args (GimpContext *context,
GimpContextArgMask args_mask,
gboolean defined)
{
GimpContextArgType arg;
context_check_current (context);
context_return_if_fail (context);
for (arg = 0; arg < GIMP_CONTEXT_NUM_ARGS; arg++)
if ((1 << arg) & args_mask)
gimp_context_define_arg (context, arg, defined);
}
/* copying context arguments */
void
gimp_context_copy_arg (GimpContext *src,
GimpContext *dest,
GimpContextArgType arg)
{
context_check_current (src);
context_return_if_fail (src);
context_check_current (dest);
context_return_if_fail (dest);
g_return_if_fail ((arg >= 0) && (arg < GIMP_CONTEXT_NUM_ARGS));
(* gimp_context_copy_arg_funcs[arg]) (src, dest);
}
void
gimp_context_copy_args (GimpContext *src,
GimpContext *dest,
GimpContextArgMask args_mask)
{
GimpContextArgType arg;
context_check_current (src);
context_return_if_fail (src);
context_check_current (dest);
context_return_if_fail (dest);
for (arg = 0; arg < GIMP_CONTEXT_NUM_ARGS; arg++)
if ((1 << arg) & args_mask)
{
gimp_context_copy_arg (src, dest, arg);
}
}
/* attribute access functions */
/*****************************************************************************/
/* manipulate by GtkType ***************************************************/
GimpContextArgType
gimp_context_type_to_arg (GtkType type)
{
gint i;
for (i = 0; i < GIMP_CONTEXT_NUM_ARGS; i++)
{
if (gimp_context_arg_types[i] == type)
return i;
}
return -1;
}
const gchar *
gimp_context_type_to_signal_name (GtkType type)
{
gint i;
for (i = 0; i < GIMP_CONTEXT_NUM_ARGS; i++)
{
if (gimp_context_arg_types[i] == type)
return gimp_context_signal_names[i];
}
return NULL;
}
GimpObject *
gimp_context_get_by_type (GimpContext *context,
GtkType type)
{
GimpContextArgType arg;
GimpObject *object = NULL;
context_check_current (context);
context_return_val_if_fail (context, NULL);
g_return_val_if_fail ((arg = gimp_context_type_to_arg (type)) != -1, NULL);
gtk_object_get (GTK_OBJECT (context),
gimp_context_arg_names[arg], &object,
NULL);
return object;
}
void
gimp_context_set_by_type (GimpContext *context,
GtkType type,
GimpObject *object)
{
GimpContextArgType arg;
context_check_current (context);
context_return_if_fail (context);
g_return_if_fail ((arg = gimp_context_type_to_arg (type)) != -1);
gtk_object_set (GTK_OBJECT (context),
gimp_context_arg_names[arg], object,
NULL);
}
void
gimp_context_changed_by_type (GimpContext *context,
GtkType type)
{
GimpContextArgType arg;
GimpObject *object;
context_check_current (context);
context_return_if_fail (context);
g_return_if_fail ((arg = gimp_context_type_to_arg (type)) != -1);
object = gimp_context_get_by_type (context, type);
gtk_signal_emit (GTK_OBJECT (context),
gimp_context_signals[arg],
object);
}
1999-10-27 02:27:27 +08:00
/*****************************************************************************/
/* image *******************************************************************/
GimpImage *
gimp_context_get_image (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->image;
}
void
gimp_context_set_image (GimpContext *context,
GimpImage *image)
{
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_IMAGE_MASK);
gimp_context_real_set_image (context, image);
}
void
gimp_context_image_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
gimp_context_signals[IMAGE_CHANGED],
context->image);
}
/* handle disappearing images */
static void
gimp_context_image_removed (GimpContainer *container,
GimpImage *image,
GimpContext *context)
{
if (context->image == image)
gimp_context_real_set_image (context, NULL);
}
static void
gimp_context_real_set_image (GimpContext *context,
GimpImage *image)
{
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
if (context->image == image)
return;
context->image = image;
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
gimp_context_image_changed (context);
}
static void
gimp_context_copy_image (GimpContext *src,
GimpContext *dest)
{
gimp_context_real_set_image (dest, src->image);
}
1999-10-27 02:27:27 +08:00
/*****************************************************************************/
/* display *****************************************************************/
GDisplay *
gimp_context_get_display (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->display;
}
void
gimp_context_set_display (GimpContext *context,
GDisplay *display)
{
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_DISPLAY_MASK);
gimp_context_real_set_display (context, display);
}
void
gimp_context_display_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
gimp_context_signals[DISPLAY_CHANGED],
context->display);
}
/* handle dissapearing displays */
static void
gimp_context_display_destroy (GtkWidget *disp_shell,
GimpContext *context)
{
1999-10-27 02:27:27 +08:00
context->display = NULL;
gimp_context_display_changed (context);
}
static void
gimp_context_real_set_display (GimpContext *context,
GDisplay *display)
{
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
if (context->display == display)
return;
if (context->display && GTK_IS_OBJECT (context->display->shell))
gtk_signal_disconnect_by_data (GTK_OBJECT (context->display->shell),
context);
if (display)
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
gtk_signal_connect_while_alive
(GTK_OBJECT (display->shell), "destroy",
GTK_SIGNAL_FUNC (gimp_context_display_destroy),
context,
GTK_OBJECT (context));
context->display = display;
/* set the image _before_ emitting the display_changed signal */
if (display)
gimp_context_real_set_image (context, display->gimage);
gimp_context_display_changed (context);
}
static void
gimp_context_copy_display (GimpContext *src,
GimpContext *dest)
{
gimp_context_real_set_display (dest, src->display);
}
1999-10-27 02:27:27 +08:00
/*****************************************************************************/
/* tool ********************************************************************/
ToolType
gimp_context_get_tool (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, 0);
return context->tool;
}
void
gimp_context_set_tool (GimpContext *context,
ToolType tool)
{
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_TOOL_MASK);
gimp_context_real_set_tool (context, tool);
}
void
gimp_context_tool_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
gimp_context_signals[TOOL_CHANGED],
context->tool);
}
static void
gimp_context_real_set_tool (GimpContext *context,
ToolType tool)
{
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
if (context->tool == tool)
return;
context->tool = tool;
gimp_context_tool_changed (context);
}
static void
gimp_context_copy_tool (GimpContext *src,
GimpContext *dest)
{
gimp_context_real_set_tool (dest, src->tool);
}
1999-10-27 02:27:27 +08:00
/*****************************************************************************/
/* foreground color ********************************************************/
void
gimp_context_get_foreground (GimpContext *context,
GimpRGB *color)
{
context_check_current (context);
context_return_if_fail (context);
g_return_if_fail (color != NULL);
*color = context->foreground;
}
void
gimp_context_set_foreground (GimpContext *context,
const GimpRGB *color)
{
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_FOREGROUND_MASK);
g_return_if_fail (color != NULL);
gimp_context_real_set_foreground (context, color);
}
void
gimp_context_foreground_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
gimp_context_signals[FOREGROUND_CHANGED],
&context->foreground);
}
static void
gimp_context_real_set_foreground (GimpContext *context,
const GimpRGB *color)
{
if (gimp_rgba_distance (&context->foreground, color) < 0.0001)
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
return;
context->foreground = *color;
gimp_context_foreground_changed (context);
}
static void
gimp_context_copy_foreground (GimpContext *src,
GimpContext *dest)
{
gimp_context_real_set_foreground (dest, &src->foreground);
}
1999-10-27 02:27:27 +08:00
/*****************************************************************************/
/* background color ********************************************************/
void
gimp_context_get_background (GimpContext *context,
GimpRGB *color)
{
context_check_current (context);
context_return_if_fail (context);
g_return_if_fail (color != NULL);
*color = context->background;
}
finished new GimpColorArea widget which uses GimpRGB and handles DND and 2001-01-10 Sven Neumann <sven@gimp.org> * libgimp/gimpcolorarea.[ch]: finished new GimpColorArea widget which uses GimpRGB and handles DND and alpha channel. * libgimp/gimpcolorbutton.[ch]: use GimpColorArea. The API of the GimpColorButton has changed! * libgimp/gimpwidgets.[ch]: added temporary function gimp_color_update_uchar() to ease migration of plug-ins to GimpRGB. This function will go away. * plug-ins/Lighting/lighting_main.h * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_main.h * plug-ins/MapObject/mapobject_ui.c * plug-ins/common/colorify.c * plug-ins/common/colortoalpha.c * plug-ins/common/exchange.c * plug-ins/common/film.c * plug-ins/common/grid.c * plug-ins/common/mapcolor.c * plug-ins/common/nova.c * plug-ins/common/papertile.c * plug-ins/common/sinus.c * plug-ins/gdyntext/gdyntext_ui.c * plug-ins/ifscompose/ifscompose.[ch] * plug-ins/ifscompose/ifscompose_storage.c * plug-ins/ifscompose/ifscompose_utils.c * plug-ins/script-fu/script-fu-scripts.c: use new GimpColorArea and GimpColorButton. Started to introduce GimpRGB color type. This change might have broken some of these plug-ins. This is work in progress. * libgimp/Makefile.am: added GimpColorArea and GimpColorButton to libgimpi. * app/gimpcontext.[ch]: added gimp_palette_get_[fore|back]ground() functions so the app can link against libgimp/gimpcolorbutton.o. These functions will go away. * app/gimpdnd.c: use a GimpColorArea for DND
2001-01-11 06:49:45 +08:00
void
gimp_context_set_background (GimpContext *context,
const GimpRGB *color)
{
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_BACKGROUND_MASK);
g_return_if_fail (color != NULL);
gimp_context_real_set_background (context, color);
}
void
gimp_context_background_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
gimp_context_signals[BACKGROUND_CHANGED],
&context->background);
}
static void
gimp_context_real_set_background (GimpContext *context,
const GimpRGB *color)
{
if (gimp_rgba_distance (&context->background, color) < 0.0001)
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
return;
context->background = *color;
gimp_context_background_changed (context);
}
static void
gimp_context_copy_background (GimpContext *src,
GimpContext *dest)
{
gimp_context_real_set_background (dest, &src->background);
}
1999-10-27 02:27:27 +08:00
/*****************************************************************************/
/* color utility functions *************************************************/
void
gimp_context_set_default_colors (GimpContext *context)
{
GimpContext *bg_context;
GimpRGB fg;
GimpRGB bg;
1999-10-27 02:27:27 +08:00
bg_context = context;
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_FOREGROUND_MASK);
context_find_defined (bg_context, GIMP_CONTEXT_BACKGROUND_MASK);
gimp_rgba_set (&fg, 0.0, 0.0, 0.0, 1.0);
gimp_rgba_set (&bg, 1.0, 1.0, 1.0, 1.0);
gimp_context_real_set_foreground (context, &fg);
gimp_context_real_set_background (bg_context, &bg);
1999-10-27 02:27:27 +08:00
}
void
gimp_context_swap_colors (GimpContext *context)
{
GimpContext *bg_context;
GimpRGB fg;
GimpRGB bg;
1999-10-27 02:27:27 +08:00
bg_context = context;
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_FOREGROUND_MASK);
context_find_defined (bg_context, GIMP_CONTEXT_BACKGROUND_MASK);
gimp_context_get_foreground (context, &fg);
gimp_context_get_background (bg_context, &bg);
1999-10-27 02:27:27 +08:00
gimp_context_real_set_foreground (context, &bg);
gimp_context_real_set_background (bg_context, &fg);
1999-10-27 02:27:27 +08:00
}
/*****************************************************************************/
/* opacity *****************************************************************/
gdouble
gimp_context_get_opacity (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, 1.0);
return context->opacity;
}
void
gimp_context_set_opacity (GimpContext *context,
gdouble opacity)
{
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_OPACITY_MASK);
gimp_context_real_set_opacity (context, opacity);
}
void
gimp_context_opacity_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
gimp_context_signals[OPACITY_CHANGED],
context->opacity);
}
static void
gimp_context_real_set_opacity (GimpContext *context,
gdouble opacity)
{
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
if (context->opacity == opacity)
return;
context->opacity = opacity;
gimp_context_opacity_changed (context);
}
static void
gimp_context_copy_opacity (GimpContext *src,
GimpContext *dest)
{
gimp_context_real_set_opacity (dest, src->opacity);
}
1999-10-27 02:27:27 +08:00
/*****************************************************************************/
/* paint mode **************************************************************/
LayerModeEffects
gimp_context_get_paint_mode (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, 0);
return context->paint_mode;
}
void
gimp_context_set_paint_mode (GimpContext *context,
LayerModeEffects paint_mode)
{
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_PAINT_MODE_MASK);
gimp_context_real_set_paint_mode (context, paint_mode);
}
void
gimp_context_paint_mode_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
gimp_context_signals[PAINT_MODE_CHANGED],
context->paint_mode);
}
static void
gimp_context_real_set_paint_mode (GimpContext *context,
LayerModeEffects paint_mode)
{
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
if (context->paint_mode == paint_mode)
return;
context->paint_mode = paint_mode;
gimp_context_paint_mode_changed (context);
}
static void
gimp_context_copy_paint_mode (GimpContext *src,
GimpContext *dest)
{
gimp_context_real_set_paint_mode (dest, src->paint_mode);
}
1999-10-27 02:27:27 +08:00
/*****************************************************************************/
/* brush *******************************************************************/
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
static GimpBrush *standard_brush = NULL;
GimpBrush *
gimp_context_get_brush (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->brush;
}
void
gimp_context_set_brush (GimpContext *context,
GimpBrush *brush)
{
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_BRUSH_MASK);
gimp_context_real_set_brush (context, brush);
}
void
gimp_context_brush_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
gimp_context_signals[BRUSH_CHANGED],
context->brush);
}
1999-10-27 02:27:27 +08:00
/* the active brush was modified */
static void
gimp_context_brush_dirty (GimpBrush *brush,
GimpContext *context)
{
g_free (context->brush_name);
context->brush_name = g_strdup (GIMP_OBJECT (brush)->name);
1999-10-27 02:27:27 +08:00
gimp_context_brush_changed (context);
1999-10-27 02:27:27 +08:00
}
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
/* the global brush list is there again after refresh */
static void
gimp_context_brush_list_thaw (GimpContainer *container,
GimpContext *context)
{
GimpBrush *brush;
if (! context->brush_name)
context->brush_name = g_strdup (default_brush);
if ((brush = (GimpBrush *)
gimp_container_get_child_by_name (container,
context->brush_name)))
{
gimp_context_real_set_brush (context, brush);
return;
}
if (gimp_container_num_children (container))
gimp_context_real_set_brush
(context, GIMP_BRUSH (gimp_container_get_child_by_index (container, 0)));
else
gimp_context_real_set_brush (context, brushes_get_standard_brush ());
}
1999-10-27 02:27:27 +08:00
/* the active brush disappeared */
static void
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
gimp_context_brush_removed (GimpContainer *container,
1999-10-27 02:27:27 +08:00
GimpBrush *brush,
GimpContext *context)
{
if (brush == context->brush)
{
context->brush = NULL;
gtk_signal_disconnect_by_func (GTK_OBJECT (brush),
gimp_context_brush_dirty,
context);
1999-10-27 02:27:27 +08:00
gtk_object_unref (GTK_OBJECT (brush));
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
if (! gimp_container_frozen (container))
gimp_context_brush_list_thaw (container, context);
1999-10-27 02:27:27 +08:00
}
}
static void
gimp_context_real_set_brush (GimpContext *context,
GimpBrush *brush)
{
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
if (! standard_brush)
standard_brush = brushes_get_standard_brush ();
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
if (context->brush == brush)
return;
if (context->brush_name && brush != standard_brush)
1999-10-27 02:27:27 +08:00
{
g_free (context->brush_name);
context->brush_name = NULL;
}
/* make sure the active brush is swapped before we get a new one... */
if (stingy_memory_use &&
context->brush && context->brush->mask &&
GTK_OBJECT (context->brush)->ref_count == 2)
{
temp_buf_swap (brush->mask);
}
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
/* disconnect from the old brush's signals */
1999-10-27 02:27:27 +08:00
if (context->brush)
{
gtk_signal_disconnect_by_func (GTK_OBJECT (context->brush),
gimp_context_brush_dirty,
context);
1999-10-27 02:27:27 +08:00
gtk_object_unref (GTK_OBJECT (context->brush));
}
context->brush = brush;
1999-10-27 02:27:27 +08:00
if (brush)
{
gtk_object_ref (GTK_OBJECT (brush));
gtk_signal_connect (GTK_OBJECT (brush), "invalidate_preview",
1999-10-27 02:27:27 +08:00
GTK_SIGNAL_FUNC (gimp_context_brush_dirty),
context);
gtk_signal_connect (GTK_OBJECT (brush), "name_changed",
1999-10-27 02:27:27 +08:00
GTK_SIGNAL_FUNC (gimp_context_brush_dirty),
context);
/* Make sure the active brush is unswapped... */
if (stingy_memory_use &&
brush->mask &&
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
GTK_OBJECT (brush)->ref_count < 2)
1999-10-27 02:27:27 +08:00
{
temp_buf_unswap (brush->mask);
}
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
if (brush != standard_brush)
context->brush_name = g_strdup (GIMP_OBJECT (brush)->name);
1999-10-27 02:27:27 +08:00
}
gimp_context_brush_changed (context);
}
static void
gimp_context_copy_brush (GimpContext *src,
GimpContext *dest)
{
gimp_context_real_set_brush (dest, src->brush);
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
if ((!src->brush || src->brush == standard_brush) && src->brush_name)
{
g_free (dest->brush_name);
dest->brush_name = g_strdup (src->brush_name);
}
}
1999-10-27 02:27:27 +08:00
/*****************************************************************************/
/* pattern *****************************************************************/
static GimpPattern *standard_pattern = NULL;
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
GimpPattern *
gimp_context_get_pattern (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->pattern;
}
void
gimp_context_set_pattern (GimpContext *context,
GimpPattern *pattern)
{
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_PATTERN_MASK);
gimp_context_real_set_pattern (context, pattern);
}
void
gimp_context_pattern_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
gimp_context_signals[PATTERN_CHANGED],
context->pattern);
}
/* the active pattern was modified */
static void
gimp_context_pattern_dirty (GimpPattern *pattern,
GimpContext *context)
{
g_free (context->pattern_name);
context->pattern_name = g_strdup (GIMP_OBJECT (pattern)->name);
gimp_context_pattern_changed (context);
}
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
/* the global pattern list is there again after refresh */
static void
gimp_context_pattern_list_thaw (GimpContainer *container,
GimpContext *context)
{
GimpPattern *pattern;
if (! context->pattern_name)
context->pattern_name = g_strdup (default_pattern);
if ((pattern = (GimpPattern *)
gimp_container_get_child_by_name (container,
context->pattern_name)))
{
gimp_context_real_set_pattern (context, pattern);
return;
}
if (gimp_container_num_children (container))
gimp_context_real_set_pattern
(context,
GIMP_PATTERN (gimp_container_get_child_by_index (container, 0)));
else
gimp_context_real_set_pattern (context, patterns_get_standard_pattern ());
}
/* the active pattern disappeared */
static void
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
gimp_context_pattern_removed (GimpContainer *container,
GimpPattern *pattern,
GimpContext *context)
{
if (pattern == context->pattern)
{
context->pattern = NULL;
gtk_signal_disconnect_by_func (GTK_OBJECT (pattern),
gimp_context_pattern_dirty,
context);
gtk_object_unref (GTK_OBJECT (pattern));
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
if (! gimp_container_frozen (container))
gimp_context_brush_list_thaw (container, context);
}
}
static void
gimp_context_real_set_pattern (GimpContext *context,
GimpPattern *pattern)
{
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
if (! standard_pattern)
standard_pattern = patterns_get_standard_pattern ();
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
if (context->pattern == pattern)
return;
if (context->pattern_name && pattern != standard_pattern)
1999-10-27 02:27:27 +08:00
{
g_free (context->pattern_name);
context->pattern_name = NULL;
}
/* make sure the active pattern is swapped before we get a new one... */
if (stingy_memory_use &&
context->pattern && context->pattern->mask &&
GTK_OBJECT (context->pattern)->ref_count == 2)
{
temp_buf_swap (pattern->mask);
}
/* disconnect from the old pattern's signals */
if (context->pattern)
{
gtk_signal_disconnect_by_func (GTK_OBJECT (context->pattern),
gimp_context_pattern_dirty,
context);
gtk_object_unref (GTK_OBJECT (context->pattern));
}
context->pattern = pattern;
1999-10-27 02:27:27 +08:00
if (pattern)
{
gtk_object_ref (GTK_OBJECT (pattern));
gtk_signal_connect (GTK_OBJECT (pattern), "name_changed",
GTK_SIGNAL_FUNC (gimp_context_pattern_dirty),
context);
/* Make sure the active pattern is unswapped... */
if (stingy_memory_use &&
pattern->mask &&
GTK_OBJECT (pattern)->ref_count < 2)
{
temp_buf_unswap (pattern->mask);
}
if (pattern != standard_pattern)
context->pattern_name = g_strdup (GIMP_OBJECT (pattern)->name);
}
1999-10-27 02:27:27 +08:00
gimp_context_pattern_changed (context);
}
static void
gimp_context_copy_pattern (GimpContext *src,
GimpContext *dest)
{
gimp_context_real_set_pattern (dest, src->pattern);
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
if ((!src->pattern || src->pattern == standard_pattern) && src->pattern_name)
{
g_free (dest->pattern_name);
dest->pattern_name = g_strdup (src->pattern_name);
}
}
1999-10-27 02:27:27 +08:00
/*****************************************************************************/
/* gradient ****************************************************************/
static GimpGradient *standard_gradient = NULL;
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
GimpGradient *
gimp_context_get_gradient (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->gradient;
}
void
gimp_context_set_gradient (GimpContext *context,
GimpGradient *gradient)
{
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_GRADIENT_MASK);
gimp_context_real_set_gradient (context, gradient);
}
void
gimp_context_gradient_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
gimp_context_signals[GRADIENT_CHANGED],
context->gradient);
}
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
/* the active gradient was modified */
static void
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
gimp_context_gradient_dirty (GimpGradient *gradient,
GimpContext *context)
{
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
g_free (context->gradient_name);
context->gradient_name = g_strdup (GIMP_OBJECT (gradient)->name);
1999-10-27 02:27:27 +08:00
gimp_context_gradient_changed (context);
}
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
/* the global gradient list is there again after refresh */
static void
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
gimp_context_gradient_list_thaw (GimpContainer *container,
GimpContext *context)
1999-10-27 02:27:27 +08:00
{
GimpGradient *gradient;
1999-10-27 02:27:27 +08:00
if (! context->gradient_name)
context->gradient_name = g_strdup (default_gradient);
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
if ((gradient = (GimpGradient *)
gimp_container_get_child_by_name (container,
context->gradient_name)))
1999-10-27 02:27:27 +08:00
{
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
gimp_context_real_set_gradient (context, gradient);
1999-10-28 23:05:49 +08:00
return;
1999-10-27 02:27:27 +08:00
}
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
if (gimp_container_num_children (container))
gimp_context_real_set_gradient
(context,
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
GIMP_GRADIENT (gimp_container_get_child_by_index (container, 0)));
1999-10-27 02:27:27 +08:00
else
gimp_context_real_set_gradient (context, gradients_get_standard_gradient ());
}
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
/* the active gradient disappeared */
static void
gimp_context_gradient_removed (GimpContainer *container,
GimpGradient *gradient,
GimpContext *context)
1999-10-27 02:27:27 +08:00
{
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
if (gradient == context->gradient)
{
context->gradient = NULL;
gtk_signal_disconnect_by_func (GTK_OBJECT (gradient),
gimp_context_gradient_dirty,
context);
gtk_object_unref (GTK_OBJECT (gradient));
if (! gimp_container_frozen (container))
gimp_context_brush_list_thaw (container, context);
}
1999-10-27 02:27:27 +08:00
}
static void
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
gimp_context_real_set_gradient (GimpContext *context,
GimpGradient *gradient)
1999-10-27 02:27:27 +08:00
{
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
if (! standard_gradient)
standard_gradient = gradients_get_standard_gradient ();
1999-10-27 02:27:27 +08:00
if (context->gradient == gradient)
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
return;
if (context->gradient_name && gradient != standard_gradient)
{
g_free (context->gradient_name);
context->gradient_name = NULL;
}
/* disconnect from the old gradient's signals */
if (context->gradient)
1999-10-27 02:27:27 +08:00
{
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
gtk_signal_disconnect_by_func (GTK_OBJECT (context->gradient),
gimp_context_gradient_dirty,
context);
gtk_object_unref (GTK_OBJECT (context->gradient));
}
context->gradient = gradient;
1999-10-27 02:27:27 +08:00
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
if (gradient)
{
gtk_object_ref (GTK_OBJECT (gradient));
gtk_signal_connect (GTK_OBJECT (gradient), "name_changed",
GTK_SIGNAL_FUNC (gimp_context_gradient_dirty),
context);
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
if (gradient != standard_gradient)
context->gradient_name = g_strdup (GIMP_OBJECT (gradient)->name);
1999-10-27 02:27:27 +08:00
}
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
gimp_context_gradient_changed (context);
}
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
static void
gimp_context_copy_gradient (GimpContext *src,
GimpContext *dest)
1999-10-27 02:27:27 +08:00
{
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
gimp_context_real_set_gradient (dest, src->gradient);
if ((!src->gradient || src->gradient == standard_gradient) &&
src->gradient_name)
{
g_free (dest->gradient_name);
dest->gradient_name = g_strdup (src->gradient_name);
}
1999-10-27 02:27:27 +08:00
}
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
/*****************************************************************************/
/* palette *****************************************************************/
static GimpPalette *standard_palette = NULL;
GimpPalette *
gimp_context_get_palette (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->palette;
}
void
gimp_context_set_palette (GimpContext *context,
GimpPalette *palette)
{
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_PALETTE_MASK);
gimp_context_real_set_palette (context, palette);
}
void
gimp_context_palette_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
gimp_context_signals[PALETTE_CHANGED],
context->palette);
}
/* the active palette was modified */
static void
gimp_context_palette_dirty (GimpPalette *palette,
GimpContext *context)
{
g_free (context->palette_name);
context->palette_name = g_strdup (GIMP_OBJECT (palette)->name);
gimp_context_palette_changed (context);
}
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
/* the global gradient list is there again after refresh */
static void
gimp_context_palette_list_thaw (GimpContainer *container,
GimpContext *context)
{
GimpPalette *palette;
if (! context->palette_name)
context->palette_name = g_strdup (default_palette);
if ((palette = (GimpPalette *)
gimp_container_get_child_by_name (container,
context->palette_name)))
{
gimp_context_real_set_palette (context, palette);
return;
}
if (gimp_container_num_children (container))
gimp_context_real_set_palette
(context,
GIMP_PALETTE (gimp_container_get_child_by_index (container, 0)));
else
gimp_context_real_set_palette (context, palettes_get_standard_palette ());
}
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
/* the active palette disappeared */
static void
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
gimp_context_palette_removed (GimpContainer *container,
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
GimpPalette *palette,
GimpContext *context)
{
if (palette == context->palette)
{
context->palette = NULL;
gtk_signal_disconnect_by_func (GTK_OBJECT (palette),
gimp_context_palette_dirty,
context);
gtk_object_unref (GTK_OBJECT (palette));
took gimpcontextpreview.[ch] out of the build but still left the sources 2001-02-12 Michael Natterer <mitch@gimp.org> * app/Makefile.am: took gimpcontextpreview.[ch] out of the build but still left the sources there as reference. * app/app_procs.c: initialize the render stuff before creating the toolbox (needed for the previews). * app/devices.c * app/indicator_area.c: use GimpPreviews instead of GimpContextPreviews. * app/context_manager.[ch]: create the global data lists here because they now must exist before any context is created. * app/brushes.[ch] * app/gradients.[ch] * app/palettes.[ch] * app/patterns.[ch]: removed them here. * app/gimpcontainer.[ch]: added a "freeze_count" and emit the "freeze" and "thaw" signals accordingly. * app/gimpcontext.[ch]: greatly simplified the way how the contexts connect to the data lists (simply keep them connected all the time). Also removed all those ugly explicit update functions because "thaw" callbacks do this job now. * app/gimpdata.c: a GimpData object now becomes dirty on "name_changed"; "dirty" now triggers "invalidate_preview" because the context does not dispatch these signals any more soon. * app/brush_select.c * app/convert.c * app/gimpdnd.c * app/gradient_editor.c * app/gradient_select.c * app/pattern_select.c * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-12 11:27:28 +08:00
if (! gimp_container_frozen (container))
gimp_context_brush_list_thaw (container, context);
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-12 00:14:25 +08:00
}
}
static void
gimp_context_real_set_palette (GimpContext *context,
GimpPalette *palette)
{
if (! standard_palette)
standard_palette = palettes_get_standard_palette ();
if (context->palette == palette)
return;
if (context->palette_name && palette != standard_palette)
{
g_free (context->palette_name);
context->palette_name = NULL;
}
/* disconnect from the old palette's signals */
if (context->palette)
{
gtk_signal_disconnect_by_func (GTK_OBJECT (context->palette),
gimp_context_palette_dirty,
context);
gtk_object_unref (GTK_OBJECT (context->palette));
}
context->palette = palette;
if (palette)
{
gtk_object_ref (GTK_OBJECT (palette));
gtk_signal_connect (GTK_OBJECT (palette), "name_changed",
GTK_SIGNAL_FUNC (gimp_context_palette_dirty),
context);
if (palette != standard_palette)
context->palette_name = g_strdup (GIMP_OBJECT (palette)->name);
}
gimp_context_palette_changed (context);
}
static void
gimp_context_copy_palette (GimpContext *src,
GimpContext *dest)
{
gimp_context_real_set_palette (dest, src->palette);
if ((!src->palette || src->palette == standard_palette) && src->palette_name)
{
g_free (dest->palette_name);
dest->palette_name = g_strdup (src->palette_name);
}
}