app/config/gimpcoreconfig.[ch] added boolean properties "global-brush",

2004-03-04  Michael Natterer  <mitch@gimp.org>

	* app/config/gimpcoreconfig.[ch]
	* app/config/gimprc-blurbs.h: added boolean properties
	"global-brush", "global-pattern" etc.

	* app/gui/preferences-dialog.c: added GUI for them to the
	"Tool Options" page.

	* app/tools/tool_manager.c (tool_manager_tool_changed): honor the
	new prefs options when copying the new tool's properties.
	Fixed bug #122519.
This commit is contained in:
Michael Natterer 2004-03-04 14:04:22 +00:00 committed by Michael Natterer
parent e56625e421
commit ba265516a1
7 changed files with 145 additions and 1 deletions

View file

@ -1,3 +1,16 @@
2004-03-04 Michael Natterer <mitch@gimp.org>
* app/config/gimpcoreconfig.[ch]
* app/config/gimprc-blurbs.h: added boolean properties
"global-brush", "global-pattern" etc.
* app/gui/preferences-dialog.c: added GUI for them to the
"Tool Options" page.
* app/tools/tool_manager.c (tool_manager_tool_changed): honor the
new prefs options when copying the new tool's properties.
Fixed bug #122519.
2004-03-04 Michael Natterer <mitch@gimp.org>
* app/core/gimptoolinfo.c: minor cleanup.

View file

@ -90,6 +90,11 @@ enum
PROP_DEFAULT_PALETTE,
PROP_DEFAULT_GRADIENT,
PROP_DEFAULT_FONT,
PROP_GLOBAL_BRUSH,
PROP_GLOBAL_PATTERN,
PROP_GLOBAL_PALETTE,
PROP_GLOBAL_GRADIENT,
PROP_GLOBAL_FONT,
PROP_DEFAULT_IMAGE,
PROP_DEFAULT_GRID,
PROP_UNDO_LEVELS,
@ -242,6 +247,26 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
"default-font", DEFAULT_FONT_BLURB,
DEFAULT_FONT,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_GLOBAL_BRUSH,
"global-brush", GLOBAL_BRUSH_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_GLOBAL_PATTERN,
"global-pattern", GLOBAL_PATTERN_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_GLOBAL_PALETTE,
"global-palette", GLOBAL_PALETTE_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_GLOBAL_GRADIENT,
"global-gradient", GLOBAL_GRADIENT_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_GLOBAL_FONT,
"global-font", GLOBAL_FONT_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_DEFAULT_IMAGE,
"default-image", DEFAULT_IMAGE_BLURB,
GIMP_TYPE_TEMPLATE,
@ -423,6 +448,21 @@ gimp_core_config_set_property (GObject *object,
g_free (core_config->default_font);
core_config->default_font = g_value_dup_string (value);
break;
case PROP_GLOBAL_BRUSH:
core_config->global_brush = g_value_get_boolean (value);
break;
case PROP_GLOBAL_PATTERN:
core_config->global_pattern = g_value_get_boolean (value);
break;
case PROP_GLOBAL_PALETTE:
core_config->global_palette = g_value_get_boolean (value);
break;
case PROP_GLOBAL_GRADIENT:
core_config->global_gradient = g_value_get_boolean (value);
break;
case PROP_GLOBAL_FONT:
core_config->global_font = g_value_get_boolean (value);
break;
case PROP_DEFAULT_IMAGE:
if (g_value_get_object (value))
gimp_config_sync (GIMP_CONFIG (g_value_get_object (value)),
@ -532,6 +572,21 @@ gimp_core_config_get_property (GObject *object,
case PROP_DEFAULT_FONT:
g_value_set_string (value, core_config->default_font);
break;
case PROP_GLOBAL_BRUSH:
g_value_set_boolean (value, core_config->global_brush);
break;
case PROP_GLOBAL_PATTERN:
g_value_set_boolean (value, core_config->global_pattern);
break;
case PROP_GLOBAL_PALETTE:
g_value_set_boolean (value, core_config->global_palette);
break;
case PROP_GLOBAL_GRADIENT:
g_value_set_boolean (value, core_config->global_gradient);
break;
case PROP_GLOBAL_FONT:
g_value_set_boolean (value, core_config->global_font);
break;
case PROP_DEFAULT_IMAGE:
g_value_set_object (value, core_config->default_image);
break;

View file

@ -59,6 +59,11 @@ struct _GimpCoreConfig
gchar *default_palette;
gchar *default_gradient;
gchar *default_font;
gboolean global_brush;
gboolean global_pattern;
gboolean global_palette;
gboolean global_gradient;
gboolean global_font;
GimpTemplate *default_image;
GimpGrid *default_grid;
gint levels_of_undo;

View file

@ -114,6 +114,21 @@ N_("The window type hint that is set on dock windows. This may affect " \
#define GIMPRESSIONIST_PATH_BLURB \
"Where to search for data used by the Gimpressionist plug-in."
#define GLOBAL_BRUSH_BLURB \
"When enabled, the selected brush will be used for all tools."
#define GLOBAL_PATTERN_BLURB \
"When enabled, the selected pattern will be used for all tools."
#define GLOBAL_PALETTE_BLURB \
"When enabled, the selected palette will be used for all tools."
#define GLOBAL_GRADIENT_BLURB \
"When enabled, the selected gradient will be used for all tools."
#define GLOBAL_FONT_BLURB \
"When enabled, the selected font will be used for all tools."
#define GRADIENT_PATH_BLURB \
"Sets the gradient search path."

View file

@ -1377,6 +1377,26 @@ prefs_dialog_new (Gimp *gimp,
_("Default _Interpolation:"),
GTK_TABLE (table), 0);
/* Global Brush, Pattern, ... */
vbox2 = prefs_frame_new (_("Paint Options Shared Between Tools"),
GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (object, "global-brush",
_("_Brush"),
GTK_BOX (vbox2));
prefs_check_button_add (object, "global-pattern",
_("_Pattern"),
GTK_BOX (vbox2));
prefs_check_button_add (object, "global-palette",
_("Pa_lette"),
GTK_BOX (vbox2));
prefs_check_button_add (object, "global-gradient",
_("_Gradient"),
GTK_BOX (vbox2));
prefs_check_button_add (object, "global-font",
_("_Font"),
GTK_BOX (vbox2));
/*******************************/
/* Interface / Input Devices */

View file

@ -1377,6 +1377,26 @@ prefs_dialog_new (Gimp *gimp,
_("Default _Interpolation:"),
GTK_TABLE (table), 0);
/* Global Brush, Pattern, ... */
vbox2 = prefs_frame_new (_("Paint Options Shared Between Tools"),
GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (object, "global-brush",
_("_Brush"),
GTK_BOX (vbox2));
prefs_check_button_add (object, "global-pattern",
_("_Pattern"),
GTK_BOX (vbox2));
prefs_check_button_add (object, "global-palette",
_("Pa_lette"),
GTK_BOX (vbox2));
prefs_check_button_add (object, "global-gradient",
_("_Gradient"),
GTK_BOX (vbox2));
prefs_check_button_add (object, "global-font",
_("_Font"),
GTK_BOX (vbox2));
/*******************************/
/* Interface / Input Devices */

View file

@ -31,6 +31,8 @@
#include "core/gimpimage.h"
#include "core/gimptoolinfo.h"
#include "config/gimpcoreconfig.h"
#include "display/gimpdisplay.h"
#include "gimpdrawtool.h"
@ -513,9 +515,23 @@ tool_manager_tool_changed (GimpContext *user_context,
/* connect the new tool's context */
if (tool_info->context_props)
{
GimpCoreConfig *config = user_context->gimp->config;
GimpContextPropMask global_props = 0;
if (config->global_brush)
global_props |= GIMP_CONTEXT_BRUSH_MASK;
if (config->global_pattern)
global_props |= GIMP_CONTEXT_PATTERN_MASK;
if (config->global_palette)
global_props |= GIMP_CONTEXT_PALETTE_MASK;
if (config->global_gradient)
global_props |= GIMP_CONTEXT_GRADIENT_MASK;
if (config->global_font)
global_props |= GIMP_CONTEXT_FONT_MASK;
gimp_context_copy_properties (GIMP_CONTEXT (tool_info->tool_options),
user_context,
tool_info->context_props);
tool_info->context_props & ~global_props);
gimp_context_set_parent (GIMP_CONTEXT (tool_info->tool_options),
user_context);
}