mirror of https://github.com/GNOME/gimp.git
New function to update default values for Fixed: Size. This function is
2007-09-02 Martin Nordholts <martinn@svn.gnome.org> * app/tools/gimprectangleselecttool.c (gimp_rect_select_tool_update_option_defaults): New function to update default values for Fixed: Size. This function is called to update defaults values for Fixed: Size to that of the pending rectangle width x height if there is one, or 100x100 otherwise. * app/tools/gimpcroptool.c (gimp_crop_tool_update_option_defaults): Set Fixed: Size to the size of the pending crop rectangle, or 100x100 if there is none. svn path=/trunk/; revision=23440
This commit is contained in:
parent
54f299f06c
commit
ce21737d37
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2007-09-02 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
* app/tools/gimprectangleselecttool.c
|
||||
(gimp_rect_select_tool_update_option_defaults): New function to
|
||||
update default values for Fixed: Size. This function is called to
|
||||
update defaults values for Fixed: Size to that of the pending
|
||||
rectangle width x height if there is one, or 100x100 otherwise.
|
||||
|
||||
* app/tools/gimpcroptool.c
|
||||
(gimp_crop_tool_update_option_defaults): Set Fixed: Size to the
|
||||
size of the pending crop rectangle, or 100x100 if there is none.
|
||||
|
||||
2007-09-01 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
* app/tools/gimpcroptool.c
|
||||
|
|
|
@ -78,7 +78,7 @@ static gboolean gimp_crop_tool_execute (GimpRectangleTool *rectang
|
|||
gint w,
|
||||
gint h);
|
||||
|
||||
static void gimp_crop_tool_update_default_fixed_ratio_options
|
||||
static void gimp_crop_tool_update_option_defaults
|
||||
(GimpCropTool *crop_tool,
|
||||
gboolean ignore_pending);
|
||||
|
||||
|
@ -194,7 +194,7 @@ gimp_crop_tool_constructor (GType type,
|
|||
GIMP_RECTANGLE_CONSTRAIN_DRAWABLE :
|
||||
GIMP_RECTANGLE_CONSTRAIN_IMAGE);
|
||||
|
||||
gimp_crop_tool_update_default_fixed_ratio_options (GIMP_CROP_TOOL (object),
|
||||
gimp_crop_tool_update_option_defaults (GIMP_CROP_TOOL (object),
|
||||
FALSE);
|
||||
|
||||
return object;
|
||||
|
@ -240,7 +240,7 @@ gimp_crop_tool_button_release (GimpTool *tool,
|
|||
release_type,
|
||||
display);
|
||||
|
||||
gimp_crop_tool_update_default_fixed_ratio_options (GIMP_CROP_TOOL (tool),
|
||||
gimp_crop_tool_update_option_defaults (GIMP_CROP_TOOL (tool),
|
||||
FALSE);
|
||||
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ gimp_crop_tool_execute (GimpRectangleTool *rectangle,
|
|||
|
||||
gimp_image_flush (image);
|
||||
|
||||
gimp_crop_tool_update_default_fixed_ratio_options (GIMP_CROP_TOOL (tool),
|
||||
gimp_crop_tool_update_option_defaults (GIMP_CROP_TOOL (tool),
|
||||
TRUE);
|
||||
|
||||
return TRUE;
|
||||
|
@ -335,15 +335,15 @@ gimp_crop_tool_execute (GimpRectangleTool *rectangle,
|
|||
}
|
||||
|
||||
/**
|
||||
* gimp_crop_tool_update_default_fixed_ratio_options:
|
||||
* gimp_crop_tool_update_option_defaults:
|
||||
* @crop_tool:
|
||||
* @ignore_pending: %TRUE to ignore any pending crop rectangle.
|
||||
*
|
||||
* Sets the default aspect numerator/denominator to that of the current
|
||||
* layer/image/pending crop rectangle.
|
||||
* Sets the default Fixed: Aspect ratio and Fixed: Size option
|
||||
* properties.
|
||||
*/
|
||||
static void
|
||||
gimp_crop_tool_update_default_fixed_ratio_options (GimpCropTool *crop_tool,
|
||||
gimp_crop_tool_update_option_defaults (GimpCropTool *crop_tool,
|
||||
gboolean ignore_pending)
|
||||
{
|
||||
GimpTool *tool;
|
||||
|
@ -356,17 +356,37 @@ gimp_crop_tool_update_default_fixed_ratio_options (GimpCropTool *crop_tool,
|
|||
|
||||
if (tool->display != NULL && !ignore_pending)
|
||||
{
|
||||
/* There is a pending rectangle and we should not ignore it, so
|
||||
* set default Fixed: Aspect ratio and Fixed: Size to the same
|
||||
* as the current pending rectangle width/height.
|
||||
*/
|
||||
|
||||
gimp_rectangle_tool_pending_size_set (rectangle_tool,
|
||||
G_OBJECT (rectangle_options),
|
||||
"default-aspect-numerator",
|
||||
"default-aspect-denominator");
|
||||
|
||||
gimp_rectangle_tool_pending_size_set (rectangle_tool,
|
||||
G_OBJECT (rectangle_options),
|
||||
"default-fixed-size-width",
|
||||
"default-fixed-size-height");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* There is no pending rectangle, set default Fixed: Aspect
|
||||
* ratio to that of the current image/layer, and the size to
|
||||
* 100x100.
|
||||
*/
|
||||
|
||||
gimp_rectangle_tool_constraint_size_set (rectangle_tool,
|
||||
G_OBJECT (rectangle_options),
|
||||
"default-aspect-numerator",
|
||||
"default-aspect-denominator");
|
||||
|
||||
g_object_set (G_OBJECT (rectangle_options),
|
||||
"default-fixed-size-width", 100.0,
|
||||
"default-fixed-size-height", 100.0,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -380,7 +400,7 @@ gimp_crop_tool_notify_layer_only (GimpCropOptions *options,
|
|||
GIMP_RECTANGLE_CONSTRAIN_DRAWABLE :
|
||||
GIMP_RECTANGLE_CONSTRAIN_IMAGE);
|
||||
|
||||
gimp_crop_tool_update_default_fixed_ratio_options (GIMP_CROP_TOOL (tool),
|
||||
gimp_crop_tool_update_option_defaults (GIMP_CROP_TOOL (tool),
|
||||
FALSE);
|
||||
}
|
||||
|
||||
|
@ -389,6 +409,6 @@ gimp_crop_tool_image_changed (GimpContext *gimp_context,
|
|||
GimpImage *image,
|
||||
GimpCropTool *crop_tool)
|
||||
{
|
||||
gimp_crop_tool_update_default_fixed_ratio_options (GIMP_CROP_TOOL (crop_tool),
|
||||
gimp_crop_tool_update_option_defaults (GIMP_CROP_TOOL (crop_tool),
|
||||
FALSE);
|
||||
}
|
||||
|
|
|
@ -112,6 +112,9 @@ static void gimp_rect_select_tool_real_select (GimpRectSelectTool *r
|
|||
gint y,
|
||||
gint w,
|
||||
gint h);
|
||||
static void gimp_rect_select_tool_update_option_defaults
|
||||
(GimpRectSelectTool *rect_select_tool,
|
||||
gboolean ignore_pending);
|
||||
|
||||
static void gimp_rect_select_tool_round_corners_notify (GimpRectSelectOptions *options,
|
||||
GParamSpec *pspec,
|
||||
|
@ -220,6 +223,9 @@ gimp_rect_select_tool_constructor (GType type,
|
|||
G_CALLBACK (gimp_rect_select_tool_round_corners_notify),
|
||||
object, 0);
|
||||
|
||||
gimp_rect_select_tool_update_option_defaults (GIMP_RECT_SELECT_TOOL (object),
|
||||
FALSE);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
|
@ -431,6 +437,9 @@ gimp_rect_select_tool_button_release (GimpTool *tool,
|
|||
}
|
||||
|
||||
rect_select->redo = NULL;
|
||||
|
||||
gimp_rect_select_tool_update_option_defaults (rect_select,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -574,6 +583,51 @@ gimp_rect_select_tool_real_select (GimpRectSelectTool *rect_select,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_rect_select_tool_update_option_defaults:
|
||||
* @crop_tool:
|
||||
* @ignore_pending: %TRUE to ignore any pending crop rectangle.
|
||||
*
|
||||
* Sets the default Fixed: Aspect ratio and Fixed: Size option
|
||||
* properties.
|
||||
*/
|
||||
static void
|
||||
gimp_rect_select_tool_update_option_defaults (GimpRectSelectTool *rect_select_tool,
|
||||
gboolean ignore_pending)
|
||||
{
|
||||
GimpTool *tool;
|
||||
GimpRectangleTool *rectangle_tool;
|
||||
GimpRectangleOptions *rectangle_options;
|
||||
|
||||
tool = GIMP_TOOL (rect_select_tool);
|
||||
rectangle_tool = GIMP_RECTANGLE_TOOL (tool);
|
||||
rectangle_options = GIMP_RECTANGLE_TOOL_GET_OPTIONS (rectangle_tool);
|
||||
|
||||
if (tool->display != NULL && !ignore_pending)
|
||||
{
|
||||
/* There is a pending rectangle and we should not ignore it, so
|
||||
* set default Fixed: Size to the same as the current pending
|
||||
* rectangle width/height.
|
||||
*/
|
||||
|
||||
gimp_rectangle_tool_pending_size_set (rectangle_tool,
|
||||
G_OBJECT (rectangle_options),
|
||||
"default-fixed-size-width",
|
||||
"default-fixed-size-height");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* There is no pending rectangle, set default Fixed: Size to
|
||||
* 100x100.
|
||||
*/
|
||||
|
||||
g_object_set (G_OBJECT (rectangle_options),
|
||||
"default-fixed-size-width", 100.0,
|
||||
"default-fixed-size-height", 100.0,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is called if the user clicks and releases the left
|
||||
* button without moving it. There are the things we might want
|
||||
|
@ -647,6 +701,9 @@ gimp_rect_select_tool_execute (GimpRectangleTool *rectangle,
|
|||
}
|
||||
}
|
||||
|
||||
gimp_rect_select_tool_update_option_defaults (GIMP_RECT_SELECT_TOOL (rectangle),
|
||||
FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue