mirror of https://github.com/GNOME/gimp.git
keep a "default_config" object around and use it to reset the tool if it
2008-09-30 Michael Natterer <mitch@gimp.org> * app/tools/gimpimagemaptool.[ch]: keep a "default_config" object around and use it to reset the tool if it exists. (gimp_image_map_tool_edit_as): set the default_config on the new tool so "reset" goes back to the values the tool was started with. * app/tools/gimpcolorbalencetool.c (gimp_color_balance_tool_reset) * app/tools/gimpcurvestool.c (gimp_curves_tool_reset) * app/tools/gimphuesaturationtool.c (gimp_hue_saturation_tool_reset) * app/tools/gimplevelstool.c (gimp_levels_tool_reset): use the default config to reset the tool here too if it exists. svn path=/trunk/; revision=27090
This commit is contained in:
parent
baea3223f1
commit
52c61f6b5f
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2008-09-30 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/gimpimagemaptool.[ch]: keep a "default_config" object
|
||||
around and use it to reset the tool if it exists.
|
||||
|
||||
(gimp_image_map_tool_edit_as): set the default_config on the new
|
||||
tool so "reset" goes back to the values the tool was started with.
|
||||
|
||||
* app/tools/gimpcolorbalencetool.c (gimp_color_balance_tool_reset)
|
||||
* app/tools/gimpcurvestool.c (gimp_curves_tool_reset)
|
||||
* app/tools/gimphuesaturationtool.c (gimp_hue_saturation_tool_reset)
|
||||
* app/tools/gimplevelstool.c (gimp_levels_tool_reset): use the
|
||||
default config to reset the tool here too if it exists.
|
||||
|
||||
2008-09-30 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/gui/splash.c: don't make the upper label bold. This change
|
||||
|
|
|
@ -349,14 +349,24 @@ gimp_color_balance_tool_reset (GimpImageMapTool *im_tool)
|
|||
GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (im_tool);
|
||||
GimpTransferMode range = cb_tool->config->range;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (cb_tool->config));
|
||||
g_object_freeze_notify (im_tool->config);
|
||||
|
||||
if (im_tool->default_config)
|
||||
{
|
||||
gimp_config_copy (GIMP_CONFIG (im_tool->default_config),
|
||||
GIMP_CONFIG (im_tool->config),
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_config_reset (GIMP_CONFIG (im_tool->config));
|
||||
}
|
||||
|
||||
gimp_config_reset (GIMP_CONFIG (cb_tool->config));
|
||||
g_object_set (cb_tool->config,
|
||||
"range", range,
|
||||
NULL);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (cb_tool->config));
|
||||
g_object_thaw_notify (im_tool->config);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -566,14 +566,36 @@ static void
|
|||
gimp_curves_tool_reset (GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
|
||||
GimpCurvesConfig *default_config;
|
||||
GimpHistogramChannel channel;
|
||||
|
||||
default_config = GIMP_CURVES_CONFIG (image_map_tool->default_config);
|
||||
|
||||
for (channel = GIMP_HISTOGRAM_VALUE;
|
||||
channel <= GIMP_HISTOGRAM_ALPHA;
|
||||
channel++)
|
||||
{
|
||||
if (default_config)
|
||||
{
|
||||
GimpCurveType curve_type = tool->config->curve[channel]->curve_type;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (tool->config->curve[channel]));
|
||||
|
||||
gimp_config_copy (GIMP_CONFIG (default_config->curve[channel]),
|
||||
GIMP_CONFIG (tool->config->curve[channel]),
|
||||
0);
|
||||
|
||||
g_object_set (tool->config->curve[channel],
|
||||
"curve-type", curve_type,
|
||||
NULL);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (tool->config->curve[channel]));
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_curve_reset (tool->config->curve[channel], FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -464,14 +464,24 @@ gimp_hue_saturation_tool_reset (GimpImageMapTool *image_map_tool)
|
|||
GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (image_map_tool);
|
||||
GimpHueRange range = hs_tool->config->range;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (hs_tool->config));
|
||||
g_object_freeze_notify (image_map_tool->config);
|
||||
|
||||
if (image_map_tool->default_config)
|
||||
{
|
||||
gimp_config_copy (GIMP_CONFIG (image_map_tool->default_config),
|
||||
GIMP_CONFIG (image_map_tool->config),
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_config_reset (GIMP_CONFIG (image_map_tool->config));
|
||||
}
|
||||
|
||||
gimp_config_reset (GIMP_CONFIG (hs_tool->config));
|
||||
g_object_set (hs_tool->config,
|
||||
"range", range,
|
||||
NULL);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (hs_tool->config));
|
||||
g_object_thaw_notify (image_map_tool->config);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -193,6 +193,7 @@ gimp_image_map_tool_init (GimpImageMapTool *image_map_tool)
|
|||
image_map_tool->drawable = NULL;
|
||||
image_map_tool->operation = NULL;
|
||||
image_map_tool->config = NULL;
|
||||
image_map_tool->default_config = NULL;
|
||||
image_map_tool->image_map = NULL;
|
||||
|
||||
image_map_tool->shell = NULL;
|
||||
|
@ -239,6 +240,12 @@ gimp_image_map_tool_finalize (GObject *object)
|
|||
image_map_tool->config = NULL;
|
||||
}
|
||||
|
||||
if (image_map_tool->default_config)
|
||||
{
|
||||
g_object_unref (image_map_tool->default_config);
|
||||
image_map_tool->default_config = NULL;
|
||||
}
|
||||
|
||||
if (image_map_tool->shell)
|
||||
{
|
||||
gtk_widget_destroy (image_map_tool->shell);
|
||||
|
@ -466,9 +473,18 @@ gimp_image_map_tool_reset (GimpImageMapTool *tool)
|
|||
GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->reset (tool);
|
||||
}
|
||||
else if (tool->config)
|
||||
{
|
||||
if (tool->default_config)
|
||||
{
|
||||
gimp_config_copy (GIMP_CONFIG (tool->default_config),
|
||||
GIMP_CONFIG (tool->config),
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_config_reset (GIMP_CONFIG (tool->config));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -674,9 +690,9 @@ gimp_image_map_tool_edit_as (GimpImageMapTool *im_tool,
|
|||
|
||||
new_tool = tool_manager_get_active (display->gimp);
|
||||
|
||||
gimp_config_copy (config,
|
||||
GIMP_CONFIG (GIMP_IMAGE_MAP_TOOL (new_tool)->config),
|
||||
0);
|
||||
GIMP_IMAGE_MAP_TOOL (new_tool)->default_config = g_object_ref (config);
|
||||
|
||||
gimp_image_map_tool_reset (GIMP_IMAGE_MAP_TOOL (new_tool));
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
|
|
@ -43,6 +43,7 @@ struct _GimpImageMapTool
|
|||
|
||||
GeglNode *operation;
|
||||
GObject *config;
|
||||
GObject *default_config;
|
||||
GimpImageMapApplyFunc apply_func;
|
||||
gpointer apply_data;
|
||||
|
||||
|
|
|
@ -698,14 +698,24 @@ gimp_levels_tool_reset (GimpImageMapTool *image_map_tool)
|
|||
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
|
||||
GimpHistogramChannel channel = tool->config->channel;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (tool->config));
|
||||
g_object_freeze_notify (image_map_tool->config);
|
||||
|
||||
if (image_map_tool->default_config)
|
||||
{
|
||||
gimp_config_copy (GIMP_CONFIG (image_map_tool->default_config),
|
||||
GIMP_CONFIG (image_map_tool->config),
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_config_reset (GIMP_CONFIG (image_map_tool->config));
|
||||
}
|
||||
|
||||
gimp_config_reset (GIMP_CONFIG (tool->config));
|
||||
g_object_set (tool->config,
|
||||
"channel", channel,
|
||||
NULL);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (tool->config));
|
||||
g_object_thaw_notify (image_map_tool->config);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in New Issue