app: manage the transform tools' grid properties in GimpTransformTool
Simply use g_object_bind_property() to connect the grid properties of GimpTransformOoptions and GimpToolTransformGrid and remove all other grid property setting code.
This commit is contained in:
@ -2225,9 +2225,7 @@ gimp_tool_transform_grid_new (GimpDisplayShell *shell,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gdouble x2,
|
||||
gdouble y2,
|
||||
GimpGuidesType guide_type,
|
||||
gint n_guides)
|
||||
gdouble y2)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
|
||||
|
||||
@ -2238,7 +2236,5 @@ gimp_tool_transform_grid_new (GimpDisplayShell *shell,
|
||||
"y1", y1,
|
||||
"x2", x2,
|
||||
"y2", y2,
|
||||
"guide-type", guide_type,
|
||||
"n-guides", n_guides,
|
||||
NULL);
|
||||
}
|
||||
|
@ -84,9 +84,7 @@ GimpToolWidget * gimp_tool_transform_grid_new (GimpDisplayShell *shell,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gdouble x2,
|
||||
gdouble y2,
|
||||
GimpGuidesType guide_type,
|
||||
gint n_guides);
|
||||
gdouble y2);
|
||||
|
||||
|
||||
#endif /* __GIMP_TOOL_TRANSFORM_GRID_H__ */
|
||||
|
@ -306,13 +306,11 @@ static GimpToolWidget *
|
||||
gimp_handle_transform_tool_get_widget (GimpTransformTool *tr_tool)
|
||||
{
|
||||
GimpTool *tool = GIMP_TOOL (tr_tool);
|
||||
GimpTransformOptions *options;
|
||||
GimpHandleTransformOptions *ht_options;
|
||||
GimpHandleTransformOptions *options;
|
||||
GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
|
||||
GimpToolWidget *widget;
|
||||
|
||||
options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tr_tool);
|
||||
ht_options = GIMP_HANDLE_TRANSFORM_TOOL_GET_OPTIONS (tr_tool);
|
||||
options = GIMP_HANDLE_TRANSFORM_TOOL_GET_OPTIONS (tr_tool);
|
||||
|
||||
widget = gimp_tool_handle_grid_new (shell,
|
||||
tr_tool->x1,
|
||||
@ -341,9 +339,7 @@ gimp_handle_transform_tool_get_widget (GimpTransformTool *tr_tool)
|
||||
NULL);
|
||||
|
||||
g_object_set (widget,
|
||||
"guide-type", options->grid_type,
|
||||
"n-guides", options->grid_size,
|
||||
"handle-mode", ht_options->handle_mode,
|
||||
"handle-mode", options->handle_mode,
|
||||
NULL);
|
||||
|
||||
g_signal_connect (widget, "changed",
|
||||
|
@ -221,8 +221,7 @@ gimp_perspective_clone_tool_initialize (GimpTool *tool,
|
||||
clone_tool->x1,
|
||||
clone_tool->y1,
|
||||
clone_tool->x2,
|
||||
clone_tool->y2,
|
||||
GIMP_GUIDES_NONE, 1);
|
||||
clone_tool->y2);
|
||||
|
||||
g_object_set (clone_tool->widget,
|
||||
"pivot-x", (clone_tool->x1 + clone_tool->x2) / 2.0,
|
||||
|
@ -195,9 +195,7 @@ gimp_perspective_tool_get_widget (GimpTransformTool *tr_tool)
|
||||
tr_tool->x1,
|
||||
tr_tool->y1,
|
||||
tr_tool->x2,
|
||||
tr_tool->y2,
|
||||
options->grid_type,
|
||||
options->grid_size);
|
||||
tr_tool->y2);
|
||||
|
||||
g_object_set (widget,
|
||||
"inside-function", GIMP_TRANSFORM_FUNCTION_PERSPECTIVE,
|
||||
|
@ -311,8 +311,6 @@ gimp_rotate_tool_get_widget (GimpTransformTool *tr_tool)
|
||||
tr_tool->trans_info[ANGLE]);
|
||||
|
||||
g_object_set (widget,
|
||||
"guide-type", options->grid_type,
|
||||
"n-guides", options->grid_size,
|
||||
"inside-function", GIMP_TRANSFORM_FUNCTION_ROTATE,
|
||||
"outside-function", GIMP_TRANSFORM_FUNCTION_ROTATE,
|
||||
"use-pivot-handle", TRUE,
|
||||
|
@ -203,9 +203,7 @@ gimp_scale_tool_get_widget (GimpTransformTool *tr_tool)
|
||||
tr_tool->x1,
|
||||
tr_tool->y1,
|
||||
tr_tool->x2,
|
||||
tr_tool->y2,
|
||||
options->grid_type,
|
||||
options->grid_size);
|
||||
tr_tool->y2);
|
||||
|
||||
g_object_set (widget,
|
||||
"inside-function", GIMP_TRANSFORM_FUNCTION_SCALE,
|
||||
|
@ -189,8 +189,6 @@ gimp_shear_tool_get_widget (GimpTransformTool *tr_tool)
|
||||
tr_tool->trans_info[SHEAR_Y]);
|
||||
|
||||
g_object_set (widget,
|
||||
"guide-type", options->grid_type,
|
||||
"n-guides", options->grid_size,
|
||||
"inside-function", GIMP_TRANSFORM_FUNCTION_SHEAR,
|
||||
"outside-function", GIMP_TRANSFORM_FUNCTION_SHEAR,
|
||||
"constrain-move", options->constrain_move,
|
||||
|
@ -261,10 +261,11 @@ gimp_transform_tool_initialize (GimpTool *tool,
|
||||
GimpDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (tool);
|
||||
GimpImage *image = gimp_display_get_image (display);
|
||||
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
|
||||
GimpItem *item;
|
||||
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (tool);
|
||||
GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tool);
|
||||
GimpImage *image = gimp_display_get_image (display);
|
||||
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
|
||||
GimpItem *item;
|
||||
|
||||
if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error))
|
||||
{
|
||||
@ -312,6 +313,15 @@ gimp_transform_tool_initialize (GimpTool *tool,
|
||||
tr_tool->widget =
|
||||
GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->get_widget (tr_tool);
|
||||
|
||||
g_object_bind_property (G_OBJECT (options), "grid-type",
|
||||
G_OBJECT (tr_tool->widget), "guide-type",
|
||||
G_BINDING_SYNC_CREATE |
|
||||
G_BINDING_BIDIRECTIONAL);
|
||||
g_object_bind_property (G_OBJECT (options), "grid-size",
|
||||
G_OBJECT (tr_tool->widget), "n-guides",
|
||||
G_BINDING_SYNC_CREATE |
|
||||
G_BINDING_BIDIRECTIONAL);
|
||||
|
||||
g_signal_connect (tr_tool->widget, "changed",
|
||||
G_CALLBACK (gimp_transform_tool_widget_changed),
|
||||
tr_tool);
|
||||
@ -757,18 +767,6 @@ gimp_transform_tool_options_notify (GimpTool *tool,
|
||||
"opacity", tr_options->preview_opacity,
|
||||
NULL);
|
||||
}
|
||||
else if (! strcmp (pspec->name, "grid-type"))
|
||||
{
|
||||
g_object_set (tr_tool->widget,
|
||||
"guide-type", tr_options->grid_type,
|
||||
NULL);
|
||||
}
|
||||
else if (! strcmp (pspec->name, "grid-size"))
|
||||
{
|
||||
g_object_set (tr_tool->widget,
|
||||
"n-guides", tr_options->grid_size,
|
||||
NULL);
|
||||
}
|
||||
else if (g_str_has_prefix (pspec->name, "constrain-") ||
|
||||
g_str_has_prefix (pspec->name, "frompivot-") ||
|
||||
! strcmp (pspec->name, "fixedpivot") ||
|
||||
|
@ -195,9 +195,7 @@ gimp_unified_transform_tool_get_widget (GimpTransformTool *tr_tool)
|
||||
tr_tool->x1,
|
||||
tr_tool->y1,
|
||||
tr_tool->x2,
|
||||
tr_tool->y2,
|
||||
options->grid_type,
|
||||
options->grid_size);
|
||||
tr_tool->y2);
|
||||
|
||||
g_object_set (widget,
|
||||
"pivot-x", (tr_tool->x1 + tr_tool->x2) / 2.0,
|
||||
|
Reference in New Issue
Block a user