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:

committed by
Martin Nordholts

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>
|
2007-09-01 Martin Nordholts <martinn@svn.gnome.org>
|
||||||
|
|
||||||
* app/tools/gimpcroptool.c
|
* app/tools/gimpcroptool.c
|
||||||
|
@ -78,7 +78,7 @@ static gboolean gimp_crop_tool_execute (GimpRectangleTool *rectang
|
|||||||
gint w,
|
gint w,
|
||||||
gint h);
|
gint h);
|
||||||
|
|
||||||
static void gimp_crop_tool_update_default_fixed_ratio_options
|
static void gimp_crop_tool_update_option_defaults
|
||||||
(GimpCropTool *crop_tool,
|
(GimpCropTool *crop_tool,
|
||||||
gboolean ignore_pending);
|
gboolean ignore_pending);
|
||||||
|
|
||||||
@ -194,8 +194,8 @@ gimp_crop_tool_constructor (GType type,
|
|||||||
GIMP_RECTANGLE_CONSTRAIN_DRAWABLE :
|
GIMP_RECTANGLE_CONSTRAIN_DRAWABLE :
|
||||||
GIMP_RECTANGLE_CONSTRAIN_IMAGE);
|
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);
|
FALSE);
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
@ -240,8 +240,8 @@ gimp_crop_tool_button_release (GimpTool *tool,
|
|||||||
release_type,
|
release_type,
|
||||||
display);
|
display);
|
||||||
|
|
||||||
gimp_crop_tool_update_default_fixed_ratio_options (GIMP_CROP_TOOL (tool),
|
gimp_crop_tool_update_option_defaults (GIMP_CROP_TOOL (tool),
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,8 +325,8 @@ gimp_crop_tool_execute (GimpRectangleTool *rectangle,
|
|||||||
|
|
||||||
gimp_image_flush (image);
|
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);
|
TRUE);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -335,16 +335,16 @@ gimp_crop_tool_execute (GimpRectangleTool *rectangle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_crop_tool_update_default_fixed_ratio_options:
|
* gimp_crop_tool_update_option_defaults:
|
||||||
* @crop_tool:
|
* @crop_tool:
|
||||||
* @ignore_pending: %TRUE to ignore any pending crop rectangle.
|
* @ignore_pending: %TRUE to ignore any pending crop rectangle.
|
||||||
*
|
*
|
||||||
* Sets the default aspect numerator/denominator to that of the current
|
* Sets the default Fixed: Aspect ratio and Fixed: Size option
|
||||||
* layer/image/pending crop rectangle.
|
* properties.
|
||||||
*/
|
*/
|
||||||
static void
|
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)
|
gboolean ignore_pending)
|
||||||
{
|
{
|
||||||
GimpTool *tool;
|
GimpTool *tool;
|
||||||
GimpRectangleTool *rectangle_tool;
|
GimpRectangleTool *rectangle_tool;
|
||||||
@ -356,17 +356,37 @@ gimp_crop_tool_update_default_fixed_ratio_options (GimpCropTool *crop_tool,
|
|||||||
|
|
||||||
if (tool->display != NULL && !ignore_pending)
|
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,
|
gimp_rectangle_tool_pending_size_set (rectangle_tool,
|
||||||
G_OBJECT (rectangle_options),
|
G_OBJECT (rectangle_options),
|
||||||
"default-aspect-numerator",
|
"default-aspect-numerator",
|
||||||
"default-aspect-denominator");
|
"default-aspect-denominator");
|
||||||
|
|
||||||
|
gimp_rectangle_tool_pending_size_set (rectangle_tool,
|
||||||
|
G_OBJECT (rectangle_options),
|
||||||
|
"default-fixed-size-width",
|
||||||
|
"default-fixed-size-height");
|
||||||
}
|
}
|
||||||
else
|
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,
|
gimp_rectangle_tool_constraint_size_set (rectangle_tool,
|
||||||
G_OBJECT (rectangle_options),
|
G_OBJECT (rectangle_options),
|
||||||
"default-aspect-numerator",
|
"default-aspect-numerator",
|
||||||
"default-aspect-denominator");
|
"default-aspect-denominator");
|
||||||
|
|
||||||
|
g_object_set (G_OBJECT (rectangle_options),
|
||||||
|
"default-fixed-size-width", 100.0,
|
||||||
|
"default-fixed-size-height", 100.0,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,8 +400,8 @@ gimp_crop_tool_notify_layer_only (GimpCropOptions *options,
|
|||||||
GIMP_RECTANGLE_CONSTRAIN_DRAWABLE :
|
GIMP_RECTANGLE_CONSTRAIN_DRAWABLE :
|
||||||
GIMP_RECTANGLE_CONSTRAIN_IMAGE);
|
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);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -389,6 +409,6 @@ gimp_crop_tool_image_changed (GimpContext *gimp_context,
|
|||||||
GimpImage *image,
|
GimpImage *image,
|
||||||
GimpCropTool *crop_tool)
|
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);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
@ -112,6 +112,9 @@ static void gimp_rect_select_tool_real_select (GimpRectSelectTool *r
|
|||||||
gint y,
|
gint y,
|
||||||
gint w,
|
gint w,
|
||||||
gint h);
|
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,
|
static void gimp_rect_select_tool_round_corners_notify (GimpRectSelectOptions *options,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
@ -220,6 +223,9 @@ gimp_rect_select_tool_constructor (GType type,
|
|||||||
G_CALLBACK (gimp_rect_select_tool_round_corners_notify),
|
G_CALLBACK (gimp_rect_select_tool_round_corners_notify),
|
||||||
object, 0);
|
object, 0);
|
||||||
|
|
||||||
|
gimp_rect_select_tool_update_option_defaults (GIMP_RECT_SELECT_TOOL (object),
|
||||||
|
FALSE);
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,6 +437,9 @@ gimp_rect_select_tool_button_release (GimpTool *tool,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rect_select->redo = NULL;
|
rect_select->redo = NULL;
|
||||||
|
|
||||||
|
gimp_rect_select_tool_update_option_defaults (rect_select,
|
||||||
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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
|
* This function is called if the user clicks and releases the left
|
||||||
* button without moving it. There are the things we might want
|
* 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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user