app/Makefile.am removed.

2001-07-07  Michael Natterer  <mitch@gimp.org>

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

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

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

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

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

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

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

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

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

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

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

	* app/tools/*: changed accordingly.

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

113
ChangeLog
View File

@ -1,3 +1,116 @@
2001-07-07 Michael Natterer <mitch@gimp.org>
* app/Makefile.am
* app/context_manager.[ch]: removed.
* app/app_procs.c: call tool_mananger instead of context_manager
functions, pass "the_gimp" to some more functions.
* app/drawable.[ch]: pass a GimpContext to drawable_fill().
* app/errors.c: behave according to "stack_trace_mode" when using
the debugging signal handler.
* app/gimprc.[ch]: removed the core/ config variables.
* app/selection.c: set the selection's state to INVISIBLE in
selection_pause().
* app/core/Makefile.am
* app/core/gimpcoreconfig.[ch]: new files (the configuration
variables used by core/).
* app/core/gimpcontext.[ch]: removed the global contexts (user,
default, ...) and their functions. It's no longer possible to pass
NULL to the context functions to manipulate the current context
(gimpcontext.c doesn't know the current context any more).
* app/core/gimp.[ch]: added them here. The functions are now called
gimp_[set|get]_*_context(). Added gimp_create_context() which is
the only function to create contexts now.
* app/gui/dialogs.[ch]
* app/gui/gui.[ch]: pass "gimp" to all functions.
* app/tools/tool_manager.[ch]
* app/tools/tools.[ch]: pass "gimp" to lots of functions. Added
the "global_tool_context" logic and the global/non-global paint
options switching from the context_manager. Pass "gimp" to all
tools' "register" functions.
* app/tools/*: changed accordingly.
* app/devices.c
* app/disp_callbacks.c
* app/file-open.[ch]
* app/file-save.c
* app/gdisplay.c
* app/gimage.c
* app/libgimp_glue.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/qmask.c
* app/undo.c
* app/base/base-config.c
* app/core/gimpbrushpipe.c
* app/core/gimpdrawable-offset.c
* app/core/gimpgradient.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.c
* app/core/gimpimage-new.c
* app/core/gimpimage.c
* app/core/gimppalette.c
* app/core/gimptoolinfo.[ch]
* app/core/gimpundo.c
* app/gui/brush-select.c
* app/gui/channels-commands.c
* app/gui/color-area.c
* app/gui/dialogs-constructors.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradient-select.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/palette-editor.c
* app/gui/palette-import-dialog.c
* app/gui/palette-select.c
* app/gui/paths-dialog.c
* app/gui/pattern-select.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.c
* app/gui/test-commands.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/widgets/gimpchannellistview.c
* app/widgets/gimpdnd.c
* app/widgets/gimpdrawablelistview.[ch]
* app/widgets/gimpimagedock.c
* app/widgets/gimplayerlistview.c
* app/pdb/brushes_cmds.c
* app/pdb/drawable_cmds.c
* app/pdb/gradient_select_cmds.c
* app/pdb/gradients_cmds.c
* app/pdb/palette_cmds.c
* app/pdb/patterns_cmds.c
* app/pdb/procedural_db.c
* tools/pdbgen/pdb/brushes.pdb
* tools/pdbgen/pdb/drawable.pdb
* tools/pdbgen/pdb/gradient_select.pdb
* tools/pdbgen/pdb/gradients.pdb
* tools/pdbgen/pdb/palette.pdb
* tools/pdbgen/pdb/patterns.pdb: changed accordingly: remove usage
of gimp_context_[get|set]_*(NULL), create contexts with
gimp_create_context(). Get the user/current context with
gimp_get_[user|current]_context(). Added/removed access to the
global "the_gimp" variable in some places. Get the core's config
variables from "core_config".
2001-07-06 Dave Neary <dneary@eircom.net>
* app/gimprc.c: Removed some C89 & gcc extention stuff which broke

View File

@ -79,8 +79,6 @@ gimp_SOURCES = @STRIP_BEGIN@ \
##
## stuff for core/
##
context_manager.c \
context_manager.h \
datafiles.c \
datafiles.h \
drawable.c \

View File

@ -25,6 +25,7 @@
#include "core/core-types.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
@ -37,6 +38,7 @@
#include "gdisplay.h"
#include "menus.h"
#include "app_procs.h"
#include "drawable.h"
#include "libgimp/gimpintl.h"
@ -314,7 +316,9 @@ new_channel_query_ok_callback (GtkWidget *widget,
channel_name,
&channel_color);
drawable_fill (GIMP_DRAWABLE (new_channel), TRANSPARENT_FILL);
drawable_fill (GIMP_DRAWABLE (new_channel),
gimp_get_user_context (the_gimp),
TRANSPARENT_FILL);
gimp_image_add_channel (gimage, new_channel, -1);
gdisplays_flush ();

View File

@ -30,6 +30,7 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
@ -42,6 +43,7 @@
#include "menus.h"
#include "resize-dialog.h"
#include "app_procs.h"
#include "drawable.h"
#include "gdisplay.h"
#include "floating_sel.h"
@ -542,7 +544,9 @@ new_layer_query_ok_callback (GtkWidget *widget,
layer_name, OPAQUE_OPACITY, NORMAL_MODE);
if (layer)
{
drawable_fill (GIMP_DRAWABLE (layer), fill_type);
drawable_fill (GIMP_DRAWABLE (layer),
gimp_get_user_context (the_gimp),
fill_type);
gimp_image_add_layer (gimage, layer, -1);
/* End the group undo */

View File

@ -89,6 +89,7 @@
#include "base/tile.h"
#include "base/tile-manager.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -322,18 +323,19 @@ plug_in_init (void)
plug_in_init_shm ();
/* search for binaries in the plug-in directory path */
gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE,
gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE,
plug_in_init_file, NULL);
/* read the pluginrc file for cached data */
filename = NULL;
if (gimprc.pluginrc_path)
if (core_config->pluginrc_path)
{
if (g_path_is_absolute (gimprc.pluginrc_path))
filename = g_strdup (gimprc.pluginrc_path);
if (g_path_is_absolute (core_config->pluginrc_path))
filename = g_strdup (core_config->pluginrc_path);
else
filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s",
gimp_directory (), gimprc.pluginrc_path);
gimp_directory (),
core_config->pluginrc_path);
}
else
filename = gimp_personal_rc_file ("pluginrc");
@ -853,7 +855,7 @@ plug_in_new (gchar *name)
if (! g_path_is_absolute (name))
{
path = plug_in_search_in_path (gimprc.plug_in_path, name);
path = plug_in_search_in_path (core_config->plug_in_path, name);
if (! path)
{

View File

@ -29,6 +29,7 @@
#include "core/core-types.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
@ -36,6 +37,7 @@
#include "widgets/gimpcolorpanel.h"
#include "app_procs.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
@ -238,7 +240,10 @@ qmask_activate (GtkWidget *widget,
"Qmask",
&color);
gimp_image_add_channel (gimg, gmask, 0);
drawable_fill (GIMP_DRAWABLE (gmask), TRANSPARENT_FILL);
drawable_fill (GIMP_DRAWABLE (gmask),
gimp_get_user_context (gimg->gimp),
TRANSPARENT_FILL);
}
else
{

View File

@ -29,6 +29,7 @@
#include "core/core-types.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
@ -36,6 +37,7 @@
#include "widgets/gimpcolorpanel.h"
#include "app_procs.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
@ -238,7 +240,10 @@ qmask_activate (GtkWidget *widget,
"Qmask",
&color);
gimp_image_add_channel (gimg, gmask, 0);
drawable_fill (GIMP_DRAWABLE (gmask), TRANSPARENT_FILL);
drawable_fill (GIMP_DRAWABLE (gmask),
gimp_get_user_context (gimg->gimp),
TRANSPARENT_FILL);
}
else
{

View File

@ -42,14 +42,14 @@ void
tools_default_colors_cmd_callback (GtkWidget *widget,
gpointer data)
{
gimp_context_set_default_colors (gimp_context_get_user ());
gimp_context_set_default_colors (gimp_get_user_context (the_gimp));
}
void
tools_swap_colors_cmd_callback (GtkWidget *widget,
gpointer data)
{
gimp_context_swap_colors (gimp_context_get_user ());
gimp_context_swap_colors (gimp_get_user_context (the_gimp));
}
void
@ -61,19 +61,19 @@ tools_swap_contexts_cmd_callback (GtkWidget *widget,
if (! swap_context)
{
swap_context = gimp_context_new (the_gimp,
"Swap Context",
gimp_context_get_user ());
temp_context = gimp_context_new (the_gimp,
"Temp Context",
NULL);
swap_context = gimp_create_context (the_gimp,
"Swap Context",
gimp_get_user_context (the_gimp));
temp_context = gimp_create_context (the_gimp,
"Temp Context",
NULL);
}
gimp_context_copy_args (gimp_context_get_user (),
gimp_context_copy_args (gimp_get_user_context (the_gimp),
temp_context,
GIMP_CONTEXT_ALL_ARGS_MASK);
gimp_context_copy_args (swap_context,
gimp_context_get_user (),
gimp_get_user_context (the_gimp),
GIMP_CONTEXT_ALL_ARGS_MASK);
gimp_context_copy_args (temp_context,
swap_context,
@ -91,10 +91,10 @@ tools_select_cmd_callback (GtkWidget *widget,
tool_type = (GtkType) action;
tool_info = tool_manager_get_info_by_type (tool_type);
tool_info = tool_manager_get_info_by_type (the_gimp, tool_type);
gdisp = gdisplay_active ();
gimp_context_set_tool (gimp_context_get_user (), tool_info);
gimp_context_set_tool (gimp_get_user_context (the_gimp), tool_info);
#ifdef __GNUC__
#warning FIXME (let the tool manager to this stuff)

View File

@ -40,7 +40,7 @@
#include "xcf/xcf.h"
#include "tools/tools.h"
#include "tools/tool_manager.h"
#include "gui/color-notebook.h"
#include "gui/file-open-dialog.h"
@ -51,7 +51,6 @@
#include "app_procs.h"
#include "batch.h"
#include "colormaps.h"
#include "context_manager.h"
#include "gdisplay.h"
#include "gdisplay_ops.h"
#include "gimprc.h"
@ -143,8 +142,7 @@ app_init (gint gimp_argc,
gtk_object_ref (GTK_OBJECT (the_gimp));
gtk_object_sink (GTK_OBJECT (the_gimp));
/* Initialize the context system before loading any data */
context_manager_init ();
tool_manager_init (the_gimp);
/* Initialize the procedural database
* We need to do this first because any of the init
@ -191,7 +189,7 @@ app_init (gint gimp_argc,
if (! no_interface)
{
gui_restore ();
gui_restore (the_gimp);
}
/* Parse the rest of the command line arguments as images to load */
@ -207,7 +205,7 @@ app_init (gint gimp_argc,
if (! no_interface)
{
gui_post_init ();
gui_post_init (the_gimp);
}
}
@ -233,20 +231,19 @@ app_exit_finish (void)
if (! no_interface)
{
gui_shutdown ();
gui_shutdown (the_gimp);
}
module_db_free ();
gdisplays_delete ();
context_manager_free ();
plug_in_kill ();
save_unitrc ();
tools_exit ();
tool_manager_exit (the_gimp);
if (! no_interface)
{
gui_exit ();
gui_exit (the_gimp);
}
xcf_exit ();
@ -276,7 +273,7 @@ gimp_set_busy (void)
/* FIXME: gimp_busy HACK */
gimp_busy = TRUE;
gui_set_busy ();
gui_set_busy (the_gimp);
}
static gboolean
@ -307,7 +304,7 @@ gimp_set_busy_until_idle (void)
void
gimp_unset_busy (void)
{
gui_unset_busy ();
gui_unset_busy (the_gimp);
/* FIXME: gimp_busy HACK */
gimp_busy = FALSE;

View File

@ -27,12 +27,13 @@
static GimpBaseConfig static_base_config =
{
NULL, /* temp_path */
NULL, /* swap_path */
33554432, /* tile_cache_size */
FALSE, /* stingy_memory_usage */
LINEAR_INTERPOLATION, /* interpolation_type */
1, /* num_processors */
.temp_path = NULL,
.swap_path = NULL,
.tile_cache_size = 33554432,
.stingy_memory_use = FALSE,
.interpolation_type = LINEAR_INTERPOLATION,
.num_processors = 1
};

View File

@ -104,9 +104,10 @@ static GimpImageMapToolClass *parent_class = NULL;
/* functions */
void
gimp_color_balance_tool_register (void)
gimp_color_balance_tool_register (Gimp *gimp)
{
tool_manager_register_tool (GIMP_TYPE_COLOR_BALANCE_TOOL,
tool_manager_register_tool (gimp,
GIMP_TYPE_COLOR_BALANCE_TOOL,
FALSE,
"gimp:color_balance_tool",
_("Color Balance"),

View File

@ -79,7 +79,7 @@ struct _ColorBalanceDialog
};
void gimp_color_balance_tool_register (void);
void gimp_color_balance_tool_register (Gimp *gimp);
GtkType gimp_color_balance_tool_get_type (void);

View File

@ -200,9 +200,10 @@ static CRMatrix CR_basis =
/* functions */
void
gimp_curves_tool_register (void)
gimp_curves_tool_register (Gimp *gimp)
{
tool_manager_register_tool (GIMP_TYPE_CURVES_TOOL,
tool_manager_register_tool (gimp,
GIMP_TYPE_CURVES_TOOL,
FALSE,
"gimp:curves_tool",
_("Curves"),

View File

@ -85,7 +85,7 @@ struct _CurvesDialog
};
void gimp_curves_tool_register (void);
void gimp_curves_tool_register (Gimp *gimp);
GtkType gimp_curves_tool_get_type (void);

View File

@ -128,9 +128,10 @@ static gint default_colors[6][3] =
/* functions */
void
gimp_hue_saturation_tool_register (void)
gimp_hue_saturation_tool_register (Gimp *gimp)
{
tool_manager_register_tool (GIMP_TYPE_HUE_SATURATION_TOOL,
tool_manager_register_tool (gimp,
GIMP_TYPE_HUE_SATURATION_TOOL,
FALSE,
"gimp:hue_saturation_tool",
_("Hue-Saturation"),

View File

@ -80,7 +80,7 @@ struct _HueSaturationDialog
};
void gimp_hue_saturation_tool_register (void);
void gimp_hue_saturation_tool_register (Gimp *gimp);
GtkType gimp_hue_saturation_tool_get_type (void);

View File

@ -111,9 +111,10 @@ static GimpImageMapToolClass *parent_class = NULL;
/* functions */
void
gimp_threshold_tool_register (void)
gimp_threshold_tool_register (Gimp *gimp)
{
tool_manager_register_tool (GIMP_TYPE_THRESHOLD_TOOL,
tool_manager_register_tool (gimp,
GIMP_TYPE_THRESHOLD_TOOL,
FALSE,
"gimp:threshold_tool",
_("Threshold"),

View File

@ -67,7 +67,7 @@ struct _ThresholdDialog
};
void gimp_threshold_tool_register (void);
void gimp_threshold_tool_register (Gimp *gimp);
GtkType gimp_threshold_tool_get_type (void);

View File

@ -1,243 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "core/core-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimplist.h"
#include "core/gimpimage.h"
#include "core/gimptoolinfo.h"
#include "tools/gimptool.h"
#include "tools/paint_options.h"
#include "tools/tool_manager.h"
#include "tools/tools.h"
#include "gui/brush-select.h"
#include "appenv.h"
#include "app_procs.h"
#include "context_manager.h"
#include "gdisplay.h"
#include "gimprc.h"
#define PAINT_OPTIONS_MASK GIMP_CONTEXT_OPACITY_MASK | \
GIMP_CONTEXT_PAINT_MODE_MASK
/*
* the global tool context
*/
GimpContext *global_tool_context = NULL;
static void
context_manager_display_changed (GimpContext *context,
GDisplay *display,
gpointer data)
{
gdisplay_set_menu_sensitivity (display);
}
static void
context_manager_tool_changed (GimpContext *user_context,
GimpToolInfo *tool_info,
gpointer data)
{
if (! tool_info)
return;
/* FIXME: gimp_busy HACK */
if (gimp_busy)
{
/* there may be contexts waiting for the user_context's "tool_changed"
* signal, so stop emitting it.
*/
gtk_signal_emit_stop_by_name (GTK_OBJECT (user_context), "tool_changed");
if (GTK_OBJECT (active_tool)->klass->type != tool_info->tool_type)
{
gtk_signal_handler_block_by_func (GTK_OBJECT (user_context),
context_manager_tool_changed,
NULL);
/* explicitly set the current tool */
gimp_context_set_tool (user_context,
tool_manager_get_info_by_tool (active_tool));
gtk_signal_handler_unblock_by_func (GTK_OBJECT (user_context),
context_manager_tool_changed,
NULL);
}
}
else
{
GimpTool *new_tool = NULL;
GimpContext *tool_context = NULL;
if (tool_info->tool_type != GTK_TYPE_NONE)
{
new_tool = gtk_type_new (tool_info->tool_type);
}
else
{
g_warning ("%s(): tool_info contains no valid GtkType",
G_GNUC_FUNCTION);
return;
}
if (! gimprc.global_paint_options)
{
if (active_tool &&
(tool_context = tool_manager_get_info_by_tool (active_tool)->context))
{
gimp_context_unset_parent (tool_context);
}
if ((tool_context = tool_info->context))
{
gimp_context_copy_args (tool_context, user_context,
PAINT_OPTIONS_MASK);
gimp_context_set_parent (tool_context, user_context);
}
}
tool_manager_select_tool (new_tool);
}
}
void
context_manager_init (void)
{
GimpContext *standard_context;
GimpContext *default_context;
GimpContext *user_context;
GimpContext *tool_context;
/* Implicitly create the standard context */
standard_context = gimp_context_get_standard (the_gimp);
/* TODO: load from disk */
default_context = gimp_context_new (the_gimp, "Default", NULL);
gimp_context_set_default (default_context);
/* Initialize the user context with the default context's values */
user_context = gimp_context_new (default_context->gimp,
"User", default_context);
gimp_context_set_user (user_context);
/* Update the tear-off menus */
gtk_signal_connect (GTK_OBJECT (user_context), "display_changed",
GTK_SIGNAL_FUNC (context_manager_display_changed),
NULL);
/* Update the tool system */
gtk_signal_connect (GTK_OBJECT (user_context), "tool_changed",
GTK_SIGNAL_FUNC (context_manager_tool_changed),
NULL);
/* Make the user contect the currently active context */
gimp_context_set_current (user_context);
/* Create a context to store the paint options of the
* global paint options mode
*/
global_tool_context = gimp_context_new (user_context->gimp,
"Global Tool Context", user_context);
/* TODO: add foreground, background, brush, pattern, gradient */
gimp_context_define_args (global_tool_context, PAINT_OPTIONS_MASK, FALSE);
/* register internal tools */
tools_init ();
if (! gimprc.global_paint_options && active_tool &&
(tool_context = tool_manager_get_info_by_tool (active_tool)->context))
{
gimp_context_set_parent (tool_context, user_context);
}
else if (gimprc.global_paint_options)
{
gimp_context_set_parent (global_tool_context, user_context);
}
gimp_container_thaw (the_gimp->tool_info_list);
}
void
context_manager_free (void)
{
gtk_object_unref (GTK_OBJECT (global_tool_context));
global_tool_context = NULL;
gtk_object_unref (GTK_OBJECT (gimp_context_get_user ()));
gimp_context_set_user (NULL);
gimp_context_set_current (NULL);
/* TODO: Save to disk before destroying */
gtk_object_unref (GTK_OBJECT (gimp_context_get_default ()));
gimp_context_set_default (NULL);
}
void
context_manager_set_global_paint_options (gboolean global)
{
GimpToolInfo *tool_info;
GimpContext *context;
if (global == gimprc.global_paint_options)
return;
paint_options_set_global (global);
/* NULL is the main brush selection */
brush_select_show_paint_options (NULL, global);
tool_info = gimp_context_get_tool (gimp_context_get_user ());
if (global)
{
if (tool_info && (context = tool_info->context))
{
gimp_context_unset_parent (context);
}
gimp_context_copy_args (global_tool_context, gimp_context_get_user (),
PAINT_OPTIONS_MASK);
gimp_context_set_parent (global_tool_context, gimp_context_get_user ());
}
else
{
gimp_context_unset_parent (global_tool_context);
if (tool_info && (context = tool_info->context))
{
gimp_context_copy_args (context, gimp_context_get_user (),
GIMP_CONTEXT_PAINT_ARGS_MASK);
gimp_context_set_parent (context, gimp_context_get_user ());
}
}
}

View File

@ -1,35 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __CONTEXT_MANAGER_H__
#define __CONTEXT_MANAGER_H__
/*
* the global tool context
*/
extern GimpContext *global_tool_context;
void context_manager_init (void);
void context_manager_free (void);
void context_manager_set_global_paint_options (gboolean global);
#endif /* __CONTEXT_MANAGER_H__ */

View File

@ -21,6 +21,8 @@ libappcore_a_SOURCES = @STRIP_BEGIN@ \
gimpcontainer.h \
gimpcontext.c \
gimpcontext.h \
gimpcoreconfig.c \
gimpcoreconfig.h \
gimpdata.c \
gimpdata.h \
gimpdatafactory.c \

View File

@ -35,6 +35,7 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
@ -455,7 +456,7 @@ gimp_transform_tool_button_press (GimpTool *tool,
GtkType tool_type;
tool_type =
gimp_context_get_tool (gimp_context_get_user ())->tool_type;
gimp_context_get_tool (gimp_get_user_context (gdisp->gimage->gimp))->tool_type;
gimp_dialog_create_action_area
(GTK_DIALOG (transform_info->shell),

View File

@ -33,6 +33,8 @@
#include "gimpbrushgenerated.h"
#include "gimpbrushpipe.h"
#include "gimpbuffer.h"
#include "gimpcontext.h"
#include "gimpcoreconfig.h"
#include "gimpdatafactory.h"
#include "gimpgradient.h"
#include "gimpimage.h"
@ -46,7 +48,6 @@
#include "app_procs.h"
#include "gimage.h"
#include "gimpparasite.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
@ -100,6 +101,8 @@ gimp_class_init (GimpClass *klass)
static void
gimp_init (Gimp *gimp)
{
GimpContext *context;
static const GimpDataFactoryLoaderEntry brush_loader_entries[] =
{
{ gimp_brush_load, GIMP_BRUSH_FILE_EXTENSION },
@ -135,14 +138,12 @@ gimp_init (Gimp *gimp)
gimp->images = gimp_list_new (GIMP_TYPE_IMAGE,
GIMP_CONTAINER_POLICY_WEAK);
gtk_object_ref (GTK_OBJECT (gimp->images));
gtk_object_sink (GTK_OBJECT (gimp->images));
gimp->global_buffer = NULL;
gimp->named_buffers = gimp_list_new (GIMP_TYPE_BUFFER,
GIMP_CONTAINER_POLICY_STRONG);
gtk_object_ref (GTK_OBJECT (gimp->named_buffers));
gtk_object_sink (GTK_OBJECT (gimp->named_buffers));
@ -150,45 +151,41 @@ gimp_init (Gimp *gimp)
gimp->brush_factory =
gimp_data_factory_new (GIMP_TYPE_BRUSH,
(const gchar **) &gimprc.brush_path,
(const gchar **) &core_config->brush_path,
brush_loader_entries,
n_brush_loader_entries,
gimp_brush_new,
gimp_brush_get_standard);
gtk_object_ref (GTK_OBJECT (gimp->brush_factory));
gtk_object_sink (GTK_OBJECT (gimp->brush_factory));
gimp->pattern_factory =
gimp_data_factory_new (GIMP_TYPE_PATTERN,
(const gchar **) &gimprc.pattern_path,
(const gchar **) &core_config->pattern_path,
pattern_loader_entries,
n_pattern_loader_entries,
gimp_pattern_new,
gimp_pattern_get_standard);
gtk_object_ref (GTK_OBJECT (gimp->pattern_factory));
gtk_object_sink (GTK_OBJECT (gimp->pattern_factory));
gimp->gradient_factory =
gimp_data_factory_new (GIMP_TYPE_GRADIENT,
(const gchar **) &gimprc.gradient_path,
(const gchar **) &core_config->gradient_path,
gradient_loader_entries,
n_gradient_loader_entries,
gimp_gradient_new,
gimp_gradient_get_standard);
gtk_object_ref (GTK_OBJECT (gimp->gradient_factory));
gtk_object_sink (GTK_OBJECT (gimp->gradient_factory));
gimp->palette_factory =
gimp_data_factory_new (GIMP_TYPE_PALETTE,
(const gchar **) &gimprc.palette_path,
(const gchar **) &core_config->palette_path,
palette_loader_entries,
n_palette_loader_entries,
gimp_palette_new,
gimp_palette_get_standard);
gtk_object_ref (GTK_OBJECT (gimp->palette_factory));
gtk_object_sink (GTK_OBJECT (gimp->palette_factory));
@ -196,11 +193,23 @@ gimp_init (Gimp *gimp)
gimp->tool_info_list = gimp_list_new (GIMP_TYPE_TOOL_INFO,
GIMP_CONTAINER_POLICY_STRONG);
gtk_object_ref (GTK_OBJECT (gimp->tool_info_list));
gtk_object_sink (GTK_OBJECT (gimp->tool_info_list));
gimp_image_new_init (gimp);
gimp->standard_context = gimp_create_context (gimp, "Standard", NULL);
gtk_object_ref (GTK_OBJECT (gimp->standard_context));
gtk_object_sink (GTK_OBJECT (gimp->standard_context));
/* TODO: load from disk */
context = gimp_create_context (gimp, "Default", NULL);
gimp_set_default_context (gimp, context);
context = gimp_create_context (gimp, "User", context);
gimp_set_user_context (gimp, context);
gimp_set_current_context (gimp, context);
}
static void
@ -210,6 +219,17 @@ gimp_destroy (GtkObject *object)
gimp = GIMP (object);
gimp_set_current_context (gimp, NULL);
gimp_set_user_context (gimp, NULL);
gimp_set_default_context (gimp, NULL);
if (gimp->standard_context)
{
gtk_object_unref (GTK_OBJECT (gimp->standard_context));
gimp->standard_context = NULL;
}
gimp_image_new_exit (gimp);
if (gimp->tool_info_list)
@ -337,14 +357,14 @@ gimp_create_image (Gimp *gimp,
gimp_container_add (gimp->images, GIMP_OBJECT (gimage));
if (attach_comment && gimprc.default_comment)
if (attach_comment && core_config->default_comment)
{
GimpParasite *parasite;
parasite = gimp_parasite_new ("gimp-comment",
GIMP_PARASITE_PERSISTENT,
strlen (gimprc.default_comment) + 1,
gimprc.default_comment);
strlen (core_config->default_comment) + 1,
core_config->default_comment);
gimp_image_parasite_attach (gimage, parasite);
gimp_parasite_free (parasite);
}
@ -362,3 +382,70 @@ gimp_create_display (Gimp *gimp,
if (gimp->create_display_func)
gimp->create_display_func (gimage);
}
GimpContext *
gimp_create_context (Gimp *gimp,
const gchar *name,
GimpContext *template)
{
GimpContext *context;
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (!template || GIMP_IS_CONTEXT (template), NULL);
/* FIXME: need unique names here */
if (! name)
name = "Unnamed";
context = gimp_context_new (gimp, name, template);
gimp->context_list = g_list_prepend (gimp->context_list, context);
return context;
}
GimpContext *
gimp_get_standard_context (Gimp *gimp)
{
return gimp->standard_context;
}
void
gimp_set_default_context (Gimp *gimp,
GimpContext *context)
{
gimp->default_context = context;
}
GimpContext *
gimp_get_default_context (Gimp *gimp)
{
return gimp->default_context;
}
void
gimp_set_user_context (Gimp *gimp,
GimpContext *context)
{
gimp->user_context = context;
}
GimpContext *
gimp_get_user_context (Gimp *gimp)
{
return gimp->user_context;
}
void
gimp_set_current_context (Gimp *gimp,
GimpContext *context)
{
gimp->current_context = context;
}
GimpContext *
gimp_get_current_context (Gimp *gimp)
{
return gimp->current_context;
}

View File

@ -63,6 +63,21 @@ struct _Gimp
GList *fill_type_names;
GimpImageNewValues image_new_last_values;
gboolean have_current_cut_buffer;
/* the list of all contexts */
GList *context_list;
/* the hardcoded standard context */
GimpContext *standard_context;
/* the default context which is initialized from gimprc */
GimpContext *default_context;
/* the context used by the interface */
GimpContext *user_context;
/* the currently active context */
GimpContext *current_context;
};
struct _GimpClass
@ -71,19 +86,38 @@ struct _GimpClass
};
GtkType gimp_get_type (void);
Gimp * gimp_new (void);
GtkType gimp_get_type (void);
Gimp * gimp_new (void);
void gimp_restore (Gimp *gimp);
void gimp_shutdown (Gimp *gimp);
void gimp_restore (Gimp *gimp);
void gimp_shutdown (Gimp *gimp);
GimpImage * gimp_create_image (Gimp *gimp,
gint width,
gint height,
GimpImageBaseType type,
gboolean attach_comment);
void gimp_create_display (Gimp *gimp,
GimpImage *gimage);
GimpImage * gimp_create_image (Gimp *gimp,
gint width,
gint height,
GimpImageBaseType type,
gboolean attach_comment);
void gimp_create_display (Gimp *gimp,
GimpImage *gimage);
GimpContext * gimp_create_context (Gimp *gimp,
const gchar *name,
GimpContext *template);
GimpContext * gimp_get_standard_context (Gimp *gimp);
void gimp_set_default_context (Gimp *gimp,
GimpContext *context);
GimpContext * gimp_get_default_context (Gimp *gimp);
void gimp_set_user_context (Gimp *gimp,
GimpContext *context);
GimpContext * gimp_get_user_context (Gimp *gimp);
void gimp_set_current_context (Gimp *gimp,
GimpContext *context);
GimpContext * gimp_get_current_context (Gimp *gimp);
#endif /* __GIMP_H__ */

View File

@ -50,7 +50,6 @@
#include "gimpbrush-header.h"
#include "gimpbrushpipe.h"
#include "gimppattern-header.h"
#include "gimprc.h"
/* this needs to go away */
#include "tools/gimppainttool.h"

View File

@ -50,7 +50,6 @@
#include "gimpbrush-header.h"
#include "gimpbrushpipe.h"
#include "gimppattern-header.h"
#include "gimprc.h"
/* this needs to go away */
#include "tools/gimppainttool.h"

View File

@ -35,6 +35,7 @@
#include "gimpbuffer.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpcoreconfig.h"
#include "gimpdatafactory.h"
#include "gimpgradient.h"
#include "gimpimage.h"
@ -44,7 +45,6 @@
#include "gimptoolinfo.h"
#include "gdisplay.h"
#include "gimprc.h"
typedef void (* GimpContextCopyArgFunc) (GimpContext *src,
@ -59,9 +59,6 @@ typedef void (* GimpContextCopyArgFunc) (GimpContext *src,
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
@ -318,21 +315,6 @@ static guint gimp_context_signals[LAST_SIGNAL] = { 0 };
static GimpObjectClass * parent_class = NULL;
/* the currently active context */
static GimpContext *current_context = NULL;
/* the context user by the interface */
static GimpContext *user_context = NULL;
/* the default context which is initialized from gimprc */
static GimpContext *default_context = NULL;
/* the hardcoded standard context */
static GimpContext *standard_context = NULL;
/* the list of all contexts */
static GSList *context_list = NULL;
/*****************************************************************************/
/* private functions *******************************************************/
@ -566,8 +548,6 @@ gimp_context_init (GimpContext *context)
context->palette_name = NULL;
context->buffer = NULL;
context_list = g_slist_prepend (context_list, context);
}
static void
@ -580,7 +560,8 @@ gimp_context_destroy (GtkObject *object)
if (context->parent)
gimp_context_unset_parent (context);
context_list = g_slist_remove (context_list, context);
context->gimp->context_list = g_list_remove (context->gimp->context_list,
context);
context->image = NULL;
context->display = NULL;
@ -797,16 +778,13 @@ gimp_context_new (Gimp *gimp,
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (!template || GIMP_IS_CONTEXT (template), NULL);
context = gtk_type_new (GIMP_TYPE_CONTEXT);
context->gimp = gimp;
/* FIXME: need unique names here */
if (! name)
name = "Unnamed";
gimp_object_set_name (GIMP_OBJECT (context), name);
gtk_signal_connect_while_alive (GTK_OBJECT (gimp->images), "remove",
@ -890,68 +868,9 @@ gimp_context_new (Gimp *gimp,
return context;
}
/*****************************************************************************/
/* 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 (Gimp *gimp)
{
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (! standard_context)
{
standard_context = gimp_context_new (gimp, "Standard", NULL);
gtk_quit_add_destroy (TRUE, GTK_OBJECT (standard_context));
}
return standard_context;
}
/*****************************************************************************/
/* 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));
@ -961,7 +880,6 @@ void
gimp_context_set_name (GimpContext *context,
const gchar *name)
{
context_check_current (context);
context_return_if_fail (context);
if (! name)
@ -973,7 +891,6 @@ gimp_context_set_name (GimpContext *context,
GimpContext *
gimp_context_get_parent (const GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->parent;
@ -985,7 +902,6 @@ gimp_context_set_parent (GimpContext *context,
{
GimpContextArgType arg;
context_check_current (context);
context_return_if_fail (context);
g_return_if_fail (!parent || GIMP_IS_CONTEXT (parent));
@ -1008,7 +924,6 @@ gimp_context_set_parent (GimpContext *context,
void
gimp_context_unset_parent (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
if (context->parent)
@ -1029,7 +944,6 @@ gimp_context_define_arg (GimpContext *context,
{
GimpContextArgMask mask;
context_check_current (context);
context_return_if_fail (context);
g_return_if_fail ((arg >= 0) && (arg < GIMP_CONTEXT_NUM_ARGS));
@ -1067,7 +981,6 @@ 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;
@ -1080,7 +993,6 @@ gimp_context_define_args (GimpContext *context,
{
GimpContextArgType arg;
context_check_current (context);
context_return_if_fail (context);
for (arg = 0; arg < GIMP_CONTEXT_NUM_ARGS; arg++)
@ -1095,9 +1007,7 @@ 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));
@ -1111,9 +1021,7 @@ gimp_context_copy_args (GimpContext *src,
{
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++)
@ -1163,7 +1071,6 @@ gimp_context_get_by_type (GimpContext *context,
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);
@ -1181,7 +1088,6 @@ gimp_context_set_by_type (GimpContext *context,
{
GimpContextArgType arg;
context_check_current (context);
context_return_if_fail (context);
g_return_if_fail ((arg = gimp_context_type_to_arg (type)) != -1);
@ -1197,7 +1103,6 @@ gimp_context_changed_by_type (GimpContext *context,
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);
@ -1214,7 +1119,6 @@ gimp_context_changed_by_type (GimpContext *context,
GimpImage *
gimp_context_get_image (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->image;
@ -1224,7 +1128,6 @@ 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);
@ -1234,7 +1137,6 @@ gimp_context_set_image (GimpContext *context,
void
gimp_context_image_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
@ -1277,7 +1179,6 @@ gimp_context_copy_image (GimpContext *src,
GDisplay *
gimp_context_get_display (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->display;
@ -1287,7 +1188,6 @@ 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);
@ -1297,7 +1197,6 @@ gimp_context_set_display (GimpContext *context,
void
gimp_context_display_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
@ -1358,7 +1257,6 @@ gimp_context_get_tool (GimpContext *context)
{
g_return_val_if_fail (! context || GIMP_IS_CONTEXT (context), NULL);
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->tool_info;
@ -1371,7 +1269,6 @@ gimp_context_set_tool (GimpContext *context,
g_return_if_fail (! context || GIMP_IS_CONTEXT (context));
g_return_if_fail (! tool_info || GIMP_IS_TOOL_INFO (tool_info));
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_TOOL_MASK);
@ -1383,7 +1280,6 @@ gimp_context_tool_changed (GimpContext *context)
{
g_return_if_fail (! context || GIMP_IS_CONTEXT (context));
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
@ -1514,7 +1410,6 @@ void
gimp_context_get_foreground (GimpContext *context,
GimpRGB *color)
{
context_check_current (context);
context_return_if_fail (context);
g_return_if_fail (color != NULL);
@ -1526,7 +1421,6 @@ 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);
@ -1538,7 +1432,6 @@ gimp_context_set_foreground (GimpContext *context,
void
gimp_context_foreground_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
@ -1572,7 +1465,6 @@ void
gimp_context_get_background (GimpContext *context,
GimpRGB *color)
{
context_check_current (context);
context_return_if_fail (context);
g_return_if_fail (color != NULL);
@ -1584,7 +1476,6 @@ 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);
@ -1596,7 +1487,6 @@ gimp_context_set_background (GimpContext *context,
void
gimp_context_background_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
@ -1635,7 +1525,6 @@ gimp_context_set_default_colors (GimpContext *context)
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);
@ -1656,7 +1545,6 @@ gimp_context_swap_colors (GimpContext *context)
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);
@ -1674,7 +1562,6 @@ gimp_context_swap_colors (GimpContext *context)
gdouble
gimp_context_get_opacity (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, 1.0);
return context->opacity;
@ -1684,7 +1571,6 @@ 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);
@ -1694,7 +1580,6 @@ gimp_context_set_opacity (GimpContext *context,
void
gimp_context_opacity_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
@ -1728,7 +1613,6 @@ gimp_context_get_paint_mode (GimpContext *context)
{
g_return_val_if_fail (! context || GIMP_IS_CONTEXT (context), NORMAL_MODE);
context_check_current (context);
context_return_val_if_fail (context, 0);
return context->paint_mode;
@ -1740,7 +1624,6 @@ gimp_context_set_paint_mode (GimpContext *context,
{
g_return_if_fail (! context || GIMP_IS_CONTEXT (context));
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_PAINT_MODE_MASK);
@ -1752,7 +1635,6 @@ gimp_context_paint_mode_changed (GimpContext *context)
{
g_return_if_fail (! context || GIMP_IS_CONTEXT (context));
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
@ -1788,7 +1670,6 @@ gimp_context_get_brush (GimpContext *context)
{
g_return_val_if_fail (! context || GIMP_IS_CONTEXT (context), NULL);
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->brush;
@ -1801,7 +1682,6 @@ gimp_context_set_brush (GimpContext *context,
g_return_if_fail (! context || GIMP_IS_CONTEXT (context));
g_return_if_fail (! brush || GIMP_IS_BRUSH (brush));
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_BRUSH_MASK);
@ -1813,7 +1693,6 @@ gimp_context_brush_changed (GimpContext *context)
{
g_return_if_fail (! context || GIMP_IS_CONTEXT (context));
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
@ -1840,7 +1719,7 @@ gimp_context_brush_list_thaw (GimpContainer *container,
GimpBrush *brush;
if (! context->brush_name)
context->brush_name = g_strdup (gimprc.default_brush);
context->brush_name = g_strdup (core_config->default_brush);
if ((brush = (GimpBrush *)
gimp_container_get_child_by_name (container,
@ -1960,7 +1839,6 @@ static GimpPattern *standard_pattern = NULL;
GimpPattern *
gimp_context_get_pattern (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->pattern;
@ -1970,7 +1848,6 @@ 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);
@ -1980,7 +1857,6 @@ gimp_context_set_pattern (GimpContext *context,
void
gimp_context_pattern_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
@ -2007,7 +1883,7 @@ gimp_context_pattern_list_thaw (GimpContainer *container,
GimpPattern *pattern;
if (! context->pattern_name)
context->pattern_name = g_strdup (gimprc.default_pattern);
context->pattern_name = g_strdup (core_config->default_pattern);
if ((pattern = (GimpPattern *)
gimp_container_get_child_by_name (container,
@ -2125,7 +2001,6 @@ static GimpGradient *standard_gradient = NULL;
GimpGradient *
gimp_context_get_gradient (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->gradient;
@ -2135,7 +2010,6 @@ 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);
@ -2145,7 +2019,6 @@ gimp_context_set_gradient (GimpContext *context,
void
gimp_context_gradient_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
@ -2172,7 +2045,7 @@ gimp_context_gradient_list_thaw (GimpContainer *container,
GimpGradient *gradient;
if (! context->gradient_name)
context->gradient_name = g_strdup (gimprc.default_gradient);
context->gradient_name = g_strdup (core_config->default_gradient);
if ((gradient = (GimpGradient *)
gimp_container_get_child_by_name (container,
@ -2275,7 +2148,6 @@ 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;
@ -2285,7 +2157,6 @@ 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);
@ -2295,7 +2166,6 @@ gimp_context_set_palette (GimpContext *context,
void
gimp_context_palette_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
@ -2322,7 +2192,7 @@ gimp_context_palette_list_thaw (GimpContainer *container,
GimpPalette *palette;
if (! context->palette_name)
context->palette_name = g_strdup (gimprc.default_palette);
context->palette_name = g_strdup (core_config->default_palette);
if ((palette = (GimpPalette *)
gimp_container_get_child_by_name (container,
@ -2426,7 +2296,6 @@ static GimpBuffer *standard_buffer = NULL;
GimpBuffer *
gimp_context_get_buffer (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->buffer;
@ -2436,7 +2305,6 @@ void
gimp_context_set_buffer (GimpContext *context,
GimpBuffer *buffer)
{
context_check_current (context);
context_return_if_fail (context);
context_find_defined (context, GIMP_CONTEXT_BUFFER_MASK);
@ -2446,7 +2314,6 @@ gimp_context_set_buffer (GimpContext *context,
void
gimp_context_buffer_changed (GimpContext *context)
{
context_check_current (context);
context_return_if_fail (context);
gtk_signal_emit (GTK_OBJECT (context),
@ -2476,7 +2343,7 @@ gimp_context_buffer_list_thaw (GimpContainer *container,
GimpBuffer *buffer;
if (! context->buffer_name)
context->buffer_name = g_strdup (gimprc.default_buffer);
context->buffer_name = g_strdup (core_config->default_buffer);
if ((buffer = (GimpBuffer *)
gimp_container_get_child_by_name (container,

View File

@ -26,12 +26,6 @@
#include "gimpobject.h"
#define GIMP_TYPE_CONTEXT (gimp_context_get_type ())
#define GIMP_CONTEXT(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_CONTEXT, GimpContext))
#define GIMP_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, GIMP_TYPE_CONTEXT, GimpContextClass))
#define GIMP_IS_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_CONTEXT))
#define GIMP_IS_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONTEXT))
typedef enum
{
GIMP_CONTEXT_ARG_IMAGE,
@ -80,6 +74,14 @@ typedef enum
GIMP_CONTEXT_PAINT_ARGS_MASK)
} GimpContextArgMask;
#define GIMP_TYPE_CONTEXT (gimp_context_get_type ())
#define GIMP_CONTEXT(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_CONTEXT, GimpContext))
#define GIMP_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, GIMP_TYPE_CONTEXT, GimpContextClass))
#define GIMP_IS_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_CONTEXT))
#define GIMP_IS_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONTEXT))
typedef struct _GimpContextClass GimpContextClass;
struct _GimpContext
@ -151,38 +153,13 @@ struct _GimpContextClass
GimpBuffer *buffer);
};
GtkType gimp_context_get_type (void);
GimpContext * gimp_context_new (Gimp *gimp,
const gchar *name,
GimpContext *template);
/* TODO: - gimp_context_find ()
*
* probably interacting with the context manager:
* - gimp_context_push () which will call gimp_context_set_parent()
* - gimp_context_push_new () to do a GL-style push
* - gimp_context_pop ()
*
* a proper mechanism to prevent silly operations like pushing
* the user context to some client stack etc.
*/
GimpContext * gimp_context_new (Gimp *gimp,
const gchar *name,
GimpContext *template);
/* to be used by the context management system only
*/
void gimp_context_set_current (GimpContext *context);
void gimp_context_set_user (GimpContext *context);
void gimp_context_set_default (GimpContext *context);
/* these are always available
*/
GimpContext * gimp_context_get_current (void);
GimpContext * gimp_context_get_user (void);
GimpContext * gimp_context_get_default (void);
GimpContext * gimp_context_get_standard (Gimp *gimp);
/* functions for manipulating a single context
*/
const gchar * gimp_context_get_name (const GimpContext *context);
void gimp_context_set_name (GimpContext *context,
const gchar *name);

59
app/core/gimpcoreconfig.c Normal file
View File

@ -0,0 +1,59 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "core-types.h"
#include "gimpcoreconfig.h"
static GimpCoreConfig static_core_config =
{
/* plug_in_path */ NULL,
/* module_path */ NULL,
/* brush_path */ NULL,
/* pattern_path */ NULL,
/* palette_path */ NULL,
/* gradient_path */ NULL,
/* default_brush */ NULL,
/* default_pattern */ NULL,
/* default_palette */ NULL,
/* default_gradient */ NULL,
/* default_comment */ NULL,
/* default_type */ RGB,
/* default_width */ 256,
/* default_height */ 256,
/* default_units */ GIMP_UNIT_INCH,
/* default_xresolution */ 72.0,
/* default_yresolution */ 72.0,
/* default_resolution_units */ GIMP_UNIT_INCH,
/* levels_of_undo */ 5,
/* pluginrc_path */ NULL,
/* module_db_load_inhibit */ NULL,
/* thumbnail_mode */ 1
};
GimpCoreConfig *core_config = &static_core_config;

59
app/core/gimpcoreconfig.h Normal file
View File

@ -0,0 +1,59 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_CORE_CONFIG_H__
#define __GIMP_CORE_CONFIG_H__
typedef struct _GimpCoreConfig GimpCoreConfig;
struct _GimpCoreConfig
{
gchar *plug_in_path;
gchar *module_path;
gchar *brush_path;
gchar *pattern_path;
gchar *palette_path;
gchar *gradient_path;
gchar *default_brush;
gchar *default_pattern;
gchar *default_palette;
gchar *default_gradient;
gchar *default_comment;
GimpImageBaseType default_type;
gint default_width;
gint default_height;
GimpUnit default_units;
gdouble default_xresolution;
gdouble default_yresolution;
GimpUnit default_resolution_units;
gint levels_of_undo;
gchar *pluginrc_path;
gchar *module_db_load_inhibit;
gint thumbnail_mode;
};
extern GimpCoreConfig *core_config;
#endif /* __GIMP_CORE_CONFIG_H__ */

View File

@ -35,6 +35,7 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpgradient.h"
@ -108,14 +109,15 @@ struct _BlendOptions
typedef struct
{
gdouble offset;
gdouble sx, sy;
BlendMode blend_mode;
GradientType gradient_type;
GimpRGB fg, bg;
gdouble dist;
gdouble vec[2];
RepeatFunc repeat_func;
GimpGradient *gradient;
gdouble offset;
gdouble sx, sy;
BlendMode blend_mode;
GradientType gradient_type;
GimpRGB fg, bg;
gdouble dist;
gdouble vec[2];
RepeatFunc repeat_func;
} RenderBlendData;
typedef struct
@ -272,9 +274,10 @@ static guint blend_n_targets = (sizeof (blend_target_table) /
void
gimp_blend_tool_register (void)
gimp_blend_tool_register (Gimp *gimp)
{
tool_manager_register_tool (GIMP_TYPE_BLEND_TOOL,
tool_manager_register_tool (gimp,
GIMP_TYPE_BLEND_TOOL,
TRUE,
"gimp:blend_tool",
_("Blend"),
@ -480,9 +483,9 @@ gimp_blend_tool_button_release (GimpTool *tool,
blend (gimage,
gimp_image_active_drawable (gimage),
blend_options->blend_mode,
gimp_context_get_paint_mode (NULL),
gimp_context_get_paint_mode (gimp_get_current_context (gimage->gimp)),
blend_options->gradient_type,
gimp_context_get_opacity (NULL) * 100,
gimp_context_get_opacity (gimp_get_current_context (gimage->gimp)) * 100,
blend_options->offset,
blend_options->repeat,
blend_options->supersample,
@ -875,7 +878,8 @@ blend_options_drop_gradient (GtkWidget *widget,
options = (BlendOptions *) data;
gimp_context_set_gradient (gimp_context_get_user (), GIMP_GRADIENT (viewable));
gimp_context_set_gradient (gimp_get_user_context (the_gimp),
GIMP_GRADIENT (viewable));
gtk_option_menu_set_history (GTK_OPTION_MENU (options->blend_mode_w),
CUSTOM_MODE);
@ -887,7 +891,8 @@ blend_options_drop_tool (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
gimp_context_set_tool (gimp_context_get_user (), GIMP_TOOL_INFO (viewable));
gimp_context_set_tool (gimp_get_user_context (the_gimp),
GIMP_TOOL_INFO (viewable));
}
@ -1474,8 +1479,7 @@ gradient_render_pixel (double x,
if (rbd->blend_mode == CUSTOM_MODE)
{
gimp_gradient_get_color_at (gimp_context_get_gradient (NULL),
factor, color);
gimp_gradient_get_color_at (rbd->gradient, factor, color);
}
else
{
@ -1554,14 +1558,19 @@ gradient_fill_region (GimpImage *gimage,
gpointer *pr;
guchar *data;
GimpRGB color;
GimpContext *context;
context = gimp_get_current_context (gimage->gimp);
rbd.gradient = gimp_context_get_gradient (context);
/* Get foreground and background colors, normalized */
gimp_context_get_foreground (NULL, &rbd.fg);
gimp_context_get_foreground (context, &rbd.fg);
/* rbd.fg.a = 1.0; */ /* Foreground is always opaque */
gimp_context_get_background (NULL, &rbd.bg);
gimp_context_get_background (context, &rbd.bg);
/* rbd.bg.a = 1.0; */ /* opaque, for now */

View File

@ -32,12 +32,14 @@
#include "paint-funcs/paint-funcs.h"
#include "drawable.h"
#include "gimp.h"
#include "gimpcontext.h"
#include "gimpdrawable.h"
#include "gimpdrawable-offset.h"
#include "gimpimage.h"
#include "drawable.h"
void
gimp_drawable_offset (GimpDrawable *drawable,
@ -224,9 +226,12 @@ gimp_drawable_offset (GimpDrawable *drawable,
{
if (fill_type == OFFSET_BACKGROUND)
{
GimpRGB color;
Gimp *gimp;
GimpRGB color;
gimp_context_get_background (NULL, &color);
gimp = gimp_drawable_gimage (drawable)->gimp;
gimp_context_get_background (gimp_get_current_context (gimp), &color);
gimp_rgb_get_uchar (&color, &fill[0], &fill[1], &fill[2]);

View File

@ -35,6 +35,7 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
@ -455,7 +456,7 @@ gimp_transform_tool_button_press (GimpTool *tool,
GtkType tool_type;
tool_type =
gimp_context_get_tool (gimp_context_get_user ())->tool_type;
gimp_context_get_tool (gimp_get_user_context (gdisp->gimage->gimp))->tool_type;
gimp_dialog_create_action_area
(GTK_DIALOG (transform_info->shell),

View File

@ -36,7 +36,6 @@
#include "gimpgradient.h"
#include "errors.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"

View File

@ -34,6 +34,7 @@
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "gimp.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpimage.h"

View File

@ -40,6 +40,7 @@
#include "gimp.h"
#include "gimpcontext.h"
#include "gimpcoreconfig.h"
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-mask.h"
@ -55,7 +56,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "parasitelist.h"
#include "path.h"
#include "undo.h"
@ -394,9 +394,9 @@ gimp_image_init (GimpImage *gimage)
gimage->width = 0;
gimage->height = 0;
gimage->xresolution = gimprc.default_xresolution;
gimage->yresolution = gimprc.default_yresolution;
gimage->unit = gimprc.default_units;
gimage->xresolution = core_config->default_xresolution;
gimage->yresolution = core_config->default_yresolution;
gimage->unit = core_config->default_units;
gimage->base_type = RGB;
gimage->cmap = NULL;
@ -1294,7 +1294,7 @@ gimp_image_get_foreground (const GimpImage *gimage,
GimpRGB color;
guchar pfg[3];
gimp_context_get_foreground (NULL, &color);
gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]);
@ -1310,7 +1310,7 @@ gimp_image_get_background (const GimpImage *gimage,
guchar pbg[3];
/* Get the palette color */
gimp_context_get_background (NULL, &color);
gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]);

View File

@ -41,7 +41,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "undo.h"
#include "pdb/procedural_db.h"
@ -639,7 +638,7 @@ gimage_mask_stroke (GimpImage *gimage,
/* Stroke with the correct tool */
return_vals =
procedural_db_run_proc (gimage->gimp,
tool_manager_active_get_PDB_string (),
tool_manager_active_get_PDB_string (gimage->gimp),
&nreturn_vals,
GIMP_PDB_DRAWABLE, gimp_drawable_get_ID (drawable),
GIMP_PDB_INT32, (gint32) cpnt,

View File

@ -40,6 +40,7 @@
#include "gimp.h"
#include "gimpcontext.h"
#include "gimpcoreconfig.h"
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-mask.h"
@ -55,7 +56,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "parasitelist.h"
#include "path.h"
#include "undo.h"
@ -394,9 +394,9 @@ gimp_image_init (GimpImage *gimage)
gimage->width = 0;
gimage->height = 0;
gimage->xresolution = gimprc.default_xresolution;
gimage->yresolution = gimprc.default_yresolution;
gimage->unit = gimprc.default_units;
gimage->xresolution = core_config->default_xresolution;
gimage->yresolution = core_config->default_yresolution;
gimage->unit = core_config->default_units;
gimage->base_type = RGB;
gimage->cmap = NULL;
@ -1294,7 +1294,7 @@ gimp_image_get_foreground (const GimpImage *gimage,
GimpRGB color;
guchar pfg[3];
gimp_context_get_foreground (NULL, &color);
gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]);
@ -1310,7 +1310,7 @@ gimp_image_get_background (const GimpImage *gimage,
guchar pbg[3];
/* Get the palette color */
gimp_context_get_background (NULL, &color);
gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]);

View File

@ -29,13 +29,13 @@
#include "paint-funcs/paint-funcs.h"
#include "gimp.h"
#include "gimpcoreconfig.h"
#include "gimpdrawable.h"
#include "gimpimage.h"
#include "gimpimage-new.h"
#include "gimplayer.h"
#include "drawable.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
@ -90,13 +90,13 @@ gimp_image_new_init (Gimp *gimp)
/* Set the last values used to default values. */
gimp->image_new_last_values.width = gimprc.default_width;
gimp->image_new_last_values.height = gimprc.default_height;
gimp->image_new_last_values.unit = gimprc.default_units;
gimp->image_new_last_values.xresolution = gimprc.default_xresolution;
gimp->image_new_last_values.yresolution = gimprc.default_yresolution;
gimp->image_new_last_values.res_unit = gimprc.default_resolution_units;
gimp->image_new_last_values.type = gimprc.default_type;
gimp->image_new_last_values.width = core_config->default_width;
gimp->image_new_last_values.height = core_config->default_height;
gimp->image_new_last_values.unit = core_config->default_units;
gimp->image_new_last_values.xresolution = core_config->default_xresolution;
gimp->image_new_last_values.yresolution = core_config->default_yresolution;
gimp->image_new_last_values.res_unit = core_config->default_resolution_units;
gimp->image_new_last_values.type = core_config->default_type;
gimp->image_new_last_values.fill_type = BACKGROUND_FILL;
gimp->have_current_cut_buffer = FALSE;
@ -271,7 +271,9 @@ gimp_image_new_create_image (Gimp *gimp,
gimp_image_add_layer (gimage, layer, 0);
gimp_image_undo_enable (gimage);
drawable_fill (GIMP_DRAWABLE (layer), values->fill_type);
drawable_fill (GIMP_DRAWABLE (layer),
gimp_get_current_context (gimp),
values->fill_type);
gimp_image_clean_all (gimage);

View File

@ -151,9 +151,10 @@ static GimpDrawToolClass *parent_class = NULL;
void
gimp_color_picker_tool_register (void)
gimp_color_picker_tool_register (Gimp *gimp)
{
tool_manager_register_tool (GIMP_TYPE_COLOR_PICKER_TOOL,
tool_manager_register_tool (gimp,
GIMP_TYPE_COLOR_PICKER_TOOL,
FALSE,
"gimp:color_picker_tool",
_("Color Picker"),

View File

@ -40,6 +40,7 @@
#include "gimp.h"
#include "gimpcontext.h"
#include "gimpcoreconfig.h"
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-mask.h"
@ -55,7 +56,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "parasitelist.h"
#include "path.h"
#include "undo.h"
@ -394,9 +394,9 @@ gimp_image_init (GimpImage *gimage)
gimage->width = 0;
gimage->height = 0;
gimage->xresolution = gimprc.default_xresolution;
gimage->yresolution = gimprc.default_yresolution;
gimage->unit = gimprc.default_units;
gimage->xresolution = core_config->default_xresolution;
gimage->yresolution = core_config->default_yresolution;
gimage->unit = core_config->default_units;
gimage->base_type = RGB;
gimage->cmap = NULL;
@ -1294,7 +1294,7 @@ gimp_image_get_foreground (const GimpImage *gimage,
GimpRGB color;
guchar pfg[3];
gimp_context_get_foreground (NULL, &color);
gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]);
@ -1310,7 +1310,7 @@ gimp_image_get_background (const GimpImage *gimage,
guchar pbg[3];
/* Get the palette color */
gimp_context_get_background (NULL, &color);
gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]);

View File

@ -29,6 +29,7 @@
#include "core/core-types.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
@ -36,6 +37,7 @@
#include "widgets/gimpcolorpanel.h"
#include "app_procs.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
@ -238,7 +240,10 @@ qmask_activate (GtkWidget *widget,
"Qmask",
&color);
gimp_image_add_channel (gimg, gmask, 0);
drawable_fill (GIMP_DRAWABLE (gmask), TRANSPARENT_FILL);
drawable_fill (GIMP_DRAWABLE (gmask),
gimp_get_user_context (gimg->gimp),
TRANSPARENT_FILL);
}
else
{

View File

@ -29,6 +29,7 @@
#include "core/core-types.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
@ -36,6 +37,7 @@
#include "widgets/gimpcolorpanel.h"
#include "app_procs.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
@ -238,7 +240,10 @@ qmask_activate (GtkWidget *widget,
"Qmask",
&color);
gimp_image_add_channel (gimg, gmask, 0);
drawable_fill (GIMP_DRAWABLE (gmask), TRANSPARENT_FILL);
drawable_fill (GIMP_DRAWABLE (gmask),
gimp_get_user_context (gimg->gimp),
TRANSPARENT_FILL);
}
else
{

View File

@ -40,6 +40,7 @@
#include "gimp.h"
#include "gimpcontext.h"
#include "gimpcoreconfig.h"
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-mask.h"
@ -55,7 +56,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "parasitelist.h"
#include "path.h"
#include "undo.h"
@ -394,9 +394,9 @@ gimp_image_init (GimpImage *gimage)
gimage->width = 0;
gimage->height = 0;
gimage->xresolution = gimprc.default_xresolution;
gimage->yresolution = gimprc.default_yresolution;
gimage->unit = gimprc.default_units;
gimage->xresolution = core_config->default_xresolution;
gimage->yresolution = core_config->default_yresolution;
gimage->unit = core_config->default_units;
gimage->base_type = RGB;
gimage->cmap = NULL;
@ -1294,7 +1294,7 @@ gimp_image_get_foreground (const GimpImage *gimage,
GimpRGB color;
guchar pfg[3];
gimp_context_get_foreground (NULL, &color);
gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]);
@ -1310,7 +1310,7 @@ gimp_image_get_background (const GimpImage *gimage,
guchar pbg[3];
/* Get the palette color */
gimp_context_get_background (NULL, &color);
gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]);

View File

@ -40,6 +40,7 @@
#include "gimp.h"
#include "gimpcontext.h"
#include "gimpcoreconfig.h"
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-mask.h"
@ -55,7 +56,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "parasitelist.h"
#include "path.h"
#include "undo.h"
@ -394,9 +394,9 @@ gimp_image_init (GimpImage *gimage)
gimage->width = 0;
gimage->height = 0;
gimage->xresolution = gimprc.default_xresolution;
gimage->yresolution = gimprc.default_yresolution;
gimage->unit = gimprc.default_units;
gimage->xresolution = core_config->default_xresolution;
gimage->yresolution = core_config->default_yresolution;
gimage->unit = core_config->default_units;
gimage->base_type = RGB;
gimage->cmap = NULL;
@ -1294,7 +1294,7 @@ gimp_image_get_foreground (const GimpImage *gimage,
GimpRGB color;
guchar pfg[3];
gimp_context_get_foreground (NULL, &color);
gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]);
@ -1310,7 +1310,7 @@ gimp_image_get_background (const GimpImage *gimage,
guchar pbg[3];
/* Get the palette color */
gimp_context_get_background (NULL, &color);
gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]);

View File

@ -36,6 +36,7 @@
#include "core/gimpchannel.h"
#include "core/gimpcontainer.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
@ -54,7 +55,6 @@
#include "gdisplay.h"
#include "gdisplay_ops.h"
#include "gimpparasite.h"
#include "gimprc.h"
#include "parasitelist.h"
#include "path_transform.h"
#include "undo.h"
@ -314,13 +314,13 @@ static gboolean
undo_free_up_space (GimpImage *gimage)
{
/* If there are 0 levels of undo return FALSE. */
if (gimprc.levels_of_undo == 0)
if (core_config->levels_of_undo == 0)
return FALSE;
/* Delete the item on the bottom of the stack if we have the maximum
* levels of undo already
*/
while (gimage->undo_levels >= gimprc.levels_of_undo)
while (gimage->undo_levels >= core_config->levels_of_undo)
gimage->undo_stack = remove_stack_bottom (gimage);
return TRUE;

View File

@ -40,6 +40,7 @@
#include "gimp.h"
#include "gimpcontext.h"
#include "gimpcoreconfig.h"
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-mask.h"
@ -55,7 +56,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "parasitelist.h"
#include "path.h"
#include "undo.h"
@ -394,9 +394,9 @@ gimp_image_init (GimpImage *gimage)
gimage->width = 0;
gimage->height = 0;
gimage->xresolution = gimprc.default_xresolution;
gimage->yresolution = gimprc.default_yresolution;
gimage->unit = gimprc.default_units;
gimage->xresolution = core_config->default_xresolution;
gimage->yresolution = core_config->default_yresolution;
gimage->unit = core_config->default_units;
gimage->base_type = RGB;
gimage->cmap = NULL;
@ -1294,7 +1294,7 @@ gimp_image_get_foreground (const GimpImage *gimage,
GimpRGB color;
guchar pfg[3];
gimp_context_get_foreground (NULL, &color);
gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]);
@ -1310,7 +1310,7 @@ gimp_image_get_background (const GimpImage *gimage,
guchar pbg[3];
/* Get the palette color */
gimp_context_get_background (NULL, &color);
gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]);

View File

@ -35,8 +35,6 @@
#include "gimppalette.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"

View File

@ -35,8 +35,6 @@
#include "gimppalette.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"

View File

@ -35,8 +35,6 @@
#include "gimppalette.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"

View File

@ -40,6 +40,7 @@
#include "gimp.h"
#include "gimpcontext.h"
#include "gimpcoreconfig.h"
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-mask.h"
@ -55,7 +56,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "parasitelist.h"
#include "path.h"
#include "undo.h"
@ -394,9 +394,9 @@ gimp_image_init (GimpImage *gimage)
gimage->width = 0;
gimage->height = 0;
gimage->xresolution = gimprc.default_xresolution;
gimage->yresolution = gimprc.default_yresolution;
gimage->unit = gimprc.default_units;
gimage->xresolution = core_config->default_xresolution;
gimage->yresolution = core_config->default_yresolution;
gimage->unit = core_config->default_units;
gimage->base_type = RGB;
gimage->cmap = NULL;
@ -1294,7 +1294,7 @@ gimp_image_get_foreground (const GimpImage *gimage,
GimpRGB color;
guchar pfg[3];
gimp_context_get_foreground (NULL, &color);
gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]);
@ -1310,7 +1310,7 @@ gimp_image_get_background (const GimpImage *gimage,
guchar pbg[3];
/* Get the palette color */
gimp_context_get_background (NULL, &color);
gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color);
gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]);

View File

@ -31,6 +31,7 @@
#include "base/temp-buf.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
@ -51,6 +52,7 @@
#include "gui/menus.h"
#include "nav_window.h"
#include "app_procs.h"
#include "appenv.h"
#include "colormaps.h"
#include "gimprc.h"
@ -785,8 +787,12 @@ gdisplay_flush_whenever (GDisplay *gdisp,
qmask_buttons_update (gdisp);
/* ensure the consistency of the tear-off menus */
if (!now && gimp_context_get_display (gimp_context_get_user ()) == gdisp)
gdisplay_set_menu_sensitivity (gdisp);
if (! now &&
gimp_context_get_display (gimp_get_user_context
(gdisp->gimage->gimp)) == gdisp)
{
gdisplay_set_menu_sensitivity (gdisp);
}
}
void
@ -2229,7 +2235,7 @@ gdisplay_active (void)
gdk_event_free (event);
}
return gimp_context_get_display (gimp_context_get_user ());
return gimp_context_get_display (gimp_get_user_context (the_gimp));
}
GDisplay *

View File

@ -24,11 +24,10 @@
#include "base/temp-buf.h"
#include "gimp.h"
#include "gimpcontext.h"
#include "gimptoolinfo.h"
#include "context_manager.h"
/* GRMPF */
#include "tools/tools-types.h"
#include "tools/gimprectselecttool.h"
@ -201,7 +200,8 @@ gimp_tool_info_get_new_preview (GimpViewable *viewable,
}
GimpToolInfo *
gimp_tool_info_new (GtkType tool_type,
gimp_tool_info_new (GimpContext *context,
GtkType tool_type,
gboolean tool_context,
const gchar *identifier,
const gchar *blurb,
@ -233,9 +233,9 @@ gimp_tool_info_new (GtkType tool_type,
if (tool_context)
{
tool_info->context = gimp_context_new (global_tool_context->gimp,
identifier,
global_tool_context);
tool_info->context = gimp_create_context (context->gimp,
identifier,
context);
}
return tool_info;
@ -249,7 +249,8 @@ gimp_tool_info_get_standard (void)
if (! standard_tool_info)
{
standard_tool_info =
gimp_tool_info_new (GIMP_TYPE_RECT_SELECT_TOOL,
gimp_tool_info_new (NULL,
GIMP_TYPE_RECT_SELECT_TOOL,
FALSE,
"gimp:standard_tool",
"Standard Tool",

View File

@ -67,7 +67,8 @@ struct _GimpToolInfoClass
GtkType gimp_tool_info_get_type (void);
GimpToolInfo * gimp_tool_info_new (GtkType tool_type,
GimpToolInfo * gimp_tool_info_new (GimpContext *context,
GtkType tool_type,
gboolean tool_context,
const gchar *identifier,
const gchar *blurb,

View File

@ -27,8 +27,6 @@
#include "gimpimage.h"
#include "gimpundo.h"
#include "gimprc.h"
enum
{
@ -200,9 +198,11 @@ static void
gimp_undo_real_push (GimpUndo *undo,
GimpImage *gimage)
{
/* FIXME: need core_config->undo_preview_size */
undo->preview = gimp_viewable_get_preview (GIMP_VIEWABLE (gimage),
gimprc.preview_size,
gimprc.preview_size);
24,
24);
}
static void

View File

@ -301,12 +301,13 @@ devices_init (void)
device_info->num_axes = gdk_info->num_axes;
device_info->axes = NULL;
device_info->context = gimp_context_new (the_gimp,
device_info->name, NULL);
device_info->context = gimp_create_context (the_gimp,
device_info->name, NULL);
gimp_context_define_args (device_info->context,
DEVICE_CONTEXT_MASK,
FALSE);
gimp_context_copy_args (gimp_context_get_user (), device_info->context,
gimp_context_copy_args (gimp_get_user_context (the_gimp),
device_info->context,
DEVICE_CONTEXT_MASK);
device_status_context_connect (device_info->context, device_info->device);
@ -331,7 +332,7 @@ devices_restore (void)
suppress_update = TRUE;
context = gimp_context_get_user ();
context = gimp_get_user_context (the_gimp);
gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK);
gimp_context_set_parent (device_info->context, context);
@ -389,12 +390,13 @@ devices_rc_update (gchar *name,
else
device_info->mode = GDK_MODE_DISABLED;
device_info->context = gimp_context_new (the_gimp,
device_info->name, NULL);
device_info->context = gimp_create_context (the_gimp,
device_info->name, NULL);
gimp_context_define_args (device_info->context,
DEVICE_CONTEXT_MASK,
FALSE);
gimp_context_copy_args (gimp_context_get_user (), device_info->context,
gimp_context_copy_args (gimp_get_user_context (the_gimp),
device_info->context,
DEVICE_CONTEXT_MASK);
device_status_context_connect (device_info->context, device_info->device);
@ -534,7 +536,7 @@ select_device (guint32 new_device)
current_device = new_device;
context = gimp_context_get_user ();
context = gimp_get_user_context (the_gimp);
gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK);
gimp_context_set_parent (device_info->context, context);

View File

@ -567,7 +567,8 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
gimage = gimp_context_get_image (context);
view = gimp_drawable_list_view_new
(gimage,
(gimprc.preview_size,
gimage,
GIMP_TYPE_LAYER,
"active_layer_changed",
(GimpGetContainerFunc) gimp_image_get_layers,
@ -602,7 +603,8 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
gimage = gimp_context_get_image (context);
view = gimp_drawable_list_view_new
(gimage,
(gimprc.preview_size,
gimage,
GIMP_TYPE_CHANNEL,
"active_channel_changed",
(GimpGetContainerFunc) gimp_image_get_channels,

View File

@ -20,9 +20,9 @@
#include <gtk/gtk.h>
#include "apptypes.h"
#include "widgets/widgets-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "widgets/gimpdialogfactory.h"
@ -88,25 +88,21 @@ static const gint n_dock_entries = (sizeof (dock_entries) /
/* public functions */
void
dialogs_init (void)
dialogs_init (Gimp *gimp)
{
gint i;
global_dialog_factory =
gimp_dialog_factory_new ("toplevel",
gimp_context_get_user (),
NULL,
NULL);
global_dialog_factory = gimp_dialog_factory_new ("toplevel",
gimp_get_user_context (gimp),
NULL,
NULL);
gtk_object_ref (GTK_OBJECT (global_dialog_factory));
gtk_object_sink (GTK_OBJECT (global_dialog_factory));
global_dock_factory =
gimp_dialog_factory_new ("dock",
gimp_context_get_user (),
menus_get_dialogs_factory (),
dialogs_dock_new);
global_dock_factory = gimp_dialog_factory_new ("dock",
gimp_get_user_context (gimp),
menus_get_dialogs_factory (),
dialogs_dock_new);
gtk_object_ref (GTK_OBJECT (global_dock_factory));
gtk_object_sink (GTK_OBJECT (global_dock_factory));
@ -128,7 +124,7 @@ dialogs_init (void)
}
void
dialogs_exit (void)
dialogs_exit (Gimp *gimp)
{
gtk_object_unref (GTK_OBJECT (global_dialog_factory));
gtk_object_unref (GTK_OBJECT (global_dock_factory));

View File

@ -24,8 +24,8 @@ extern GimpDialogFactory *global_dialog_factory;
extern GimpDialogFactory *global_dock_factory;
void dialogs_init (void);
void dialogs_exit (void);
void dialogs_init (Gimp *gimp);
void dialogs_exit (Gimp *gimp);
#endif /* __DIALOGS_H__ */

View File

@ -44,6 +44,7 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpimage.h"
#include "file-dialog-utils.h"
@ -54,7 +55,6 @@
#include "dialog_handler.h"
#include "docindex.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "file-open.h"
#include "file-utils.h"
#include "plug_in.h"
@ -245,7 +245,8 @@ file_open_with_proc_and_display (gchar *filename,
gchar *absolute;
gint status;
if ((gimage = file_open_image (filename,
if ((gimage = file_open_image (the_gimp,
filename,
raw_filename,
_("Open"),
file_proc,
@ -605,7 +606,7 @@ set_preview (const gchar *fullfname,
}
else
{
switch (gimprc.thumbnail_mode)
switch (core_config->thumbnail_mode)
{
case 0:
gtk_label_set_text (GTK_LABEL(open_options_label),
@ -717,7 +718,8 @@ file_open_genbutton_callback (GtkWidget *widget,
{ /* Is not directory. */
gint dummy;
gimage_to_be_thumbed = file_open_image (full_filename,
gimage_to_be_thumbed = file_open_image (the_gimp,
full_filename,
list->data,
NULL,
NULL,
@ -730,7 +732,7 @@ file_open_genbutton_callback (GtkWidget *widget,
RGBbuf = make_RGBbuf_from_tempbuf (tempbuf,
&RGBbuf_w,
&RGBbuf_h);
if (gimprc.thumbnail_mode)
if (core_config->thumbnail_mode)
{
file_save_thumbnail (gimage_to_be_thumbed,
full_filename, tempbuf);
@ -934,7 +936,8 @@ file_revert_confirm_callback (GtkWidget *widget,
filename = gimp_object_get_name (GIMP_OBJECT (old_gimage));
new_gimage = file_open_image (filename, filename,
new_gimage = file_open_image (old_gimage->gimp,
filename, filename,
_("Revert"),
NULL,
RUN_INTERACTIVE,

View File

@ -26,6 +26,7 @@
#include "core/core-types.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpimage-new.h"
#include "file-new-dialog.h"
@ -120,29 +121,30 @@ file_new_reset_callback (GtkWidget *widget,
gimp_chain_button_set_active
(GIMP_CHAIN_BUTTON (info->couple_resolutions),
ABS (gimprc.default_xresolution - gimprc.default_yresolution) < GIMP_MIN_RESOLUTION);
ABS (core_config->default_xresolution -
core_config->default_yresolution) < GIMP_MIN_RESOLUTION);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se),
0, gimprc.default_xresolution);
0, core_config->default_xresolution);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se),
1, gimprc.default_yresolution);
1, core_config->default_yresolution);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->resolution_se),
gimprc.default_resolution_units);
core_config->default_resolution_units);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (info->resolution_se), info);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se),
0, gimprc.default_xresolution, TRUE);
0, core_config->default_xresolution, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se),
1, gimprc.default_yresolution, TRUE);
1, core_config->default_yresolution, TRUE);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se),
0, gimprc.default_width);
0, core_config->default_width);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se),
1, gimprc.default_height);
1, core_config->default_height);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->size_se),
gimprc.default_units);
core_config->default_units);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->type_w[gimprc.default_type]),
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->type_w[core_config->default_type]),
TRUE);
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (info->fill_type_w[BACKGROUND_FILL]), TRUE);
@ -534,7 +536,8 @@ file_new_dialog_create (GimpImage *gimage)
gtk_widget_set_usize (spinbutton, 75, 0);
info->resolution_se =
gimp_size_entry_new (1, gimprc.default_resolution_units, _("pixels/%a"),
gimp_size_entry_new (1, core_config->default_resolution_units,
_("pixels/%a"),
FALSE, FALSE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gtk_table_set_col_spacing (GTK_TABLE (info->resolution_se), 1, 2);
@ -591,8 +594,10 @@ file_new_dialog_create (GimpImage *gimage)
gtk_widget_show (radio_box);
group = NULL;
list = g_list_first (gimp_image_new_get_base_type_names (the_gimp));
while (list)
for (list = gimp_image_new_get_base_type_names (the_gimp);
list;
list = g_list_next (list))
{
GimpImageBaseTypeName *name_info;
@ -613,8 +618,6 @@ file_new_dialog_create (GimpImage *gimage)
gtk_widget_show (button);
info->type_w[name_info->type] = button;
list = g_list_next (list);
}
/* frame for Fill Type */
@ -628,8 +631,10 @@ file_new_dialog_create (GimpImage *gimage)
gtk_widget_show (radio_box);
group = NULL;
list = g_list_first (gimp_image_new_get_fill_type_names (the_gimp));
while (list)
for (list = gimp_image_new_get_fill_type_names (the_gimp);
list;
list = g_list_next (list))
{
GimpFillTypeName *name_info;
@ -651,8 +656,6 @@ file_new_dialog_create (GimpImage *gimage)
gtk_widget_show (button);
info->fill_type_w[name_info->type] = button;
list = g_list_next (list);
}
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (info->size_se));

View File

@ -39,11 +39,12 @@
#include "tools/gimpcolorpickertool.h" /* need icon of color picker tool */
#include "tools/tool_manager.h"
#include "gdisplay.h"
#include "info-dialog.h"
#include "info-window.h"
#include "app_procs.h"
#include "colormaps.h"
#include "gdisplay.h"
#include "libgimp/gimpintl.h"
@ -182,7 +183,7 @@ info_window_create_extended (InfoDialog *info_win)
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_widget_show (table);
preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (GIMP_TYPE_MOVE_TOOL)), 22, 0, FALSE);
preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (the_gimp, GIMP_TYPE_MOVE_TOOL)), 22, 0, FALSE);
gtk_table_attach (GTK_TABLE (table), preview, 0, 2, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2);
gtk_widget_show (preview);
@ -242,7 +243,7 @@ info_window_create_extended (InfoDialog *info_win)
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_widget_show (table);
preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (GIMP_TYPE_COLOR_PICKER_TOOL)), 22, 0, FALSE);
preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (the_gimp, GIMP_TYPE_COLOR_PICKER_TOOL)), 22, 0, FALSE);
gtk_table_attach (GTK_TABLE (table), preview, 0, 2, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2);
gtk_widget_show (preview);
@ -420,7 +421,7 @@ info_window_follow_auto (void)
GimpContext *context;
GDisplay *gdisp;
context = gimp_context_get_user ();
context = gimp_get_user_context (the_gimp);
gdisp = gimp_context_get_display (context);

View File

@ -38,12 +38,13 @@
#include "core/core-types.h"
#include "core/gimpcoreconfig.h"
#include "core/gimplist.h"
#include "appenv.h"
#include "module_db.h"
#include "gimprc.h"
#include "datafiles.h"
#include "gimprc.h"
#include "libgimp/gimpmodule.h"
@ -217,7 +218,7 @@ module_db_init (void)
modules = gimp_list_new (MODULE_INFO_TYPE, GIMP_CONTAINER_POLICY_WEAK);
if (g_module_supported ())
gimp_datafiles_read_directories (gimprc.module_path, 0 /* no flags */,
gimp_datafiles_read_directories (core_config->module_path, 0 /* no flags */,
module_initialize, NULL);
#ifdef DUMP_DB
gimp_container_foreach (modules, print_module_info, NULL);
@ -615,7 +616,7 @@ module_initialize (const gchar *filename,
mod->refs = 0;
mod->load_inhibit = module_inhibited (mod->fullpath,
gimprc.module_db_load_inhibit);
core_config->module_db_load_inhibit);
if (!mod->load_inhibit)
{
if (be_verbose)
@ -1137,7 +1138,7 @@ browser_refresh_callback (GtkWidget *widget,
kill_list = NULL;
/* walk filesystem and add new things we find */
gimp_datafiles_read_directories (gimprc.module_path, 0 /* no flags */,
gimp_datafiles_read_directories (core_config->module_path, 0 /* no flags */,
module_initialize, NULL);
}

View File

@ -405,7 +405,7 @@ palette_import_grad_callback (GtkWidget *widget,
{
GimpGradient *gradient;
gradient = gimp_context_get_gradient (gimp_context_get_user ());
gradient = gimp_context_get_gradient (gimp_get_user_context (the_gimp));
import_dialog->import_type = GRAD_IMPORT;
if (import_dialog->image_list)
@ -571,7 +571,7 @@ palette_import_import_callback (GtkWidget *widget,
else
palette_name = g_strdup (palette_name);
gradient = gimp_context_get_gradient (gimp_context_get_user ());
gradient = gimp_context_get_gradient (gimp_get_user_context (the_gimp));
n_colors = (gint) import_dialog->sample->value;
threshold = (gint) import_dialog->threshold->value;
@ -677,7 +677,7 @@ palette_import_dialog_new (void)
{
GimpGradient* gradient;
gradient = gimp_context_get_gradient (gimp_context_get_current ());
gradient = gimp_context_get_gradient (gimp_get_user_context (the_gimp));
gtk_entry_set_text (GTK_ENTRY (entry),
gradient ? GIMP_OBJECT (gradient)->name : _("new_import"));
}
@ -783,9 +783,10 @@ palette_import_dialog_new (void)
/* Fill with the selected gradient */
palette_import_fill_grad_preview
(image, gimp_context_get_gradient (gimp_context_get_user ()));
(image, gimp_context_get_gradient (gimp_get_user_context (the_gimp)));
import_dialog->import_type = GRAD_IMPORT;
gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()), "gradient_changed",
gtk_signal_connect (GTK_OBJECT (gimp_get_user_context (the_gimp)),
"gradient_changed",
GTK_SIGNAL_FUNC (palette_import_gradient_update),
NULL);

View File

@ -26,23 +26,25 @@
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "core/core-types.h"
#include "tools/tools-types.h"
#include "base/base-config.h"
#include "base/tile-cache.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpimage.h"
#include "gdisplay.h"
#include "tools/tool_manager.h"
#include "layer-select.h"
#include "resolution-calibrate-dialog.h"
#include "session.h"
#include "app_procs.h"
#include "colormaps.h"
#include "context_manager.h"
#include "gdisplay.h"
#include "gdisplay_ops.h"
#include "gimphelp.h"
#include "gimprc.h"
@ -173,12 +175,12 @@ static gboolean edit_info_window_follows_mouse;
static gboolean edit_disable_tearoff_menus;
static gchar * edit_temp_path = NULL;
static gchar * edit_swap_path = NULL;
static gchar * edit_plug_in_path = NULL;
static gchar * edit_module_path = NULL;
static gchar * edit_brush_path = NULL;
static gchar * edit_pattern_path = NULL;
static gchar * edit_palette_path = NULL;
static gchar * edit_gradient_path = NULL;
static gchar * edit_plug_in_path = NULL;
static gchar * edit_module_path = NULL;
/* variables which will be changed _after_ closing the dialog */
static guint edit_tile_cache_size;
@ -269,10 +271,10 @@ static PrefsState
prefs_check_settings (void)
{
/* First, check for invalid values... */
if (gimprc.levels_of_undo < 0)
if (core_config->levels_of_undo < 0)
{
g_message (_("Error: Levels of undo must be zero or greater."));
gimprc.levels_of_undo = old_levels_of_undo;
core_config->levels_of_undo = old_levels_of_undo;
return PREFS_CORRUPT;
}
if (gimprc.marching_speed < 50)
@ -281,38 +283,38 @@ prefs_check_settings (void)
gimprc.marching_speed = old_marching_speed;
return PREFS_CORRUPT;
}
if (gimprc.default_width < 1)
if (core_config->default_width < 1)
{
g_message (_("Error: Default width must be one or greater."));
gimprc.default_width = old_default_width;
core_config->default_width = old_default_width;
return PREFS_CORRUPT;
}
if (gimprc.default_height < 1)
if (core_config->default_height < 1)
{
g_message (_("Error: Default height must be one or greater."));
gimprc.default_height = old_default_height;
core_config->default_height = old_default_height;
return PREFS_CORRUPT;
}
if (gimprc.default_units < GIMP_UNIT_INCH ||
gimprc.default_units >= gimp_unit_get_number_of_units ())
if (core_config->default_units < GIMP_UNIT_INCH ||
core_config->default_units >= gimp_unit_get_number_of_units ())
{
g_message (_("Error: Default unit must be within unit range."));
gimprc.default_units = old_default_units;
core_config->default_units = old_default_units;
return PREFS_CORRUPT;
}
if (gimprc.default_xresolution < GIMP_MIN_RESOLUTION ||
gimprc.default_yresolution < GIMP_MIN_RESOLUTION)
if (core_config->default_xresolution < GIMP_MIN_RESOLUTION ||
core_config->default_yresolution < GIMP_MIN_RESOLUTION)
{
g_message (_("Error: Default resolution must not be zero."));
gimprc.default_xresolution = old_default_xresolution;
gimprc.default_yresolution = old_default_yresolution;
core_config->default_xresolution = old_default_xresolution;
core_config->default_yresolution = old_default_yresolution;
return PREFS_CORRUPT;
}
if (gimprc.default_resolution_units < GIMP_UNIT_INCH ||
gimprc.default_resolution_units >= gimp_unit_get_number_of_units ())
if (core_config->default_resolution_units < GIMP_UNIT_INCH ||
core_config->default_resolution_units >= gimp_unit_get_number_of_units ())
{
g_message (_("Error: Default resolution unit must be within unit range."));
gimprc.default_resolution_units = old_default_resolution_units;
core_config->default_resolution_units = old_default_resolution_units;
return PREFS_CORRUPT;
}
if (gimprc.monitor_xres < GIMP_MIN_RESOLUTION ||
@ -350,12 +352,12 @@ prefs_check_settings (void)
prefs_strcmp (old_temp_path, edit_temp_path) ||
prefs_strcmp (old_swap_path, edit_swap_path) ||
prefs_strcmp (old_plug_in_path, edit_plug_in_path) ||
prefs_strcmp (old_module_path, edit_module_path) ||
prefs_strcmp (old_brush_path, edit_brush_path) ||
prefs_strcmp (old_pattern_path, edit_pattern_path) ||
prefs_strcmp (old_palette_path, edit_palette_path) ||
prefs_strcmp (old_gradient_path, edit_gradient_path) ||
prefs_strcmp (old_plug_in_path, edit_plug_in_path) ||
prefs_strcmp (old_module_path, edit_module_path))
prefs_strcmp (old_gradient_path, edit_gradient_path))
{
return PREFS_RESTART;
}
@ -528,14 +530,15 @@ prefs_save_callback (GtkWidget *widget,
save_temp_path = base_config->temp_path;
save_swap_path = base_config->swap_path;
save_brush_path = gimprc.brush_path;
save_pattern_path = gimprc.pattern_path;
save_palette_path = gimprc.palette_path;
save_gradient_path = gimprc.gradient_path;
save_plug_in_path = gimprc.plug_in_path;
save_module_path = gimprc.module_path;
if (gimprc.levels_of_undo != old_levels_of_undo)
save_plug_in_path = core_config->plug_in_path;
save_module_path = core_config->module_path;
save_brush_path = core_config->brush_path;
save_pattern_path = core_config->pattern_path;
save_palette_path = core_config->palette_path;
save_gradient_path = core_config->gradient_path;
if (core_config->levels_of_undo != old_levels_of_undo)
{
update = g_list_append (update, "undo-levels");
}
@ -596,32 +599,32 @@ prefs_save_callback (GtkWidget *widget,
{
update = g_list_append (update, "always-restore-session");
}
if (gimprc.default_width != old_default_width ||
gimprc.default_height != old_default_height)
if (core_config->default_width != old_default_width ||
core_config->default_height != old_default_height)
{
update = g_list_append (update, "default-image-size");
}
if (gimprc.default_units != old_default_units)
if (core_config->default_units != old_default_units)
{
update = g_list_append (update, "default-units");
}
if (ABS (gimprc.default_xresolution - old_default_xresolution) > GIMP_MIN_RESOLUTION)
if (ABS (core_config->default_xresolution - old_default_xresolution) > GIMP_MIN_RESOLUTION)
{
update = g_list_append (update, "default-xresolution");
}
if (ABS (gimprc.default_yresolution - old_default_yresolution) > GIMP_MIN_RESOLUTION)
if (ABS (core_config->default_yresolution - old_default_yresolution) > GIMP_MIN_RESOLUTION)
{
update = g_list_append (update, "default-yresolution");
}
if (gimprc.default_resolution_units != old_default_resolution_units)
if (core_config->default_resolution_units != old_default_resolution_units)
{
update = g_list_append (update, "default-resolution-units");
}
if (gimprc.default_type != old_default_type)
if (core_config->default_type != old_default_type)
{
update = g_list_append (update, "default-image-type");
}
if (prefs_strcmp (gimprc.default_comment, old_default_comment))
if (prefs_strcmp (core_config->default_comment, old_default_comment))
{
update = g_list_append (update, "default-comment");
}
@ -680,7 +683,7 @@ prefs_save_callback (GtkWidget *widget,
{
update = g_list_append (update, "max-new-image-size");
}
if (gimprc.thumbnail_mode != old_thumbnail_mode)
if (core_config->thumbnail_mode != old_thumbnail_mode)
{
update = g_list_append (update, "thumbnail-mode");
}
@ -771,36 +774,36 @@ prefs_save_callback (GtkWidget *widget,
base_config->swap_path = edit_swap_path;
update = g_list_append (update, "swap-path");
}
if (prefs_strcmp (old_brush_path, edit_brush_path))
{
gimprc.brush_path = edit_brush_path;
update = g_list_append (update, "brush-path");
}
if (prefs_strcmp (old_pattern_path, edit_pattern_path))
{
gimprc.pattern_path = edit_pattern_path;
update = g_list_append (update, "pattern-path");
}
if (prefs_strcmp (old_palette_path, edit_palette_path))
{
gimprc.palette_path = edit_palette_path;
update = g_list_append (update, "palette-path");
}
if (prefs_strcmp (old_gradient_path, edit_gradient_path))
{
gimprc.gradient_path = edit_gradient_path;
update = g_list_append (update, "gradient-path");
}
if (prefs_strcmp (old_plug_in_path, edit_plug_in_path))
{
gimprc.plug_in_path = edit_plug_in_path;
core_config->plug_in_path = edit_plug_in_path;
update = g_list_append (update, "plug-in-path");
}
if (prefs_strcmp (old_module_path, edit_module_path))
{
gimprc.module_path = edit_module_path;
core_config->module_path = edit_module_path;
update = g_list_append (update, "module-path");
}
if (prefs_strcmp (old_brush_path, edit_brush_path))
{
core_config->brush_path = edit_brush_path;
update = g_list_append (update, "brush-path");
}
if (prefs_strcmp (old_pattern_path, edit_pattern_path))
{
core_config->pattern_path = edit_pattern_path;
update = g_list_append (update, "pattern-path");
}
if (prefs_strcmp (old_palette_path, edit_palette_path))
{
core_config->palette_path = edit_palette_path;
update = g_list_append (update, "palette-path");
}
if (prefs_strcmp (old_gradient_path, edit_gradient_path))
{
core_config->gradient_path = edit_gradient_path;
update = g_list_append (update, "gradient-path");
}
/* values which are changed on "OK" or "Save" */
if (edit_tile_cache_size != old_tile_cache_size)
@ -814,8 +817,8 @@ prefs_save_callback (GtkWidget *widget,
if (gimprc.using_xserver_resolution)
gdisplay_xserver_resolution (&(gimprc.monitor_xres),
&(gimprc.monitor_yres));
gdisplay_xserver_resolution (&gimprc.monitor_xres,
&gimprc.monitor_yres);
/* restore variables which must not change */
base_config->stingy_memory_use = save_stingy_memory_use;
@ -827,14 +830,15 @@ prefs_save_callback (GtkWidget *widget,
gimprc.nav_window_per_display = save_nav_window_per_display;
gimprc.info_window_follows_mouse = save_info_window_follows_mouse;
base_config->temp_path = save_temp_path;
base_config->swap_path = save_swap_path;
gimprc.brush_path = save_brush_path;
gimprc.pattern_path = save_pattern_path;
gimprc.palette_path = save_palette_path;
gimprc.gradient_path = save_gradient_path;
gimprc.plug_in_path = save_plug_in_path;
gimprc.module_path = save_module_path;
base_config->temp_path = save_temp_path;
base_config->swap_path = save_swap_path;
core_config->plug_in_path = save_plug_in_path;
core_config->module_path = save_module_path;
core_config->brush_path = save_brush_path;
core_config->pattern_path = save_pattern_path;
core_config->palette_path = save_palette_path;
core_config->gradient_path = save_gradient_path;
/* no need to restore values which are only changed on "OK" and "Save" */
@ -850,39 +854,40 @@ prefs_cancel_callback (GtkWidget *widget,
prefs_dlg = NULL;
/* restore ordinary gimprc variables */
base_config->interpolation_type = old_interpolation_type;
base_config->num_processors = old_num_processors;
base_config->interpolation_type = old_interpolation_type;
base_config->num_processors = old_num_processors;
gimprc.levels_of_undo = old_levels_of_undo;
gimprc.marching_speed = old_marching_speed;
gimprc.allow_resize_windows = old_allow_resize_windows;
gimprc.auto_save = old_auto_save;
gimprc.no_cursor_updating = old_no_cursor_updating;
gimprc.perfectmouse = old_perfectmouse;
gimprc.show_tool_tips = old_show_tool_tips;
gimprc.show_rulers = old_show_rulers;
gimprc.show_statusbar = old_show_statusbar;
gimprc.confirm_on_close = old_confirm_on_close;
gimprc.save_session_info = old_save_session_info;
gimprc.save_device_status = old_save_device_status;
gimprc.default_width = old_default_width;
gimprc.default_height = old_default_height;
gimprc.default_units = old_default_units;
gimprc.default_xresolution = old_default_xresolution;
gimprc.default_yresolution = old_default_yresolution;
gimprc.default_resolution_units = old_default_resolution_units;
gimprc.default_type = old_default_type;
gimprc.default_dot_for_dot = old_default_dot_for_dot;
gimprc.monitor_xres = old_monitor_xres;
gimprc.monitor_yres = old_monitor_yres;
gimprc.using_xserver_resolution = old_using_xserver_resolution;
gimprc.max_new_image_size = old_max_new_image_size;
gimprc.thumbnail_mode = old_thumbnail_mode;
gimprc.trust_dirty_flag = old_trust_dirty_flag;
gimprc.use_help = old_use_help;
gimprc.help_browser = old_help_browser;
gimprc.cursor_mode = old_cursor_mode;
gimprc.default_threshold = old_default_threshold;
core_config->default_type = old_default_type;
core_config->default_width = old_default_width;
core_config->default_height = old_default_height;
core_config->default_units = old_default_units;
core_config->default_xresolution = old_default_xresolution;
core_config->default_yresolution = old_default_yresolution;
core_config->default_resolution_units = old_default_resolution_units;
core_config->levels_of_undo = old_levels_of_undo;
core_config->thumbnail_mode = old_thumbnail_mode;
gimprc.marching_speed = old_marching_speed;
gimprc.allow_resize_windows = old_allow_resize_windows;
gimprc.auto_save = old_auto_save;
gimprc.no_cursor_updating = old_no_cursor_updating;
gimprc.perfectmouse = old_perfectmouse;
gimprc.show_tool_tips = old_show_tool_tips;
gimprc.show_rulers = old_show_rulers;
gimprc.show_statusbar = old_show_statusbar;
gimprc.confirm_on_close = old_confirm_on_close;
gimprc.save_session_info = old_save_session_info;
gimprc.save_device_status = old_save_device_status;
gimprc.default_dot_for_dot = old_default_dot_for_dot;
gimprc.monitor_xres = old_monitor_xres;
gimprc.monitor_yres = old_monitor_yres;
gimprc.using_xserver_resolution = old_using_xserver_resolution;
gimprc.max_new_image_size = old_max_new_image_size;
gimprc.trust_dirty_flag = old_trust_dirty_flag;
gimprc.use_help = old_use_help;
gimprc.help_browser = old_help_browser;
gimprc.cursor_mode = old_cursor_mode;
gimprc.default_threshold = old_default_threshold;
/* restore variables which need some magic */
if (gimprc.preview_size != old_preview_size)
@ -911,10 +916,10 @@ prefs_cancel_callback (GtkWidget *widget,
gdisplays_flush ();
}
prefs_strset (&(gimprc.image_title_format), old_image_title_format);
prefs_strset (&(gimprc.default_comment), old_default_comment);
prefs_strset (&gimprc.image_title_format, old_image_title_format);
prefs_strset (&core_config->default_comment, old_default_comment);
context_manager_set_global_paint_options (old_global_paint_options);
tool_manager_set_global_paint_options (the_gimp, old_global_paint_options);
/* restore values which need a restart */
edit_stingy_memory_use = old_stingy_memory_use;
@ -929,12 +934,13 @@ prefs_cancel_callback (GtkWidget *widget,
prefs_strset (&edit_temp_path, old_temp_path);
prefs_strset (&edit_swap_path, old_swap_path);
prefs_strset (&edit_plug_in_path, old_plug_in_path);
prefs_strset (&edit_module_path, old_module_path);
prefs_strset (&edit_brush_path, old_brush_path);
prefs_strset (&edit_pattern_path, old_pattern_path);
prefs_strset (&edit_palette_path, old_palette_path);
prefs_strset (&edit_gradient_path, old_gradient_path);
prefs_strset (&edit_plug_in_path, old_plug_in_path);
prefs_strset (&edit_module_path, old_module_path);
/* no need to restore values which are only changed on "OK" and "Save" */
}
@ -948,19 +954,19 @@ prefs_toggle_callback (GtkWidget *widget,
val = (gint *) data;
/* toggle buttos */
if (data == &(gimprc.allow_resize_windows) ||
data == &(gimprc.auto_save) ||
data == &(gimprc.no_cursor_updating) ||
data == &(gimprc.perfectmouse) ||
data == &(gimprc.show_tool_tips) ||
data == &(gimprc.show_rulers) ||
data == &(gimprc.show_statusbar) ||
data == &(gimprc.confirm_on_close) ||
data == &(gimprc.save_session_info) ||
data == &(gimprc.save_device_status) ||
data == &(gimprc.always_restore_session) ||
data == &(gimprc.default_dot_for_dot) ||
data == &(gimprc.use_help) ||
if (data == &gimprc.allow_resize_windows ||
data == &gimprc.auto_save ||
data == &gimprc.no_cursor_updating ||
data == &gimprc.perfectmouse ||
data == &gimprc.show_tool_tips ||
data == &gimprc.show_rulers ||
data == &gimprc.show_statusbar ||
data == &gimprc.confirm_on_close ||
data == &gimprc.save_session_info ||
data == &gimprc.save_device_status ||
data == &gimprc.always_restore_session ||
data == &gimprc.default_dot_for_dot ||
data == &gimprc.use_help ||
data == &edit_stingy_memory_use ||
data == &edit_install_cmap ||
@ -974,19 +980,19 @@ prefs_toggle_callback (GtkWidget *widget,
}
/* radio buttons */
else if (data == &(gimprc.thumbnail_mode) ||
data == &base_config->interpolation_type ||
data == &(gimprc.trust_dirty_flag) ||
data == &(gimprc.help_browser) ||
data == &(gimprc.cursor_mode) ||
data == &(gimprc.default_type))
else if (data == &base_config->interpolation_type ||
data == &core_config->default_type ||
data == &core_config->thumbnail_mode ||
data == &gimprc.trust_dirty_flag ||
data == &gimprc.help_browser ||
data == &gimprc.cursor_mode)
{
*val = (gint) gtk_object_get_user_data (GTK_OBJECT (widget));
}
/* values which need some magic */
else if ((data == &(gimprc.transparency_type)) ||
(data == &(gimprc.transparency_size)))
else if ((data == &gimprc.transparency_type) ||
(data == &gimprc.transparency_size))
{
*val = (gint) gtk_object_get_user_data (GTK_OBJECT (widget));
@ -997,10 +1003,10 @@ prefs_toggle_callback (GtkWidget *widget,
gdisplays_expose_full ();
gdisplays_flush ();
}
else if (data == &(gimprc.global_paint_options))
else if (data == &gimprc.global_paint_options)
{
context_manager_set_global_paint_options
(GTK_TOGGLE_BUTTON (widget)->active);
tool_manager_set_global_paint_options (the_gimp,
GTK_TOGGLE_BUTTON (widget)->active);
}
/* no matching varible found */
@ -1104,11 +1110,11 @@ static void
prefs_default_size_callback (GtkWidget *widget,
gpointer data)
{
gimprc.default_width =
core_config->default_width =
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0));
gimprc.default_height =
core_config->default_height =
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1));
gimprc.default_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
core_config->default_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
}
static void
@ -1153,15 +1159,15 @@ prefs_default_resolution_callback (GtkWidget *widget,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry),
1, yres, FALSE);
gimprc.default_width =
core_config->default_width =
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size_sizeentry), 0));
gimprc.default_height =
core_config->default_height =
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size_sizeentry), 1));
gimprc.default_xresolution = xres;
gimprc.default_yresolution = yres;
core_config->default_xresolution = xres;
core_config->default_yresolution = yres;
gimprc.default_resolution_units =
core_config->default_resolution_units =
gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
}
@ -1175,8 +1181,8 @@ prefs_res_source_callback (GtkWidget *widget,
if (GTK_TOGGLE_BUTTON (widget)->active)
{
gdisplay_xserver_resolution (&(gimprc.monitor_xres),
&(gimprc.monitor_yres));
gdisplay_xserver_resolution (&gimprc.monitor_xres,
&gimprc.monitor_yres);
gimprc.using_xserver_resolution = TRUE;
}
else
@ -1404,12 +1410,13 @@ preferences_dialog_create (void)
edit_temp_path = prefs_strdup (base_config->temp_path);
edit_swap_path = prefs_strdup (base_config->swap_path);
edit_plug_in_path = prefs_strdup (gimprc.plug_in_path);
edit_module_path = prefs_strdup (gimprc.module_path);
edit_brush_path = prefs_strdup (gimprc.brush_path);
edit_pattern_path = prefs_strdup (gimprc.pattern_path);
edit_palette_path = prefs_strdup (gimprc.palette_path);
edit_gradient_path = prefs_strdup (gimprc.gradient_path);
edit_plug_in_path = prefs_strdup (core_config->plug_in_path);
edit_module_path = prefs_strdup (core_config->module_path);
edit_brush_path = prefs_strdup (core_config->brush_path);
edit_pattern_path = prefs_strdup (core_config->pattern_path);
edit_palette_path = prefs_strdup (core_config->palette_path);
edit_gradient_path = prefs_strdup (core_config->gradient_path);
}
/* assign edit variables for values which get changed on "OK" and "Save"
@ -1421,10 +1428,19 @@ preferences_dialog_create (void)
old_interpolation_type = base_config->interpolation_type;
old_num_processors = base_config->num_processors;
old_default_type = core_config->default_type;
old_default_width = core_config->default_width;
old_default_height = core_config->default_height;
old_default_units = core_config->default_units;
old_default_xresolution = core_config->default_xresolution;
old_default_yresolution = core_config->default_yresolution;
old_default_resolution_units = core_config->default_resolution_units;
old_levels_of_undo = core_config->levels_of_undo;
old_thumbnail_mode = core_config->thumbnail_mode;
old_perfectmouse = gimprc.perfectmouse;
old_transparency_type = gimprc.transparency_type;
old_transparency_size = gimprc.transparency_size;
old_levels_of_undo = gimprc.levels_of_undo;
old_marching_speed = gimprc.marching_speed;
old_allow_resize_windows = gimprc.allow_resize_windows;
old_auto_save = gimprc.auto_save;
@ -1438,20 +1454,12 @@ preferences_dialog_create (void)
old_save_session_info = gimprc.save_session_info;
old_save_device_status = gimprc.save_device_status;
old_always_restore_session = gimprc.always_restore_session;
old_default_width = gimprc.default_width;
old_default_height = gimprc.default_height;
old_default_units = gimprc.default_units;
old_default_xresolution = gimprc.default_xresolution;
old_default_yresolution = gimprc.default_yresolution;
old_default_resolution_units = gimprc.default_resolution_units;
old_default_type = gimprc.default_type;
old_default_dot_for_dot = gimprc.default_dot_for_dot;
old_monitor_xres = gimprc.monitor_xres;
old_monitor_yres = gimprc.monitor_yres;
old_using_xserver_resolution = gimprc.using_xserver_resolution;
old_global_paint_options = gimprc.global_paint_options;
old_max_new_image_size = gimprc.max_new_image_size;
old_thumbnail_mode = gimprc.thumbnail_mode;
old_trust_dirty_flag = gimprc.trust_dirty_flag;
old_use_help = gimprc.use_help;
old_help_browser = gimprc.help_browser;
@ -1459,7 +1467,7 @@ preferences_dialog_create (void)
old_default_threshold = gimprc.default_threshold;
prefs_strset (&old_image_title_format, gimprc.image_title_format);
prefs_strset (&old_default_comment, gimprc.default_comment);
prefs_strset (&old_default_comment, core_config->default_comment);
/* values which will need a restart */
old_stingy_memory_use = edit_stingy_memory_use;
@ -1559,7 +1567,8 @@ preferences_dialog_create (void)
gtk_widget_show (hbox);
sizeentry =
gimp_size_entry_new (2, gimprc.default_units, "%p", FALSE, FALSE, TRUE, 75,
gimp_size_entry_new (2, core_config->default_units, "%p",
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
@ -1569,10 +1578,10 @@ preferences_dialog_create (void)
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
_("Pixels"), 1, 4, 0.0);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry),
0, gimprc.default_xresolution, FALSE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry),
1, gimprc.default_yresolution, FALSE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
core_config->default_xresolution, FALSE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1,
core_config->default_yresolution, FALSE);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (sizeentry), 0, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
@ -1580,9 +1589,9 @@ preferences_dialog_create (void)
(GIMP_SIZE_ENTRY (sizeentry), 1, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0,
gimprc.default_width);
core_config->default_width);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
gimprc.default_height);
core_config->default_height);
gtk_signal_connect (GTK_OBJECT (sizeentry), "unit_changed",
GTK_SIGNAL_FUNC (prefs_default_size_callback),
@ -1608,13 +1617,14 @@ preferences_dialog_create (void)
pixels_per_unit = g_strconcat (_("Pixels"), "/%s", NULL);
sizeentry2 =
gimp_size_entry_new (2, gimprc.default_resolution_units, pixels_per_unit,
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
sizeentry2 = gimp_size_entry_new (2, core_config->default_resolution_units,
pixels_per_unit,
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
if (ABS (gimprc.default_xresolution - gimprc.default_yresolution) < GIMP_MIN_RESOLUTION)
if (ABS (core_config->default_xresolution -
core_config->default_yresolution) < GIMP_MIN_RESOLUTION)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
gtk_table_attach_defaults (GTK_TABLE (sizeentry2), button, 1, 3, 3, 4);
gtk_widget_show (button);
@ -1633,10 +1643,10 @@ preferences_dialog_create (void)
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (sizeentry2), 1, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2),
0, gimprc.default_xresolution);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2),
1, gimprc.default_yresolution);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2), 0,
core_config->default_xresolution);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2), 1,
core_config->default_yresolution);
gtk_signal_connect (GTK_OBJECT (sizeentry2), "unit_changed",
(GtkSignalFunc) prefs_default_resolution_callback,
@ -1664,8 +1674,8 @@ preferences_dialog_create (void)
optionmenu =
gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
&(gimprc.default_type), (gpointer)
gimprc.default_type,
&core_config->default_type,
(gpointer) core_config->default_type,
_("RGB"), (gpointer) RGB, NULL,
_("Grayscale"), (gpointer) GRAY, NULL,
@ -1682,7 +1692,7 @@ preferences_dialog_create (void)
hbox = gimp_mem_size_entry_new (GTK_ADJUSTMENT (adjustment));
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
GTK_SIGNAL_FUNC (gimp_uint_adjustment_update),
&(gimprc.max_new_image_size));
&gimprc.max_new_image_size);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Maximum Image Size:"), 1.0, 0.5,
hbox, 1, TRUE);
@ -1710,10 +1720,11 @@ preferences_dialog_create (void)
text = gtk_text_new (NULL, NULL);
gtk_text_set_editable (GTK_TEXT (text), TRUE);
gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL, gimprc.default_comment, -1);
gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL,
core_config->default_comment, -1);
gtk_signal_connect (GTK_OBJECT (text), "changed",
GTK_SIGNAL_FUNC (prefs_text_callback),
&(gimprc.default_comment));
&core_config->default_comment);
gtk_container_add (GTK_CONTAINER (hbox), text);
gtk_widget_show (text);
@ -1746,7 +1757,8 @@ preferences_dialog_create (void)
optionmenu =
gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
&(gimprc.transparency_type), (gpointer) gimprc.transparency_type,
&gimprc.transparency_type,
(gpointer) gimprc.transparency_type,
_("Light Checks"), (gpointer) LIGHT_CHECKS, NULL,
_("Mid-Tone Checks"), (gpointer) GRAY_CHECKS, NULL,
@ -1762,8 +1774,8 @@ preferences_dialog_create (void)
optionmenu =
gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
&(gimprc.transparency_size), (gpointer)
gimprc.transparency_size,
&gimprc.transparency_size,
(gpointer) gimprc.transparency_size,
_("Small"), (gpointer) SMALL_CHECKS, NULL,
_("Medium"), (gpointer) MEDIUM_CHECKS, NULL,
@ -1853,8 +1865,8 @@ preferences_dialog_create (void)
optionmenu =
gimp_option_menu_new2 (FALSE, prefs_preview_size_callback,
&(gimprc.preview_size), (gpointer)
gimprc.preview_size,
&gimprc.preview_size,
(gpointer) gimprc.preview_size,
_("None"), (gpointer) 0, NULL,
_("Tiny"), (gpointer) 24, NULL,
@ -1870,8 +1882,8 @@ preferences_dialog_create (void)
optionmenu =
gimp_option_menu_new2 (FALSE, prefs_nav_preview_size_callback,
&(gimprc.nav_preview_size), (gpointer)
gimprc.nav_preview_size,
&gimprc.nav_preview_size,
(gpointer) gimprc.nav_preview_size,
_("Small"), (gpointer) 48, NULL,
_("Medium"), (gpointer) 80, NULL,
@ -1956,7 +1968,7 @@ preferences_dialog_create (void)
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (prefs_toggle_callback),
&(gimprc.show_tool_tips));
&gimprc.show_tool_tips);
gtk_widget_show (button);
button =
@ -1966,7 +1978,7 @@ preferences_dialog_create (void)
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (prefs_toggle_callback),
&(gimprc.use_help));
&gimprc.use_help);
gtk_widget_show (button);
vbox2 = prefs_frame_new (_("Help Browser"), GTK_BOX (vbox));
@ -1979,7 +1991,8 @@ preferences_dialog_create (void)
optionmenu =
gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
&(gimprc.help_browser), (gpointer) gimprc.help_browser,
&gimprc.help_browser,
(gpointer) gimprc.help_browser,
_("Internal"), (gpointer) HELP_BROWSER_GIMP, NULL,
_("Netscape"), (gpointer) HELP_BROWSER_NETSCAPE, NULL,
@ -2009,7 +2022,7 @@ preferences_dialog_create (void)
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (prefs_toggle_callback),
&(gimprc.default_dot_for_dot));
&gimprc.default_dot_for_dot);
gtk_widget_show (button);
button = gtk_check_button_new_with_label(_("Resize Window on Zoom"));
@ -2018,7 +2031,7 @@ preferences_dialog_create (void)
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (prefs_toggle_callback),
&(gimprc.allow_resize_windows));
&gimprc.allow_resize_windows);
gtk_widget_show (button);
button = gtk_check_button_new_with_label(_("Show Rulers"));
@ -2027,7 +2040,7 @@ preferences_dialog_create (void)
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (prefs_toggle_callback),
&(gimprc.show_rulers));
&gimprc.show_rulers);
gtk_widget_show (button);
button = gtk_check_button_new_with_label(_("Show Statusbar"));
@ -2036,7 +2049,7 @@ preferences_dialog_create (void)
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (prefs_toggle_callback),
&(gimprc.show_statusbar));
&gimprc.show_statusbar);
gtk_widget_show (button);
table = gtk_table_new (2, 2, FALSE);
@ -2047,12 +2060,11 @@ preferences_dialog_create (void)
gtk_widget_show (table);
spinbutton =
gimp_spin_button_new (&adjustment,
gimprc.marching_speed, 50.0, 32000.0, 10.0, 100.0, 1.0,
1.0, 0.0);
gimp_spin_button_new (&adjustment, gimprc.marching_speed,
50.0, 32000.0, 10.0, 100.0, 1.0, 1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
&(gimprc.marching_speed));
&gimprc.marching_speed);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Marching Ants Speed:"), 1.0, 0.5,
spinbutton, 1, TRUE);
@ -2091,7 +2103,7 @@ preferences_dialog_create (void)
gtk_signal_connect (GTK_OBJECT (GTK_COMBO (combo)->entry), "changed",
GTK_SIGNAL_FUNC (prefs_string_callback),
&(gimprc.image_title_format));
&gimprc.image_title_format);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Image Title Format:"), 1.0, 0.5,
@ -2107,7 +2119,7 @@ preferences_dialog_create (void)
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (prefs_toggle_callback),
&(gimprc.perfectmouse));
&gimprc.perfectmouse);
gtk_widget_show (button);
button = gtk_check_button_new_with_label (_("Disable Cursor Updating"));
@ -2116,7 +2128,7 @@ preferences_dialog_create (void)
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (prefs_toggle_callback),
&(gimprc.no_cursor_updating));
&gimprc.no_cursor_updating);
gtk_widget_show (button);
table = gtk_table_new (1, 2, FALSE);
@ -2127,7 +2139,7 @@ preferences_dialog_create (void)
optionmenu =
gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
&(gimprc.cursor_mode),
&gimprc.cursor_mode,
(gpointer) gimprc.cursor_mode,
_("Tool Icon"),
@ -2164,7 +2176,7 @@ preferences_dialog_create (void)
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (prefs_toggle_callback),
&(gimprc.global_paint_options));
&gimprc.global_paint_options);
gtk_widget_show (button);
vbox2 = prefs_frame_new (_("Finding Contiguous Regions"), GTK_BOX (vbox));
@ -2178,12 +2190,11 @@ preferences_dialog_create (void)
/* Default threshold */
spinbutton =
gimp_spin_button_new (&adjustment,
gimprc.default_threshold, 0.0, 255.0,
1.0, 5.0, 0.0, 1.0, 0.0);
gimp_spin_button_new (&adjustment, gimprc.default_threshold,
0.0, 255.0, 1.0, 5.0, 0.0, 1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
&(gimprc.default_threshold));
&gimprc.default_threshold);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Default Threshold:"), 1.0, 0.5,
spinbutton, 1, TRUE);
@ -2227,12 +2238,11 @@ preferences_dialog_create (void)
gtk_widget_show (table);
/* Levels of Undo */
spinbutton =
gimp_spin_button_new (&adjustment,
gimprc.levels_of_undo, 0.0, 255.0, 1.0, 5.0, 0.0, 1.0, 0.0);
spinbutton = gimp_spin_button_new (&adjustment, core_config->levels_of_undo,
0.0, 255.0, 1.0, 5.0, 0.0, 1.0, 0.0);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
&(gimprc.levels_of_undo));
&core_config->levels_of_undo);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Levels of Undo:"), 1.0, 0.5,
spinbutton, 1, TRUE);
@ -2307,8 +2317,8 @@ preferences_dialog_create (void)
optionmenu =
gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
&(gimprc.thumbnail_mode), (gpointer)
gimprc.thumbnail_mode,
&core_config->thumbnail_mode,
(gpointer) core_config->thumbnail_mode,
_("Always"), (gpointer) 1, NULL,
_("Never"), (gpointer) 0, NULL,
@ -2320,7 +2330,7 @@ preferences_dialog_create (void)
optionmenu =
gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
&(gimprc.trust_dirty_flag),
&gimprc.trust_dirty_flag,
(gpointer) gimprc.trust_dirty_flag,
_("Only when Modified"), (gpointer) 1, NULL,
@ -2352,7 +2362,7 @@ preferences_dialog_create (void)
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (prefs_toggle_callback),
&(gimprc.save_session_info));
&gimprc.save_session_info);
gtk_widget_show (button);
hbox = gtk_hbox_new (FALSE, 2);
@ -2374,7 +2384,7 @@ preferences_dialog_create (void)
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (prefs_toggle_callback),
&(gimprc.always_restore_session));
&gimprc.always_restore_session);
gtk_widget_show (button);
vbox2 = prefs_frame_new (_("Devices"), GTK_BOX (vbox));
@ -2385,7 +2395,7 @@ preferences_dialog_create (void)
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (prefs_toggle_callback),
&(gimprc.save_device_status));
&gimprc.save_device_status);
gtk_widget_show (button);
/* Monitor */
@ -2459,7 +2469,7 @@ preferences_dialog_create (void)
gtk_container_add (GTK_CONTAINER (abox), sizeentry);
gtk_widget_show (sizeentry);
gtk_widget_set_sensitive (sizeentry, !gimprc.using_xserver_resolution);
gtk_widget_set_sensitive (sizeentry, ! gimprc.using_xserver_resolution);
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
@ -2471,7 +2481,7 @@ preferences_dialog_create (void)
sizeentry);
gtk_box_pack_start (GTK_BOX (hbox), calibrate_button, FALSE, FALSE, 0);
gtk_widget_show (calibrate_button);
gtk_widget_set_sensitive (calibrate_button, !gimprc.using_xserver_resolution);
gtk_widget_set_sensitive (calibrate_button, ! gimprc.using_xserver_resolution);
group = NULL;
button = gtk_radio_button_new_with_label (group, _("From windowing system"));
@ -2507,7 +2517,7 @@ preferences_dialog_create (void)
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
if (!gimprc.using_xserver_resolution)
if (! gimprc.using_xserver_resolution)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
/* Directories */

View File

@ -26,13 +26,12 @@
#include "core/core-types.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "resize-dialog.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
@ -593,7 +592,7 @@ resize_widget_new (ResizeType type,
gtk_widget_set_usize (spinbutton, 75, 0);
private->resolution_se =
gimp_size_entry_new (1, gimprc.default_resolution_units,
gimp_size_entry_new (1, core_config->default_resolution_units,
_("pixels/%a"),
FALSE, FALSE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);

View File

@ -34,6 +34,7 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimp.h"
#include "core/gimpbuffer.h"
#include "core/gimpcontext.h"
#include "core/gimpedit.h"
@ -159,7 +160,8 @@ gdisplay_shell_events (GtkWidget *widget,
case GDK_KEY_PRESS:
case GDK_BUTTON_PRESS:
/* Setting the context's display automatically sets the image, too */
gimp_context_set_display (gimp_context_get_user (), gdisp);
gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp),
gdisp);
break;
default:
@ -318,7 +320,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
/* and doesn't want to be preserved across drawable changes */
! active_tool->preserve)
{
tool_manager_initialize_tool (active_tool, gdisp);
tool_manager_initialize_tool (gdisp->gimage->gimp,
active_tool, gdisp);
}
/* otherwise set it's drawable if it has none */
@ -685,8 +688,9 @@ gdisplay_hruler_button_press (GtkWidget *widget,
{
gdisp = data;
gimp_context_set_tool (gimp_context_get_user (),
tool_manager_get_info_by_type (GIMP_TYPE_MOVE_TOOL));
gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp),
tool_manager_get_info_by_type (gdisp->gimage->gimp,
GIMP_TYPE_MOVE_TOOL));
gimp_move_tool_start_hguide (active_tool, gdisp);
gtk_grab_add (gdisp->canvas);
@ -709,8 +713,9 @@ gdisplay_vruler_button_press (GtkWidget *widget,
{
gdisp = data;
gimp_context_set_tool (gimp_context_get_user (),
tool_manager_get_info_by_type (GIMP_TYPE_MOVE_TOOL));
gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp),
tool_manager_get_info_by_type (gdisp->gimage->gimp,
GIMP_TYPE_MOVE_TOOL));
gimp_move_tool_start_vguide (active_tool, gdisp);
gtk_grab_add (gdisp->canvas);
@ -875,7 +880,8 @@ gdisplay_drop_drawable (GtkWidget *widget,
gdisplays_flush ();
gimp_context_set_display (gimp_context_get_user (), gdisp);
gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp),
gdisp);
}
}
@ -911,7 +917,8 @@ gdisplay_bucket_fill (GtkWidget *widget,
gimp_set_busy ();
/* Get the bucket fill context */
tool_info = tool_manager_get_info_by_type (GIMP_TYPE_BUCKET_FILL_TOOL);
tool_info = tool_manager_get_info_by_type (gimage->gimp,
GIMP_TYPE_BUCKET_FILL_TOOL);
if (tool_info && tool_info->context)
{
@ -919,7 +926,7 @@ gdisplay_bucket_fill (GtkWidget *widget,
}
else
{
context = gimp_context_get_user ();
context = gimp_get_user_context (gimage->gimp);
}
/* Transform the passed data for the dest image */

View File

@ -34,6 +34,7 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimp.h"
#include "core/gimpbuffer.h"
#include "core/gimpcontext.h"
#include "core/gimpedit.h"
@ -159,7 +160,8 @@ gdisplay_shell_events (GtkWidget *widget,
case GDK_KEY_PRESS:
case GDK_BUTTON_PRESS:
/* Setting the context's display automatically sets the image, too */
gimp_context_set_display (gimp_context_get_user (), gdisp);
gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp),
gdisp);
break;
default:
@ -318,7 +320,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
/* and doesn't want to be preserved across drawable changes */
! active_tool->preserve)
{
tool_manager_initialize_tool (active_tool, gdisp);
tool_manager_initialize_tool (gdisp->gimage->gimp,
active_tool, gdisp);
}
/* otherwise set it's drawable if it has none */
@ -685,8 +688,9 @@ gdisplay_hruler_button_press (GtkWidget *widget,
{
gdisp = data;
gimp_context_set_tool (gimp_context_get_user (),
tool_manager_get_info_by_type (GIMP_TYPE_MOVE_TOOL));
gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp),
tool_manager_get_info_by_type (gdisp->gimage->gimp,
GIMP_TYPE_MOVE_TOOL));
gimp_move_tool_start_hguide (active_tool, gdisp);
gtk_grab_add (gdisp->canvas);
@ -709,8 +713,9 @@ gdisplay_vruler_button_press (GtkWidget *widget,
{
gdisp = data;
gimp_context_set_tool (gimp_context_get_user (),
tool_manager_get_info_by_type (GIMP_TYPE_MOVE_TOOL));
gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp),
tool_manager_get_info_by_type (gdisp->gimage->gimp,
GIMP_TYPE_MOVE_TOOL));
gimp_move_tool_start_vguide (active_tool, gdisp);
gtk_grab_add (gdisp->canvas);
@ -875,7 +880,8 @@ gdisplay_drop_drawable (GtkWidget *widget,
gdisplays_flush ();
gimp_context_set_display (gimp_context_get_user (), gdisp);
gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp),
gdisp);
}
}
@ -911,7 +917,8 @@ gdisplay_bucket_fill (GtkWidget *widget,
gimp_set_busy ();
/* Get the bucket fill context */
tool_info = tool_manager_get_info_by_type (GIMP_TYPE_BUCKET_FILL_TOOL);
tool_info = tool_manager_get_info_by_type (gimage->gimp,
GIMP_TYPE_BUCKET_FILL_TOOL);
if (tool_info && tool_info->context)
{
@ -919,7 +926,7 @@ gdisplay_bucket_fill (GtkWidget *widget,
}
else
{
context = gimp_context_get_user ();
context = gimp_get_user_context (gimage->gimp);
}
/* Transform the passed data for the dest image */

View File

@ -211,6 +211,8 @@ selection_pause (Selection *select)
{
g_source_remove (select->timeout_id);
select->timeout_id = 0;
select->state = INVISIBLE;
}
select->paused ++;

View File

@ -31,6 +31,7 @@
#include "base/temp-buf.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
@ -51,6 +52,7 @@
#include "gui/menus.h"
#include "nav_window.h"
#include "app_procs.h"
#include "appenv.h"
#include "colormaps.h"
#include "gimprc.h"
@ -785,8 +787,12 @@ gdisplay_flush_whenever (GDisplay *gdisp,
qmask_buttons_update (gdisp);
/* ensure the consistency of the tear-off menus */
if (!now && gimp_context_get_display (gimp_context_get_user ()) == gdisp)
gdisplay_set_menu_sensitivity (gdisp);
if (! now &&
gimp_context_get_display (gimp_get_user_context
(gdisp->gimage->gimp)) == gdisp)
{
gdisplay_set_menu_sensitivity (gdisp);
}
}
void
@ -2229,7 +2235,7 @@ gdisplay_active (void)
gdk_event_free (event);
}
return gimp_context_get_display (gimp_context_get_user ());
return gimp_context_get_display (gimp_get_user_context (the_gimp));
}
GDisplay *

View File

@ -34,6 +34,7 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimp.h"
#include "core/gimpbuffer.h"
#include "core/gimpcontext.h"
#include "core/gimpedit.h"
@ -159,7 +160,8 @@ gdisplay_shell_events (GtkWidget *widget,
case GDK_KEY_PRESS:
case GDK_BUTTON_PRESS:
/* Setting the context's display automatically sets the image, too */
gimp_context_set_display (gimp_context_get_user (), gdisp);
gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp),
gdisp);
break;
default:
@ -318,7 +320,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
/* and doesn't want to be preserved across drawable changes */
! active_tool->preserve)
{
tool_manager_initialize_tool (active_tool, gdisp);
tool_manager_initialize_tool (gdisp->gimage->gimp,
active_tool, gdisp);
}
/* otherwise set it's drawable if it has none */
@ -685,8 +688,9 @@ gdisplay_hruler_button_press (GtkWidget *widget,
{
gdisp = data;
gimp_context_set_tool (gimp_context_get_user (),
tool_manager_get_info_by_type (GIMP_TYPE_MOVE_TOOL));
gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp),
tool_manager_get_info_by_type (gdisp->gimage->gimp,
GIMP_TYPE_MOVE_TOOL));
gimp_move_tool_start_hguide (active_tool, gdisp);
gtk_grab_add (gdisp->canvas);
@ -709,8 +713,9 @@ gdisplay_vruler_button_press (GtkWidget *widget,
{
gdisp = data;
gimp_context_set_tool (gimp_context_get_user (),
tool_manager_get_info_by_type (GIMP_TYPE_MOVE_TOOL));
gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp),
tool_manager_get_info_by_type (gdisp->gimage->gimp,
GIMP_TYPE_MOVE_TOOL));
gimp_move_tool_start_vguide (active_tool, gdisp);
gtk_grab_add (gdisp->canvas);
@ -875,7 +880,8 @@ gdisplay_drop_drawable (GtkWidget *widget,
gdisplays_flush ();
gimp_context_set_display (gimp_context_get_user (), gdisp);
gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp),
gdisp);
}
}
@ -911,7 +917,8 @@ gdisplay_bucket_fill (GtkWidget *widget,
gimp_set_busy ();
/* Get the bucket fill context */
tool_info = tool_manager_get_info_by_type (GIMP_TYPE_BUCKET_FILL_TOOL);
tool_info = tool_manager_get_info_by_type (gimage->gimp,
GIMP_TYPE_BUCKET_FILL_TOOL);
if (tool_info && tool_info->context)
{
@ -919,7 +926,7 @@ gdisplay_bucket_fill (GtkWidget *widget,
}
else
{
context = gimp_context_get_user ();
context = gimp_get_user_context (gimage->gimp);
}
/* Transform the passed data for the dest image */

View File

@ -29,6 +29,7 @@
#include "core/core-types.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
@ -36,6 +37,7 @@
#include "widgets/gimpcolorpanel.h"
#include "app_procs.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
@ -238,7 +240,10 @@ qmask_activate (GtkWidget *widget,
"Qmask",
&color);
gimp_image_add_channel (gimg, gmask, 0);
drawable_fill (GIMP_DRAWABLE (gmask), TRANSPARENT_FILL);
drawable_fill (GIMP_DRAWABLE (gmask),
gimp_get_user_context (gimg->gimp),
TRANSPARENT_FILL);
}
else
{

View File

@ -211,6 +211,8 @@ selection_pause (Selection *select)
{
g_source_remove (select->timeout_id);
select->timeout_id = 0;
select->state = INVISIBLE;
}
select->paused ++;

View File

@ -363,7 +363,7 @@ nav_dialog_follow_auto (void)
GimpContext *context;
GDisplay *gdisp;
context = gimp_context_get_user ();
context = gimp_get_user_context (the_gimp);
gdisp = gimp_context_get_display (context);

View File

@ -363,7 +363,7 @@ nav_dialog_follow_auto (void)
GimpContext *context;
GDisplay *gdisp;
context = gimp_context_get_user ();
context = gimp_get_user_context (the_gimp);
gdisp = gimp_context_get_display (context);

View File

@ -34,6 +34,7 @@
void
drawable_fill (GimpDrawable *drawable,
GimpContext *context,
GimpFillType fill_type)
{
GimpRGB color;
@ -46,11 +47,11 @@ drawable_fill (GimpDrawable *drawable,
switch (fill_type)
{
case FOREGROUND_FILL:
gimp_context_get_foreground (NULL, &color);
gimp_context_get_foreground (context, &color);
break;
case BACKGROUND_FILL:
gimp_context_get_background (NULL, &color);
gimp_context_get_background (context, &color);
break;
case WHITE_FILL:

View File

@ -21,7 +21,9 @@
void drawable_fill (GimpDrawable *drawable,
GimpContext *context,
GimpFillType fill_type);
void drawable_update (GimpDrawable *drawable,
gint x,
gint y,

View File

@ -145,11 +145,34 @@ gimp_terminate (gchar *fmt, ...)
if (use_debug_handler)
{
sigset_t sigset;
switch (stack_trace_mode)
{
case STACK_TRACE_NEVER:
break;
sigemptyset (&sigset);
sigprocmask (SIG_SETMASK, &sigset, NULL);
g_on_error_query (prog_name);
case STACK_TRACE_QUERY:
{
sigset_t sigset;
sigemptyset (&sigset);
sigprocmask (SIG_SETMASK, &sigset, NULL);
g_on_error_query (prog_name);
}
break;
case STACK_TRACE_ALWAYS:
{
sigset_t sigset;
sigemptyset (&sigset);
sigprocmask (SIG_SETMASK, &sigset, NULL);
g_on_error_stack_trace (prog_name);
}
break;
default:
break;
}
}
#else

View File

@ -61,8 +61,6 @@
#include "core/gimpimage.h"
#include "app_procs.h"
#include "gimprc.h"
#include "file-open.h"
#include "file-utils.h"
#include "plug_in.h"
@ -77,7 +75,8 @@ GSList *load_procs = NULL;
/* public functions */
GimpImage *
file_open_image (const gchar *filename,
file_open_image (Gimp *gimp,
const gchar *filename,
const gchar *raw_filename,
const gchar *open_mode,
PlugInProcDef *file_proc,
@ -157,7 +156,7 @@ file_open_image (const gchar *filename,
args[1].value.pdb_pointer = (gchar *) filename;
args[2].value.pdb_pointer = (gchar *) raw_filename;
return_vals = procedural_db_execute (the_gimp, proc->name, args);
return_vals = procedural_db_execute (gimp, proc->name, args);
*status = return_vals[0].value.pdb_int;
gimage_id = return_vals[1].value.pdb_int;

View File

@ -23,7 +23,8 @@
extern GSList *load_procs;
GimpImage * file_open_image (const gchar *filename,
GimpImage * file_open_image (Gimp *gimp,
const gchar *filename,
const gchar *raw_filename,
const gchar *open_mode,
PlugInProcDef *file_proc,

View File

@ -59,13 +59,13 @@
#include "core/core-types.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "docindex.h"
#include "gui/menus.h"
#include "gimprc.h"
#include "file-save.h"
#include "file-utils.h"
#include "plug_in.h"
@ -181,7 +181,7 @@ file_save (GimpImage *gimage,
/* gimage_set_save_proc(gimage, file_proc); */
/* Write a thumbnail for the saved image, where appropriate */
switch (gimprc.thumbnail_mode)
switch (core_config->thumbnail_mode)
{
case 0:
break;

View File

@ -61,8 +61,6 @@
#include "core/gimpimage.h"
#include "app_procs.h"
#include "gimprc.h"
#include "file-open.h"
#include "file-utils.h"
#include "plug_in.h"
@ -77,7 +75,8 @@ GSList *load_procs = NULL;
/* public functions */
GimpImage *
file_open_image (const gchar *filename,
file_open_image (Gimp *gimp,
const gchar *filename,
const gchar *raw_filename,
const gchar *open_mode,
PlugInProcDef *file_proc,
@ -157,7 +156,7 @@ file_open_image (const gchar *filename,
args[1].value.pdb_pointer = (gchar *) filename;
args[2].value.pdb_pointer = (gchar *) raw_filename;
return_vals = procedural_db_execute (the_gimp, proc->name, args);
return_vals = procedural_db_execute (gimp, proc->name, args);
*status = return_vals[0].value.pdb_int;
gimage_id = return_vals[1].value.pdb_int;

View File

@ -23,7 +23,8 @@
extern GSList *load_procs;
GimpImage * file_open_image (const gchar *filename,
GimpImage * file_open_image (Gimp *gimp,
const gchar *filename,
const gchar *raw_filename,
const gchar *open_mode,
PlugInProcDef *file_proc,

View File

@ -59,13 +59,13 @@
#include "core/core-types.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "docindex.h"
#include "gui/menus.h"
#include "gimprc.h"
#include "file-save.h"
#include "file-utils.h"
#include "plug_in.h"
@ -181,7 +181,7 @@ file_save (GimpImage *gimage,
/* gimage_set_save_proc(gimage, file_proc); */
/* Write a thumbnail for the saved image, where appropriate */
switch (gimprc.thumbnail_mode)
switch (core_config->thumbnail_mode)
{
case 0:
break;

View File

@ -31,6 +31,7 @@
#include "base/temp-buf.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
@ -51,6 +52,7 @@
#include "gui/menus.h"
#include "nav_window.h"
#include "app_procs.h"
#include "appenv.h"
#include "colormaps.h"
#include "gimprc.h"
@ -785,8 +787,12 @@ gdisplay_flush_whenever (GDisplay *gdisp,
qmask_buttons_update (gdisp);
/* ensure the consistency of the tear-off menus */
if (!now && gimp_context_get_display (gimp_context_get_user ()) == gdisp)
gdisplay_set_menu_sensitivity (gdisp);
if (! now &&
gimp_context_get_display (gimp_get_user_context
(gdisp->gimage->gimp)) == gdisp)
{
gdisplay_set_menu_sensitivity (gdisp);
}
}
void
@ -2229,7 +2235,7 @@ gdisplay_active (void)
gdk_event_free (event);
}
return gimp_context_get_display (gimp_context_get_user ());
return gimp_context_get_display (gimp_get_user_context (the_gimp));
}
GDisplay *

View File

@ -102,9 +102,9 @@ gimage_dirty_handler (GimpImage *gimage)
if (gdisp)
{
if (gdisp->gimage == gimage)
tool_manager_initialize_tool (active_tool, gdisp);
tool_manager_initialize_tool (gimage->gimp, active_tool, gdisp);
else
tool_manager_initialize_tool (active_tool, NULL);
tool_manager_initialize_tool (gimage->gimp, active_tool, NULL);
}
}
}

View File

@ -43,6 +43,7 @@
#include "base/base-config.c"
#include "core/gimpcoreconfig.h"
#include "core/gimptoolinfo.h"
#include "tools/gimptool.h"
@ -197,24 +198,12 @@ static gchar * open_backup_file (gchar *filename,
/* global gimprc variables */
GimpRc gimprc =
{
/* plug_in_path */ NULL,
/* brush_path */ NULL,
/* default_brush */ NULL,
/* pattern_path */ NULL,
/* default_pattern */ NULL,
/* palette_path */ NULL,
/* default_palette */ NULL,
/* gradient_path */ NULL,
/* default_gradient */ NULL,
/* pluginrc_path */ NULL,
/* module_path */ NULL,
/* marching_speed */ 300, /* 300 ms */
/* last_opened_size */ 4,
/* gamma_val */ 1.0,
/* transparency_type */ 1, /* Mid-Tone Checks */
/* perfectmouse */ FALSE, /* off (fast and sloppy) */
/* transparency_size */ 1, /* Medium sized */
/* levels_of_undo */ 5,
/* last_opened_size */ 4,
/* min_colors */ 144, /* 6*6*4 */
/* install_cmap */ FALSE,
/* cycled_marching_ants */ 0,
@ -225,20 +214,12 @@ GimpRc gimprc =
/* nav_preview_size */ 112,
/* show_rulers */ TRUE,
/* show_statusbar */ TRUE,
/* default_units */ GIMP_UNIT_INCH,
/* auto_save */ TRUE,
/* confirm_on_close */ TRUE,
/* default_dot_for_dot */ TRUE,
/* save_session_info */ TRUE,
/* save_device_status */ FALSE,
/* always_restore_session */ TRUE,
/* default_width */ 256,
/* default_height */ 256,
/* default_type */ RGB,
/* default_xresolution */ 72.0,
/* default_yresolution */ 72.0,
/* default_resolution_units */ GIMP_UNIT_INCH,
/* default_comment */ NULL,
/* default_dot_for_dot */ TRUE,
/* show_tips */ TRUE,
/* last_tip */ -1,
/* show_tool_tips */ TRUE,
@ -247,10 +228,8 @@ GimpRc gimprc =
/* using_xserver_resolution */ FALSE,
/* image_title_format */ NULL,
/* global_paint_options */ FALSE,
/* module_db_load_inhibit */ NULL,
/* show_indicators */ TRUE,
/* max_new_image_size */ 33554432, /* 32 MB */
/* thumbnail_mode */ 1,
/* trust_dirty_flag */ FALSE,
/* use_help */ TRUE,
/* nav_window_per_display */ FALSE,
@ -265,36 +244,12 @@ static GHashTable *parse_func_hash = NULL;
static ParseFunc funcs[] =
{
{ "brush-path", TT_PATH,
&(gimprc.brush_path), NULL },
{ "pattern-path", TT_PATH,
&(gimprc.pattern_path), NULL },
{ "plug-in-path", TT_PATH,
&(gimprc.plug_in_path), NULL },
{ "palette-path", TT_PATH,
&(gimprc.palette_path), NULL },
{ "gradient-path", TT_PATH,
&(gimprc.gradient_path), NULL },
{ "pluginrc-path", TT_PATH,
&(gimprc.pluginrc_path), NULL },
{ "module-path", TT_PATH,
&(gimprc.module_path), NULL },
{ "default-brush", TT_STRING,
&(gimprc.default_brush), NULL },
{ "default-pattern", TT_STRING,
&(gimprc.default_pattern), NULL },
{ "default-palette", TT_STRING,
&(gimprc.default_palette), NULL },
{ "default-gradient", TT_STRING,
&(gimprc.default_gradient), NULL },
{ "gamma-correction", TT_DOUBLE,
&(gimprc.gamma_val), NULL },
{ "marching-ants-speed", TT_INT,
&(gimprc.marching_speed), NULL },
{ "last-opened-size", TT_INT,
&(gimprc.last_opened_size), NULL },
{ "undo-levels", TT_INT,
&(gimprc.levels_of_undo), NULL },
{ "transparency-type", TT_INT,
&(gimprc.transparency_type), NULL },
{ "perfect-mouse", TT_BOOLEAN,
@ -327,8 +282,6 @@ static ParseFunc funcs[] =
&(gimprc.show_statusbar), NULL },
{ "dont-show-statusbar", TT_BOOLEAN, NULL,
&(gimprc.show_statusbar) },
{ "default-units", TT_XUNIT,
&(gimprc.default_units), NULL },
{ "auto-save", TT_BOOLEAN,
&(gimprc.auto_save), NULL },
{ "dont-auto-save", TT_BOOLEAN, NULL,
@ -357,18 +310,6 @@ static ParseFunc funcs[] =
&(gimprc.show_tool_tips), NULL },
{ "dont-show-tool-tips", TT_BOOLEAN, NULL,
&(gimprc.show_tool_tips) },
{ "default-image-size", TT_POSITION,
&(gimprc.default_width), &(gimprc.default_height) },
{ "default-image-type", TT_IMAGETYPE,
&(gimprc.default_type), NULL },
{ "default-xresolution", TT_DOUBLE,
&(gimprc.default_xresolution), NULL },
{ "default-yresolution", TT_DOUBLE,
&(gimprc.default_yresolution), NULL },
{ "default-resolution-units", TT_XUNIT,
&(gimprc.default_resolution_units), NULL },
{ "default-comment", TT_XCOMMENT,
&(gimprc.default_comment), NULL },
{ "default-dot-for-dot", TT_BOOLEAN,
&(gimprc.default_dot_for_dot), NULL },
{ "plug-in", TT_XPLUGIN, NULL, NULL },
@ -393,12 +334,8 @@ static ParseFunc funcs[] =
&(gimprc.show_indicators) },
{ "no-global-paint-options", TT_BOOLEAN, NULL,
&(gimprc.global_paint_options) },
{ "module-load-inhibit", TT_PATH,
&(gimprc.module_db_load_inhibit), NULL },
{ "max-new-image-size", TT_MEMSIZE,
&(gimprc.max_new_image_size), NULL },
{ "thumbnail-mode", TT_INT,
&(gimprc.thumbnail_mode), NULL },
{ "trust-dirty-flag", TT_BOOLEAN,
&(gimprc.trust_dirty_flag), NULL },
{ "dont-trust-dirty-flag", TT_BOOLEAN, NULL,
@ -426,12 +363,12 @@ static gint n_funcs = (sizeof (funcs) /
sizeof (funcs[0]));
static ParseInfo parse_info = { NULL };
static ParseInfo parse_info = { NULL };
static GList *unknown_tokens = NULL;
static GList *unknown_tokens = NULL;
static gint cur_token;
static gint next_token;
static gint cur_token;
static gint next_token;
/* extern variables */
@ -472,13 +409,63 @@ gimprc_init (void)
static gint n_base_funcs = (sizeof (base_funcs) /
sizeof (base_funcs[0]));
static ParseFunc core_funcs[] =
{
{ "plug-in-path", TT_PATH, NULL, NULL },
{ "module-path", TT_PATH, NULL, NULL },
{ "brush-path", TT_PATH, NULL, NULL },
{ "pattern-path", TT_PATH, NULL, NULL },
{ "palette-path", TT_PATH, NULL, NULL },
{ "gradient-path", TT_PATH, NULL, NULL },
{ "default-brush", TT_STRING, NULL, NULL },
{ "default-pattern", TT_STRING, NULL, NULL },
{ "default-palette", TT_STRING, NULL, NULL },
{ "default-gradient", TT_STRING, NULL, NULL },
{ "default-comment", TT_STRING, NULL, NULL },
{ "default-image-type", TT_IMAGETYPE, NULL, NULL },
{ "default-image-size", TT_POSITION, NULL, NULL },
{ "default-units", TT_XUNIT, NULL, NULL },
{ "default-xresolution", TT_DOUBLE, NULL, NULL },
{ "default-yresolution", TT_DOUBLE, NULL, NULL },
{ "default-resolution-units", TT_XUNIT, NULL, NULL },
{ "undo-levels", TT_INT, NULL, NULL },
{ "pluginrc-path", TT_PATH, NULL, NULL },
{ "module-load-inhibit", TT_PATH, NULL, NULL },
{ "thumbnail-mode", TT_INT, NULL, NULL }
};
static gint n_core_funcs = (sizeof (core_funcs) /
sizeof (core_funcs[0]));
/* this hurts badly */
base_funcs[0].val1p = &base_config->temp_path;
base_funcs[1].val1p = &base_config->swap_path;
base_funcs[2].val1p = &base_config->tile_cache_size;
base_funcs[3].val1p = &base_config->stingy_memory_use;
base_funcs[4].val1p = &base_config->interpolation_type;
base_funcs[4].val1p = &base_config->num_processors;
base_funcs[0].val1p = &base_config->temp_path;
base_funcs[1].val1p = &base_config->swap_path;
base_funcs[2].val1p = &base_config->tile_cache_size;
base_funcs[3].val1p = &base_config->stingy_memory_use;
base_funcs[4].val1p = &base_config->interpolation_type;
base_funcs[4].val1p = &base_config->num_processors;
core_funcs[0].val1p = &core_config->plug_in_path;
core_funcs[1].val1p = &core_config->module_path;
core_funcs[2].val1p = &core_config->brush_path;
core_funcs[3].val1p = &core_config->pattern_path;
core_funcs[4].val1p = &core_config->palette_path;
core_funcs[5].val1p = &core_config->gradient_path;
core_funcs[6].val1p = &core_config->default_brush;
core_funcs[7].val1p = &core_config->default_pattern;
core_funcs[8].val1p = &core_config->default_palette;
core_funcs[9].val1p = &core_config->default_gradient;
core_funcs[10].val1p = &core_config->default_comment;
core_funcs[11].val1p = &core_config->default_type;
core_funcs[12].val1p = &core_config->default_width;
core_funcs[12].val2p = &core_config->default_height;
core_funcs[13].val1p = &core_config->default_units;
core_funcs[14].val1p = &core_config->default_xresolution;
core_funcs[15].val1p = &core_config->default_xresolution;
core_funcs[16].val1p = &core_config->default_resolution_units;
core_funcs[17].val1p = &core_config->levels_of_undo;
core_funcs[18].val1p = &core_config->pluginrc_path;
core_funcs[19].val1p = &core_config->module_db_load_inhibit;
core_funcs[20].val1p = &core_config->thumbnail_mode;
parse_func_hash = g_hash_table_new (g_str_hash, g_str_equal);
@ -487,6 +474,11 @@ gimprc_init (void)
base_funcs[i].name,
&base_funcs[i]);
for (i = 0; i < n_core_funcs; i++)
g_hash_table_insert (parse_func_hash,
core_funcs[i].name,
&core_funcs[i]);
for (i = 0; i < n_funcs; i++)
g_hash_table_insert (parse_func_hash,
funcs[i].name,
@ -527,7 +519,7 @@ parse_gimprc (void)
parse_add_directory_tokens ();
if (alternate_system_gimprc != NULL)
if (alternate_system_gimprc)
libfilename = g_strdup (alternate_system_gimprc);
else
libfilename = g_strdup (gimp_system_rc_file ());
@ -546,10 +538,10 @@ parse_gimprc (void)
g_free (filename);
g_free (libfilename);
if (!gimprc.image_title_format)
if (! gimprc.image_title_format)
gimprc.image_title_format = g_strdup (DEFAULT_IMAGE_TITLE_FORMAT);
if (!gimprc.default_comment)
gimprc.default_comment = g_strdup (DEFAULT_COMMENT);
if (! core_config->default_comment)
core_config->default_comment = g_strdup (DEFAULT_COMMENT);
}
gboolean
@ -558,7 +550,7 @@ parse_absolute_gimprc_file (char *filename)
gint status;
parse_info.fp = fopen (filename, "rt");
if (!parse_info.fp)
if (! parse_info.fp)
return FALSE;
if (be_verbose)
@ -592,10 +584,10 @@ parse_absolute_gimprc_file (char *filename)
gboolean
parse_gimprc_file (gchar *filename)
{
gchar *rfilename;
gboolean parsed;
gchar *rfilename;
gboolean parsed;
if (!g_path_is_absolute (filename))
if (! g_path_is_absolute (filename))
{
gchar *home_dir = g_get_home_dir ();
gchar *home_dir_sep;
@ -646,16 +638,17 @@ save_gimprc_strings (gchar *token,
gboolean found = FALSE;
gchar *personal_gimprc;
gchar *str;
UnknownToken *ut; /* variables to modify unknown_tokens */
UnknownToken *tmp;
GList *list;
g_assert (token != NULL);
g_assert (value != NULL);
/* get the name of the backup file, and the file pointers. 'name'
is reused in another context later, disregard it here */
* is reused in another context later, disregard it here
*/
personal_gimprc = gimp_personal_rc_file ("gimprc");
error_msg = open_backup_file (personal_gimprc,
gimp_system_rc_file (),
@ -674,10 +667,11 @@ save_gimprc_strings (gchar *token,
/* copy the old .gimprc into the new one, modifying it as needed */
prev_line = NULL;
cur_line = g_new (char, 1024);
while (!feof (fp_old))
cur_line = g_new (char, 1024);
while (! feof (fp_old))
{
if (!fgets (cur_line, 1024, fp_old))
if (! fgets (cur_line, 1024, fp_old))
continue;
/* special case: save lines starting with '#-' (added by GIMP) */
@ -693,11 +687,12 @@ save_gimprc_strings (gchar *token,
}
/* see if the line contains something that we can use
and place that into 'name' if its found */
* and place that into 'name' if its found
*/
if (find_token (cur_line, tokname, 50))
{
/* check if that entry should be updated */
if (!g_strcasecmp (token, tokname)) /* if they match */
if (! g_strcasecmp (token, tokname)) /* if they match */
{
if (prev_line == NULL)
{
@ -724,8 +719,8 @@ save_gimprc_strings (gchar *token,
g_free (str);
found = TRUE;
continue;
} /* end if token and name match */
} /* end if token is found */
}
}
/* all lines that did not match the tests above are simply copied */
if (prev_line != NULL)
@ -738,12 +733,13 @@ save_gimprc_strings (gchar *token,
} /* end of while(!feof) */
g_free (cur_line);
if (prev_line != NULL)
if (prev_line)
g_free (prev_line);
fclose (fp_old);
/* append the options that were not in the old .gimprc */
if (!found)
if (! found)
{
fprintf (fp_new, "#- Next line added %s\n",
timestamp);
@ -757,11 +753,9 @@ save_gimprc_strings (gchar *token,
ut->token = g_strdup (token);
ut->value = g_strdup (value);
list = unknown_tokens;
while (list)
for (list = unknown_tokens; list; list = g_list_next (list))
{
tmp = (UnknownToken *) list->data;
list = list->next;
if (strcmp (tmp->token, ut->token) == 0)
{
@ -771,6 +765,7 @@ save_gimprc_strings (gchar *token,
g_free (tmp);
}
}
unknown_tokens = g_list_append (unknown_tokens, ut);
fclose (fp_new);

View File

@ -24,24 +24,12 @@ typedef struct _GimpRc GimpRc;
/* global gimprc variables - need some comments on this stuff */
struct _GimpRc
{
gchar *plug_in_path;
gchar *brush_path;
gchar *default_brush;
gchar *pattern_path;
gchar *default_pattern;
gchar *palette_path;
gchar *default_palette;
gchar *gradient_path;
gchar *default_gradient;
gchar *pluginrc_path;
gchar *module_path;
gint marching_speed;
gint last_opened_size;
gdouble gamma_val;
gint transparency_type;
gboolean perfectmouse;
gint transparency_size;
gint levels_of_undo;
gint min_colors;
gboolean install_cmap;
gboolean cycled_marching_ants;
@ -51,16 +39,9 @@ struct _GimpRc
gint preview_size;
gint nav_preview_size;
gboolean show_rulers;
GimpUnit default_units;
gboolean show_statusbar;
gboolean auto_save;
gboolean confirm_on_close;
gint default_width, default_height;
gint default_type;
GimpUnit default_resolution_units;
gdouble default_xresolution;
gdouble default_yresolution;
gchar *default_comment;
gboolean default_dot_for_dot;
gboolean save_session_info;
gboolean save_device_status;
@ -73,10 +54,8 @@ struct _GimpRc
gboolean using_xserver_resolution;
gchar *image_title_format;
gboolean global_paint_options;
gchar *module_db_load_inhibit;
gboolean show_indicators;
guint max_new_image_size;
gint thumbnail_mode;
gboolean trust_dirty_flag;
gboolean use_help;
gboolean nav_window_per_display;

View File

@ -153,11 +153,11 @@ brush_select_new (gchar *title,
if (title)
{
bsp->context = gimp_context_new (the_gimp, title, NULL);
bsp->context = gimp_create_context (the_gimp, title, NULL);
}
else
{
bsp->context = gimp_context_get_user ();
bsp->context = gimp_get_user_context (the_gimp);
dialog_register (bsp->shell);
}
@ -175,11 +175,11 @@ brush_select_new (gchar *title,
}
else
{
active = gimp_context_get_brush (gimp_context_get_user ());
active = gimp_context_get_brush (gimp_get_user_context (the_gimp));
}
if (!active)
active = gimp_context_get_brush (gimp_context_get_standard (the_gimp));
active = gimp_context_get_brush (gimp_get_standard_context (the_gimp));
if (title)
{

View File

@ -25,6 +25,7 @@
#include "core/core-types.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
@ -37,6 +38,7 @@
#include "gdisplay.h"
#include "menus.h"
#include "app_procs.h"
#include "drawable.h"
#include "libgimp/gimpintl.h"
@ -314,7 +316,9 @@ new_channel_query_ok_callback (GtkWidget *widget,
channel_name,
&channel_color);
drawable_fill (GIMP_DRAWABLE (new_channel), TRANSPARENT_FILL);
drawable_fill (GIMP_DRAWABLE (new_channel),
gimp_get_user_context (the_gimp),
TRANSPARENT_FILL);
gimp_image_add_channel (gimage, new_channel, -1);
gdisplays_flush ();

View File

@ -30,12 +30,15 @@
#include "core/core-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "widgets/gimpdnd.h"
#include "color-area.h"
#include "color-notebook.h"
#include "app_procs.h"
#include "gdisplay.h"
#ifdef DISPLAY_FILTERS
@ -219,7 +222,7 @@ color_area_draw (void)
gdk_gc_set_foreground (mask_gc, &mask_pattern);
/* draw the background area */
gimp_context_get_background (gimp_context_get_user (), &color);
gimp_context_get_background (gimp_get_user_context (the_gimp), &color);
gimp_rgb_get_uchar (&color, &r, &g, &b);
color_area_draw_rect (color_area_pixmap, color_area_gc,
(width - rect_w), (height - rect_h), rect_w, rect_h,
@ -237,7 +240,7 @@ color_area_draw (void)
(width - rect_w), (height - rect_h), rect_w, rect_h);
/* draw the foreground area */
gimp_context_get_foreground (gimp_context_get_user (), &color);
gimp_context_get_foreground (gimp_get_user_context (the_gimp), &color);
gimp_rgb_get_uchar (&color, &r, &g, &b);
color_area_draw_rect (color_area_pixmap, color_area_gc,
0, 0, rect_w, rect_h,
@ -294,15 +297,19 @@ color_area_select_callback (ColorNotebook *color_notebook,
/* Fallthrough */
case COLOR_NOTEBOOK_UPDATE:
if (edit_color == FOREGROUND)
gimp_context_set_foreground (gimp_context_get_user (), color);
gimp_context_set_foreground (gimp_get_user_context (the_gimp),
color);
else
gimp_context_set_background (gimp_context_get_user (), color);
gimp_context_set_background (gimp_get_user_context (the_gimp),
color);
break;
case COLOR_NOTEBOOK_CANCEL:
color_notebook_hide (color_notebook);
color_notebook_active = FALSE;
gimp_context_set_foreground (gimp_context_get_user (), &revert_fg);
gimp_context_set_background (gimp_context_get_user (), &revert_bg);
gimp_context_set_foreground (gimp_get_user_context (the_gimp),
&revert_fg);
gimp_context_set_background (gimp_get_user_context (the_gimp),
&revert_bg);
}
}
}
@ -313,7 +320,7 @@ color_area_edit (void)
GimpContext *user_context;
GimpRGB color;
user_context = gimp_context_get_user ();
user_context = gimp_get_user_context (the_gimp);
if (! color_notebook_active)
{
@ -414,10 +421,10 @@ color_area_events (GtkWidget *widget,
}
break;
case SWAP_AREA:
gimp_context_swap_colors (gimp_context_get_user ());
gimp_context_swap_colors (gimp_get_user_context (the_gimp));
break;
case DEF_AREA:
gimp_context_set_default_colors (gimp_context_get_user ());
gimp_context_set_default_colors (gimp_get_user_context (the_gimp));
break;
default:
break;
@ -512,11 +519,11 @@ color_area_create (gint width,
GDK_ACTION_COPY);
gimp_dnd_color_dest_set (color_area, color_area_drop_color, NULL);
gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()),
gtk_signal_connect (GTK_OBJECT (gimp_get_user_context (the_gimp)),
"foreground_changed",
GTK_SIGNAL_FUNC (color_area_color_changed),
color_area);
gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()),
gtk_signal_connect (GTK_OBJECT (gimp_get_user_context (the_gimp)),
"background_changed",
GTK_SIGNAL_FUNC (color_area_color_changed),
color_area);
@ -539,9 +546,9 @@ color_area_drag_color (GtkWidget *widget,
gpointer data)
{
if (active_color == FOREGROUND)
gimp_context_get_foreground (gimp_context_get_user (), color);
gimp_context_get_foreground (gimp_get_user_context (the_gimp), color);
else
gimp_context_get_background (gimp_context_get_user (), color);
gimp_context_get_background (gimp_get_user_context (the_gimp), color);
}
static void
@ -557,9 +564,9 @@ color_area_drop_color (GtkWidget *widget,
else
{
if (active_color == FOREGROUND)
gimp_context_set_foreground (gimp_context_get_user (), color);
gimp_context_set_foreground (gimp_get_user_context (the_gimp), color);
else
gimp_context_set_background (gimp_context_get_user (), color);
gimp_context_set_background (gimp_get_user_context (the_gimp), color);
}
}

View File

@ -301,12 +301,13 @@ devices_init (void)
device_info->num_axes = gdk_info->num_axes;
device_info->axes = NULL;
device_info->context = gimp_context_new (the_gimp,
device_info->name, NULL);
device_info->context = gimp_create_context (the_gimp,
device_info->name, NULL);
gimp_context_define_args (device_info->context,
DEVICE_CONTEXT_MASK,
FALSE);
gimp_context_copy_args (gimp_context_get_user (), device_info->context,
gimp_context_copy_args (gimp_get_user_context (the_gimp),
device_info->context,
DEVICE_CONTEXT_MASK);
device_status_context_connect (device_info->context, device_info->device);
@ -331,7 +332,7 @@ devices_restore (void)
suppress_update = TRUE;
context = gimp_context_get_user ();
context = gimp_get_user_context (the_gimp);
gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK);
gimp_context_set_parent (device_info->context, context);
@ -389,12 +390,13 @@ devices_rc_update (gchar *name,
else
device_info->mode = GDK_MODE_DISABLED;
device_info->context = gimp_context_new (the_gimp,
device_info->name, NULL);
device_info->context = gimp_create_context (the_gimp,
device_info->name, NULL);
gimp_context_define_args (device_info->context,
DEVICE_CONTEXT_MASK,
FALSE);
gimp_context_copy_args (gimp_context_get_user (), device_info->context,
gimp_context_copy_args (gimp_get_user_context (the_gimp),
device_info->context,
DEVICE_CONTEXT_MASK);
device_status_context_connect (device_info->context, device_info->device);
@ -534,7 +536,7 @@ select_device (guint32 new_device)
current_device = new_device;
context = gimp_context_get_user ();
context = gimp_get_user_context (the_gimp);
gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK);
gimp_context_set_parent (device_info->context, context);

View File

@ -567,7 +567,8 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
gimage = gimp_context_get_image (context);
view = gimp_drawable_list_view_new
(gimage,
(gimprc.preview_size,
gimage,
GIMP_TYPE_LAYER,
"active_layer_changed",
(GimpGetContainerFunc) gimp_image_get_layers,
@ -602,7 +603,8 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
gimage = gimp_context_get_image (context);
view = gimp_drawable_list_view_new
(gimage,
(gimprc.preview_size,
gimage,
GIMP_TYPE_CHANNEL,
"active_channel_changed",
(GimpGetContainerFunc) gimp_image_get_channels,

View File

@ -20,9 +20,9 @@
#include <gtk/gtk.h>
#include "apptypes.h"
#include "widgets/widgets-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "widgets/gimpdialogfactory.h"
@ -88,25 +88,21 @@ static const gint n_dock_entries = (sizeof (dock_entries) /
/* public functions */
void
dialogs_init (void)
dialogs_init (Gimp *gimp)
{
gint i;
global_dialog_factory =
gimp_dialog_factory_new ("toplevel",
gimp_context_get_user (),
NULL,
NULL);
global_dialog_factory = gimp_dialog_factory_new ("toplevel",
gimp_get_user_context (gimp),
NULL,
NULL);
gtk_object_ref (GTK_OBJECT (global_dialog_factory));
gtk_object_sink (GTK_OBJECT (global_dialog_factory));
global_dock_factory =
gimp_dialog_factory_new ("dock",
gimp_context_get_user (),
menus_get_dialogs_factory (),
dialogs_dock_new);
global_dock_factory = gimp_dialog_factory_new ("dock",
gimp_get_user_context (gimp),
menus_get_dialogs_factory (),
dialogs_dock_new);
gtk_object_ref (GTK_OBJECT (global_dock_factory));
gtk_object_sink (GTK_OBJECT (global_dock_factory));
@ -128,7 +124,7 @@ dialogs_init (void)
}
void
dialogs_exit (void)
dialogs_exit (Gimp *gimp)
{
gtk_object_unref (GTK_OBJECT (global_dialog_factory));
gtk_object_unref (GTK_OBJECT (global_dock_factory));

View File

@ -24,8 +24,8 @@ extern GimpDialogFactory *global_dialog_factory;
extern GimpDialogFactory *global_dock_factory;
void dialogs_init (void);
void dialogs_exit (void);
void dialogs_init (Gimp *gimp);
void dialogs_exit (Gimp *gimp);
#endif /* __DIALOGS_H__ */

View File

@ -26,6 +26,7 @@
#include "core/core-types.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpimage-new.h"
#include "file-new-dialog.h"
@ -120,29 +121,30 @@ file_new_reset_callback (GtkWidget *widget,
gimp_chain_button_set_active
(GIMP_CHAIN_BUTTON (info->couple_resolutions),
ABS (gimprc.default_xresolution - gimprc.default_yresolution) < GIMP_MIN_RESOLUTION);
ABS (core_config->default_xresolution -
core_config->default_yresolution) < GIMP_MIN_RESOLUTION);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se),
0, gimprc.default_xresolution);
0, core_config->default_xresolution);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se),
1, gimprc.default_yresolution);
1, core_config->default_yresolution);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->resolution_se),
gimprc.default_resolution_units);
core_config->default_resolution_units);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (info->resolution_se), info);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se),
0, gimprc.default_xresolution, TRUE);
0, core_config->default_xresolution, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se),
1, gimprc.default_yresolution, TRUE);
1, core_config->default_yresolution, TRUE);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se),
0, gimprc.default_width);
0, core_config->default_width);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se),
1, gimprc.default_height);
1, core_config->default_height);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->size_se),
gimprc.default_units);
core_config->default_units);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->type_w[gimprc.default_type]),
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->type_w[core_config->default_type]),
TRUE);
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (info->fill_type_w[BACKGROUND_FILL]), TRUE);
@ -534,7 +536,8 @@ file_new_dialog_create (GimpImage *gimage)
gtk_widget_set_usize (spinbutton, 75, 0);
info->resolution_se =
gimp_size_entry_new (1, gimprc.default_resolution_units, _("pixels/%a"),
gimp_size_entry_new (1, core_config->default_resolution_units,
_("pixels/%a"),
FALSE, FALSE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gtk_table_set_col_spacing (GTK_TABLE (info->resolution_se), 1, 2);
@ -591,8 +594,10 @@ file_new_dialog_create (GimpImage *gimage)
gtk_widget_show (radio_box);
group = NULL;
list = g_list_first (gimp_image_new_get_base_type_names (the_gimp));
while (list)
for (list = gimp_image_new_get_base_type_names (the_gimp);
list;
list = g_list_next (list))
{
GimpImageBaseTypeName *name_info;
@ -613,8 +618,6 @@ file_new_dialog_create (GimpImage *gimage)
gtk_widget_show (button);
info->type_w[name_info->type] = button;
list = g_list_next (list);
}
/* frame for Fill Type */
@ -628,8 +631,10 @@ file_new_dialog_create (GimpImage *gimage)
gtk_widget_show (radio_box);
group = NULL;
list = g_list_first (gimp_image_new_get_fill_type_names (the_gimp));
while (list)
for (list = gimp_image_new_get_fill_type_names (the_gimp);
list;
list = g_list_next (list))
{
GimpFillTypeName *name_info;
@ -651,8 +656,6 @@ file_new_dialog_create (GimpImage *gimage)
gtk_widget_show (button);
info->fill_type_w[name_info->type] = button;
list = g_list_next (list);
}
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (info->size_se));

View File

@ -44,6 +44,7 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpimage.h"
#include "file-dialog-utils.h"
@ -54,7 +55,6 @@
#include "dialog_handler.h"
#include "docindex.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "file-open.h"
#include "file-utils.h"
#include "plug_in.h"
@ -245,7 +245,8 @@ file_open_with_proc_and_display (gchar *filename,
gchar *absolute;
gint status;
if ((gimage = file_open_image (filename,
if ((gimage = file_open_image (the_gimp,
filename,
raw_filename,
_("Open"),
file_proc,
@ -605,7 +606,7 @@ set_preview (const gchar *fullfname,
}
else
{
switch (gimprc.thumbnail_mode)
switch (core_config->thumbnail_mode)
{
case 0:
gtk_label_set_text (GTK_LABEL(open_options_label),
@ -717,7 +718,8 @@ file_open_genbutton_callback (GtkWidget *widget,
{ /* Is not directory. */
gint dummy;
gimage_to_be_thumbed = file_open_image (full_filename,
gimage_to_be_thumbed = file_open_image (the_gimp,
full_filename,
list->data,
NULL,
NULL,
@ -730,7 +732,7 @@ file_open_genbutton_callback (GtkWidget *widget,
RGBbuf = make_RGBbuf_from_tempbuf (tempbuf,
&RGBbuf_w,
&RGBbuf_h);
if (gimprc.thumbnail_mode)
if (core_config->thumbnail_mode)
{
file_save_thumbnail (gimage_to_be_thumbed,
full_filename, tempbuf);
@ -934,7 +936,8 @@ file_revert_confirm_callback (GtkWidget *widget,
filename = gimp_object_get_name (GIMP_OBJECT (old_gimage));
new_gimage = file_open_image (filename, filename,
new_gimage = file_open_image (old_gimage->gimp,
filename, filename,
_("Revert"),
NULL,
RUN_INTERACTIVE,

View File

@ -540,7 +540,7 @@ gradient_editor_new (void)
gradient_editor = g_new (GradientEditor, 1);
gradient_editor->context = gimp_context_new (the_gimp, NULL, NULL);
gradient_editor->context = gimp_create_context (the_gimp, NULL, NULL);
gtk_signal_connect (GTK_OBJECT (gradient_editor->context), "gradient_changed",
GTK_SIGNAL_FUNC (gradient_editor_gradient_changed),
@ -1409,7 +1409,7 @@ preview_set_foreground (GradientEditor *gradient_editor,
(gimp_context_get_gradient (gradient_editor->context),
xpos, &color);
gimp_context_set_foreground (gimp_context_get_user (), &color);
gimp_context_set_foreground (gimp_get_user_context (gradient_editor->context->gimp), &color);
str = g_strdup_printf (_("Foreground color set to RGB (%d, %d, %d) <-> "
"(%0.3f, %0.3f, %0.3f)"),
@ -1435,7 +1435,7 @@ preview_set_background (GradientEditor *gradient_editor,
(gimp_context_get_gradient (gradient_editor->context),
xpos, &color);
gimp_context_set_background (gimp_context_get_user (), &color);
gimp_context_set_background (gimp_get_user_context (gradient_editor->context->gimp), &color);
str = g_strdup_printf (_("Background color to RGB (%d, %d, %d) <-> "
"(%0.3f, %0.3f, %0.3f)"),
@ -2836,7 +2836,7 @@ cpopup_adjust_menus (GradientEditor *gradient_editor)
/* Render Foreground color boxes */
gimp_context_get_foreground (gimp_context_get_user (), &fg);
gimp_context_get_foreground (gimp_get_user_context (gradient_editor->context->gimp), &fg);
cpopup_render_color_box (GTK_PREVIEW (gradient_editor->left_load_color_boxes[2]),
&fg);
@ -3284,7 +3284,7 @@ cpopup_load_left_callback (GtkWidget *widget,
break;
case 2: /* Fetch from FG color */
gimp_context_get_foreground (gimp_context_get_user (), &fg);
gimp_context_get_foreground (gimp_get_user_context (gradient_editor->context->gimp), &fg);
cpopup_blend_endpoints (gradient_editor,
&fg,
&gradient_editor->control_sel_r->right_color,
@ -3350,7 +3350,7 @@ cpopup_load_right_callback (GtkWidget *widget,
break;
case 2: /* Fetch from FG color */
gimp_context_get_foreground (gimp_context_get_user (), &fg);
gimp_context_get_foreground (gimp_get_user_context (gradient_editor->context->gimp), &fg);
cpopup_blend_endpoints (gradient_editor,
&gradient_editor->control_sel_l->left_color,
&fg,

View File

@ -120,11 +120,11 @@ gradient_select_new (gchar *title,
if (title)
{
gsp->context = gimp_context_new (the_gimp, title, NULL);
gsp->context = gimp_create_context (the_gimp, title, NULL);
}
else
{
gsp->context = gimp_context_get_user ();
gsp->context = gimp_get_user_context (the_gimp);
dialog_register (gsp->shell);
}
@ -142,11 +142,11 @@ gradient_select_new (gchar *title,
}
else
{
active = gimp_context_get_gradient (gimp_context_get_user ());
active = gimp_context_get_gradient (gimp_get_user_context (the_gimp));
}
if (!active)
active = gimp_context_get_gradient (gimp_context_get_standard (the_gimp));
active = gimp_context_get_gradient (gimp_get_standard_context (the_gimp));
if (title)
gimp_context_set_gradient (gsp->context, active);

View File

@ -30,6 +30,7 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "widgets/gimpdialogfactory.h"
@ -66,13 +67,16 @@
/* local function prototypes */
static void gui_display_new (GimpImage *gimage);
static gint gui_rotate_the_shield_harmonics (GtkWidget *widget,
GdkEvent *eevent,
gpointer data);
static void gui_really_quit_callback (GtkWidget *button,
gboolean quit,
gpointer data);
static void gui_display_new (GimpImage *gimage);
static gint gui_rotate_the_shield_harmonics (GtkWidget *widget,
GdkEvent *eevent,
gpointer data);
static void gui_really_quit_callback (GtkWidget *button,
gboolean quit,
gpointer data);
static void gui_display_changed (GimpContext *context,
GDisplay *display,
gpointer data);
/* global variables */
@ -85,6 +89,13 @@ extern GSList *display_list; /* from gdisplay.c */
void
gui_init (Gimp *gimp)
{
gimp->create_display_func = gui_display_new;
gtk_signal_connect (GTK_OBJECT (gimp_get_user_context (gimp)),
"display_changed",
GTK_SIGNAL_FUNC (gui_display_changed),
NULL);
/* make sure the monitor resolution is valid */
if (gimprc.monitor_xres < GIMP_MIN_RESOLUTION ||
gimprc.monitor_yres < GIMP_MIN_RESOLUTION)
@ -101,7 +112,7 @@ gui_init (Gimp *gimp)
gximage_init ();
render_setup (gimprc.transparency_type, gimprc.transparency_size);
dialogs_init ();
dialogs_init (gimp);
devices_init ();
session_init ();
@ -141,12 +152,10 @@ gui_init (Gimp *gimp)
g_free (filenames);
}
gimp->create_display_func = gui_display_new;
}
void
gui_restore (void)
gui_restore (Gimp *gimp)
{
color_select_init ();
@ -155,7 +164,7 @@ gui_restore (void)
}
void
gui_post_init (void)
gui_post_init (Gimp *gimp)
{
if (gimprc.show_tips)
{
@ -164,7 +173,7 @@ gui_post_init (void)
}
void
gui_shutdown (void)
gui_shutdown (Gimp *gimp)
{
session_save ();
device_status_free ();
@ -176,13 +185,13 @@ gui_shutdown (void)
}
void
gui_exit (void)
gui_exit (Gimp *gimp)
{
menus_quit ();
gximage_free ();
render_free ();
dialogs_exit ();
dialogs_exit (gimp);
/* handle this in the dialog factory: */
document_index_free ();
@ -194,7 +203,7 @@ gui_exit (void)
}
void
gui_set_busy (void)
gui_set_busy (Gimp *gimp)
{
GDisplay *gdisp;
GSList *list;
@ -213,7 +222,7 @@ gui_set_busy (void)
}
void
gui_unset_busy (void)
gui_unset_busy (Gimp *gimp)
{
GDisplay *gdisp;
GSList *list;
@ -260,7 +269,7 @@ gui_display_new (GimpImage *gimage)
gdisp = gdisplay_new (gimage, 0x0101);
gimp_context_set_display (gimp_context_get_user (), gdisp);
gimp_context_set_display (gimp_get_user_context (gimage->gimp), gdisp);
if (double_speed)
gtk_signal_connect_after (GTK_OBJECT (gdisp->canvas), "expose_event",
@ -331,3 +340,11 @@ gui_really_quit_callback (GtkWidget *button,
menus_set_sensitive ("<Image>/File/Quit", TRUE);
}
}
static void
gui_display_changed (GimpContext *context,
GDisplay *display,
gpointer data)
{
gdisplay_set_menu_sensitivity (display);
}

Some files were not shown because too many files have changed in this diff Show More