mirror of https://github.com/GNOME/gimp.git
Keep track of the current image and manage a subscription to
2008-05-09 Martin Nordholts <martinn@svn.gnome.org> * app/tools/gimpcroptool.[ch]: Keep track of the current image and manage a subscription to "size-changed" so that default aspect ratio is properly updated. (gimp_crop_tool_execute): No need to explicitly call gimp_crop_tool_update_option_defaults() any longer. svn path=/trunk/; revision=25598
This commit is contained in:
parent
168935ec10
commit
0a27fd37fa
|
@ -1,3 +1,11 @@
|
||||||
|
2008-05-09 Martin Nordholts <martinn@svn.gnome.org>
|
||||||
|
|
||||||
|
* app/tools/gimpcroptool.[ch]: Keep track of the current image and
|
||||||
|
manage a subscription to "size-changed" so that default aspect
|
||||||
|
ratio is properly updated.
|
||||||
|
(gimp_crop_tool_execute): No need to explicitly call
|
||||||
|
gimp_crop_tool_update_option_defaults() any longer.
|
||||||
|
|
||||||
2008-05-09 Simon Budig <simon@gimp.org>
|
2008-05-09 Simon Budig <simon@gimp.org>
|
||||||
|
|
||||||
* app/core/gimpscanconvert.[ch]: expose the internal most
|
* app/core/gimpscanconvert.[ch]: expose the internal most
|
||||||
|
|
|
@ -87,6 +87,7 @@ static void gimp_crop_tool_options_notify (GimpCropOptions
|
||||||
static void gimp_crop_tool_image_changed (GimpCropTool *crop_tool,
|
static void gimp_crop_tool_image_changed (GimpCropTool *crop_tool,
|
||||||
GimpImage *image,
|
GimpImage *image,
|
||||||
GimpContext *context);
|
GimpContext *context);
|
||||||
|
static void gimp_crop_tool_image_size_changed (GimpCropTool *crop_tool);
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GimpCropTool, gimp_crop_tool, GIMP_TYPE_DRAW_TOOL,
|
G_DEFINE_TYPE_WITH_CODE (GimpCropTool, gimp_crop_tool, GIMP_TYPE_DRAW_TOOL,
|
||||||
|
@ -155,6 +156,8 @@ gimp_crop_tool_init (GimpCropTool *crop_tool)
|
||||||
|
|
||||||
gimp_tool_control_set_wants_click (tool->control, TRUE);
|
gimp_tool_control_set_wants_click (tool->control, TRUE);
|
||||||
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_CROP);
|
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_CROP);
|
||||||
|
|
||||||
|
crop_tool->current_image = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GObject *
|
static GObject *
|
||||||
|
@ -186,6 +189,13 @@ gimp_crop_tool_constructor (GType type,
|
||||||
crop_tool,
|
crop_tool,
|
||||||
G_CONNECT_SWAPPED);
|
G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
|
/* Make sure we are connected to "size-changed" for the initial
|
||||||
|
* image.
|
||||||
|
*/
|
||||||
|
gimp_crop_tool_image_changed (crop_tool,
|
||||||
|
gimp_context_get_image (gimp_context),
|
||||||
|
gimp_context);
|
||||||
|
|
||||||
|
|
||||||
options = GIMP_CROP_TOOL_GET_OPTIONS (object);
|
options = GIMP_CROP_TOOL_GET_OPTIONS (object);
|
||||||
|
|
||||||
|
@ -303,9 +313,6 @@ gimp_crop_tool_execute (GimpRectangleTool *rectangle,
|
||||||
|
|
||||||
gimp_image_flush (image);
|
gimp_image_flush (image);
|
||||||
|
|
||||||
gimp_crop_tool_update_option_defaults (GIMP_CROP_TOOL (tool),
|
|
||||||
TRUE);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,6 +405,30 @@ gimp_crop_tool_image_changed (GimpCropTool *crop_tool,
|
||||||
GimpImage *image,
|
GimpImage *image,
|
||||||
GimpContext *context)
|
GimpContext *context)
|
||||||
{
|
{
|
||||||
|
if (crop_tool->current_image)
|
||||||
|
{
|
||||||
|
g_signal_handlers_disconnect_by_func (crop_tool->current_image,
|
||||||
|
gimp_crop_tool_image_size_changed,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (image)
|
||||||
|
{
|
||||||
|
g_signal_connect_object (image, "size-changed",
|
||||||
|
G_CALLBACK (gimp_crop_tool_image_size_changed),
|
||||||
|
crop_tool,
|
||||||
|
G_CONNECT_SWAPPED);
|
||||||
|
}
|
||||||
|
|
||||||
|
crop_tool->current_image = image;
|
||||||
|
|
||||||
gimp_crop_tool_update_option_defaults (GIMP_CROP_TOOL (crop_tool),
|
gimp_crop_tool_update_option_defaults (GIMP_CROP_TOOL (crop_tool),
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_crop_tool_image_size_changed (GimpCropTool *crop_tool)
|
||||||
|
{
|
||||||
|
gimp_crop_tool_update_option_defaults (crop_tool,
|
||||||
|
FALSE);
|
||||||
|
}
|
||||||
|
|
|
@ -39,6 +39,8 @@ typedef struct _GimpCropToolClass GimpCropToolClass;
|
||||||
struct _GimpCropTool
|
struct _GimpCropTool
|
||||||
{
|
{
|
||||||
GimpDrawTool parent_instance;
|
GimpDrawTool parent_instance;
|
||||||
|
|
||||||
|
GimpImage *current_image;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GimpCropToolClass
|
struct _GimpCropToolClass
|
||||||
|
|
Loading…
Reference in New Issue