add "use-gegl" property but don't serialize it.

2008-01-04  Michael Natterer  <mitch@gimp.org>

	* app/config/gimpcoreconfig.[ch]: add "use-gegl" property but
	don't serialize it.

	* app/widgets/gimptoolbox.c: add super ugly "Use GEGL" toggle to
	the toolbox so we don't need to have prefs open all the time when
	experimenting with gegl.

	* app/tools/gimpimagemaptool.[ch]: remove "Use GEGL" toggle from
	the tool dialogs and connect to the config property instead.

	* app/core/gimpdrawable-desaturate.c
	* app/core/gimpdrawable-invert.c: made them runtime-switchable by
	looking at the config property.


svn path=/trunk/; revision=24530
This commit is contained in:
Michael Natterer 2008-01-04 17:28:49 +00:00 committed by Michael Natterer
parent d1719638db
commit dd97e60591
8 changed files with 73 additions and 36 deletions

View File

@ -1,3 +1,19 @@
2008-01-04 Michael Natterer <mitch@gimp.org>
* app/config/gimpcoreconfig.[ch]: add "use-gegl" property but
don't serialize it.
* app/widgets/gimptoolbox.c: add super ugly "Use GEGL" toggle to
the toolbox so we don't need to have prefs open all the time when
experimenting with gegl.
* app/tools/gimpimagemaptool.[ch]: remove "Use GEGL" toggle from
the tool dialogs and connect to the config property instead.
* app/core/gimpdrawable-desaturate.c
* app/core/gimpdrawable-invert.c: made them runtime-switchable by
looking at the config property.
2008-01-04 Michael Natterer <mitch@gimp.org>
* app/gegl/Makefile.am

View File

@ -89,7 +89,8 @@ enum
PROP_MIN_COLORS,
PROP_COLOR_MANAGEMENT,
PROP_COLOR_PROFILE_POLICY,
PROP_SAVE_DOCUMENT_HISTORY
PROP_SAVE_DOCUMENT_HISTORY,
PROP_USE_GEGL
};
@ -358,6 +359,15 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
SAVE_DOCUMENT_HISTORY_BLURB,
TRUE,
GIMP_PARAM_STATIC_STRINGS);
/* not serialized */
g_object_class_install_property (object_class, PROP_USE_GEGL,
g_param_spec_boolean ("use-gegl",
"Use GEGL",
"Use GEGL",
TRUE,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
}
static void
@ -578,6 +588,9 @@ gimp_core_config_set_property (GObject *object,
case PROP_SAVE_DOCUMENT_HISTORY:
core_config->save_document_history = g_value_get_boolean (value);
break;
case PROP_USE_GEGL:
core_config->use_gegl = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -718,6 +731,9 @@ gimp_core_config_get_property (GObject *object,
case PROP_SAVE_DOCUMENT_HISTORY:
g_value_set_boolean (value, core_config->save_document_history);
break;
case PROP_USE_GEGL:
g_value_set_boolean (value, core_config->use_gegl);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);

View File

@ -81,6 +81,7 @@ struct _GimpCoreConfig
GimpColorConfig *color_management;
GimpColorProfilePolicy color_profile_policy;
gboolean save_document_history;
gboolean use_gegl;
};
struct _GimpCoreConfigClass

View File

@ -27,6 +27,11 @@
#include "base/pixel-processor.h"
#include "base/pixel-region.h"
/* temp */
#include "config/gimpcoreconfig.h"
#include "gimp.h"
#include "gimpimage.h"
#include "gimpdrawable.h"
#include "gimpdrawable-desaturate.h"
#include "gimpdrawable-operation.h"
@ -34,9 +39,6 @@
#include "gimp-intl.h"
static gboolean enable_gegl = TRUE;
static void desaturate_region_lightness (gpointer data,
PixelRegion *srcPR,
PixelRegion *destPR);
@ -58,7 +60,7 @@ gimp_drawable_desaturate (GimpDrawable *drawable,
g_return_if_fail (gimp_drawable_is_rgb (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
if (enable_gegl)
if (GIMP_ITEM (drawable)->image->gimp->config->use_gegl)
{
GeglNode *desaturate;

View File

@ -27,6 +27,11 @@
#include "base/pixel-processor.h"
#include "base/pixel-region.h"
/* temp */
#include "config/gimpcoreconfig.h"
#include "gimp.h"
#include "gimpimage.h"
#include "gimpdrawable.h"
#include "gimpdrawable-invert.h"
#include "gimpdrawable-operation.h"
@ -35,9 +40,6 @@
#include "gimp-intl.h"
static gboolean enable_gegl = TRUE;
void
gimp_drawable_invert (GimpDrawable *drawable,
GimpProgress *progress)
@ -46,7 +48,7 @@ gimp_drawable_invert (GimpDrawable *drawable,
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
if (enable_gegl)
if (GIMP_ITEM (drawable)->image->gimp->config->use_gegl)
{
GeglNode *invert;

View File

@ -30,6 +30,9 @@
#include "tools-types.h"
/* temp */
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
@ -104,7 +107,8 @@ static void gimp_image_map_tool_settings_dialog (GimpImageMapTool *im_tool,
static void gimp_image_map_tool_notify_preview (GObject *config,
GParamSpec *pspec,
GimpImageMapTool *im_tool);
static void gimp_image_map_tool_gegl_toggled (GtkWidget *toggle,
static void gimp_image_map_tool_gegl_notify (GObject *config,
const GParamSpec *pspec,
GimpImageMapTool *im_tool);
@ -251,23 +255,6 @@ gimp_image_map_tool_initialize (GimpTool *tool,
G_CALLBACK (gimp_image_map_tool_notify_preview),
image_map_tool, 0);
if (GIMP_IMAGE_MAP_TOOL_GET_CLASS (image_map_tool)->get_operation)
{
image_map_tool->use_gegl = TRUE;
toggle = gtk_check_button_new_with_label ("Use GEGL");
gtk_box_pack_end (GTK_BOX (image_map_tool->main_vbox), toggle,
FALSE, FALSE, 0);
gtk_widget_show (toggle);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
image_map_tool->use_gegl);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_image_map_tool_gegl_toggled),
image_map_tool);
}
if (klass->load_dialog_title)
{
image_map_tool->load_button =
@ -330,6 +317,11 @@ gimp_image_map_tool_initialize (GimpTool *tool,
gimp_image_map_tool_dialog (image_map_tool);
gtk_widget_show (vbox);
if (GIMP_IMAGE_MAP_TOOL_GET_CLASS (image_map_tool)->get_operation)
g_signal_connect_object (tool_info->gimp->config, "notify::use-gegl",
G_CALLBACK (gimp_image_map_tool_gegl_notify),
image_map_tool, 0);
}
drawable = gimp_image_get_active_drawable (display->image);
@ -444,18 +436,21 @@ gimp_image_map_tool_reset (GimpImageMapTool *tool)
static void
gimp_image_map_tool_create_map (GimpImageMapTool *tool)
{
GimpCoreConfig *config = GIMP_TOOL (tool)->tool_info->gimp->config;
if (tool->image_map)
{
gimp_image_map_clear (tool->image_map);
g_object_unref (tool->image_map);
}
if (tool->use_gegl && ! tool->operation)
if (config->use_gegl && ! tool->operation)
tool->operation = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->get_operation (tool);
tool->image_map = gimp_image_map_new (tool->drawable,
GIMP_TOOL (tool)->tool_info->blurb,
tool->use_gegl ? tool->operation : NULL);
config->use_gegl ?
tool->operation : NULL);
g_signal_connect (tool->image_map, "flush",
G_CALLBACK (gimp_image_map_tool_flush),
@ -844,11 +839,10 @@ gimp_image_map_tool_settings_dialog (GimpImageMapTool *tool,
}
static void
gimp_image_map_tool_gegl_toggled (GtkWidget *toggle,
GimpImageMapTool *im_tool)
gimp_image_map_tool_gegl_notify (GObject *config,
const GParamSpec *pspec,
GimpImageMapTool *im_tool)
{
im_tool->use_gegl = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle));
gimp_tool_control_set_preserve (GIMP_TOOL (im_tool)->control, TRUE);
gimp_image_map_tool_create_map (im_tool);

View File

@ -55,9 +55,6 @@ struct _GimpImageMapTool
/* settings file dialog */
GtkWidget *settings_dialog;
/* temp hack */
gboolean use_gegl;
};
struct _GimpImageMapToolClass

View File

@ -286,6 +286,15 @@ gimp_toolbox_constructor (GType type,
G_CALLBACK (toolbox_area_notify),
toolbox->image_area, 0);
{
GtkWidget *button;
button = gimp_prop_check_button_new (G_OBJECT (config), "use-gegl",
"Use GEGL");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
}
g_signal_connect_object (context, "tool-changed",
G_CALLBACK (toolbox_tool_changed),
toolbox->tool_wbox,