/** * gimp_crop_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_crop_tool_update_option_defaults (GimpCropTool *crop_tool, gboolean ignore_pending) { GimpTool *tool; GimpRectangleTool *rectangle_tool; GimpRectangleOptions *rectangle_options; tool = GIMP_TOOL (crop_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: Aspect ratio 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"); g_object_set (G_OBJECT (rectangle_options), "use-string-current", TRUE, NULL); } else { /* There is no pending rectangle, set default Fixed: Aspect * ratio to that of the current image/layer. */ 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), "use-string-current", FALSE, NULL); } }
/** * gimp_rectangle_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_rectangle_select_tool_update_option_defaults (GimpRectangleSelectTool *rect_sel_tool, gboolean ignore_pending) { GimpTool *tool; GimpRectangleTool *rectangle_tool; GimpRectangleOptions *rectangle_options; tool = GIMP_TOOL (rect_sel_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-aspect-numerator", "default-aspect-denominator"); g_object_set (G_OBJECT (rectangle_options), "use-string-current", TRUE, NULL); } else { g_object_set (G_OBJECT (rectangle_options), "default-aspect-numerator", 1.0, "default-aspect-denominator", 1.0, NULL); g_object_set (G_OBJECT (rectangle_options), "use-string-current", FALSE, NULL); } }