static void shear_y_mag_changed (GtkAdjustment *adj, GimpTransformTool *tr_tool) { gdouble value = gtk_adjustment_get_value (adj); if (value != tr_tool->trans_info[YSHEAR]) { gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool)); if (tr_tool->trans_info[HORZ_OR_VERT] == GIMP_ORIENTATION_UNKNOWN) tr_tool->trans_info[HORZ_OR_VERT] = GIMP_ORIENTATION_VERTICAL; tr_tool->trans_info[YSHEAR] = value; gimp_transform_tool_push_internal_undo (tr_tool); gimp_transform_tool_recalc_matrix (tr_tool); gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool)); } }
static void rotate_angle_changed (GtkAdjustment *adj, GimpTransformTool *tr_tool) { gdouble value = gimp_deg_to_rad (gtk_adjustment_get_value (adj)); #define ANGLE_EPSILON 0.0001 if (ABS (value - tr_tool->trans_info[ANGLE]) > ANGLE_EPSILON) { gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool)); tr_tool->trans_info[REAL_ANGLE] = tr_tool->trans_info[ANGLE] = value; gimp_transform_tool_push_internal_undo (tr_tool); gimp_transform_tool_recalc_matrix (tr_tool); gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool)); } #undef ANGLE_EPSILON }
static void rotate_center_changed (GtkWidget *widget, GimpTransformTool *tr_tool) { gdouble px = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0); gdouble py = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1); if ((px != tr_tool->trans_info[PIVOT_X]) || (py != tr_tool->trans_info[PIVOT_Y])) { gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool)); tr_tool->trans_info[PIVOT_X] = px; tr_tool->trans_info[PIVOT_Y] = py; tr_tool->px = px; tr_tool->py = py; gimp_transform_tool_push_internal_undo (tr_tool); gimp_transform_tool_recalc_matrix (tr_tool); gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool)); } }
static void gimp_scale_tool_size_notify (GtkWidget *box, GParamSpec *pspec, GimpTransformTool *tr_tool) { GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tr_tool); if (! strcmp (pspec->name, "width") || ! strcmp (pspec->name, "height")) { gint width; gint height; gint old_width; gint old_height; g_object_get (box, "width", &width, "height", &height, NULL); old_width = ROUND (tr_tool->trans_info[X1] - tr_tool->trans_info[X0]); old_height = ROUND (tr_tool->trans_info[Y1] - tr_tool->trans_info[Y0]); if ((width != old_width) || (height != old_height)) { gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool)); tr_tool->trans_info[X1] = tr_tool->trans_info[X0] + width; tr_tool->trans_info[Y1] = tr_tool->trans_info[Y0] + height; gimp_transform_tool_push_internal_undo (tr_tool); gimp_transform_tool_recalc_matrix (tr_tool); gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool)); } } else if (! strcmp (pspec->name, "keep-aspect")) { gboolean constrain; g_object_get (box, "keep-aspect", &constrain, NULL); if (constrain != options->constrain_scale) { gint width; gint height; g_object_get (box, "width", &width, "height", &height, NULL); /* Take the aspect ratio from the size box when the user * activates the constraint by pressing the chain button. */ tr_tool->aspect = (gdouble) width / (gdouble) height; g_object_set (options, "constrain-scale", constrain, NULL); } } }