mirror of https://github.com/GNOME/gimp.git
app: add and use more GimpCanvasItem setters
This commit is contained in:
parent
d96091d514
commit
b529d556fa
|
@ -213,9 +213,9 @@ gimp_canvas_cursor_new (GimpDisplayShell *shell)
|
|||
}
|
||||
|
||||
void
|
||||
gimp_canvas_cursor_set_coords (GimpCanvasCursor *cursor,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
gimp_canvas_cursor_set (GimpCanvasItem *cursor,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
GimpCanvasCursorPrivate *private;
|
||||
|
||||
|
@ -225,11 +225,13 @@ gimp_canvas_cursor_set_coords (GimpCanvasCursor *cursor,
|
|||
|
||||
if (private->x != x || private->y != y)
|
||||
{
|
||||
gimp_canvas_item_begin_change (GIMP_CANVAS_ITEM (cursor));
|
||||
gimp_canvas_item_begin_change (cursor);
|
||||
|
||||
g_object_set (cursor,
|
||||
"x", x,
|
||||
"y", y,
|
||||
NULL);
|
||||
gimp_canvas_item_end_change (GIMP_CANVAS_ITEM (cursor));
|
||||
|
||||
gimp_canvas_item_end_change (cursor);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,13 +47,13 @@ struct _GimpCanvasCursorClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_canvas_cursor_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_canvas_cursor_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpCanvasItem * gimp_canvas_cursor_new (GimpDisplayShell *shell);
|
||||
GimpCanvasItem * gimp_canvas_cursor_new (GimpDisplayShell *shell);
|
||||
|
||||
void gimp_canvas_cursor_set_coords (GimpCanvasCursor *cursor,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
void gimp_canvas_cursor_set (GimpCanvasItem *cursor,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
|
||||
|
||||
#endif /* __GIMP_CANVAS_CURSOR_H__ */
|
||||
|
|
|
@ -279,3 +279,20 @@ gimp_canvas_guide_new (GimpDisplayShell *shell,
|
|||
"guide-style", guide_style,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_canvas_guide_set (GimpCanvasItem *guide,
|
||||
GimpOrientationType orientation,
|
||||
gint position)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_CANVAS_GUIDE (guide));
|
||||
|
||||
gimp_canvas_item_begin_change (guide);
|
||||
|
||||
g_object_set (guide,
|
||||
"orientation", orientation,
|
||||
"position", position,
|
||||
NULL);
|
||||
|
||||
gimp_canvas_item_end_change (guide);
|
||||
}
|
||||
|
|
|
@ -54,5 +54,9 @@ GimpCanvasItem * gimp_canvas_guide_new (GimpDisplayShell *shell,
|
|||
gint position,
|
||||
gboolean guide_style);
|
||||
|
||||
void gimp_canvas_guide_set (GimpCanvasItem *guide,
|
||||
GimpOrientationType orientation,
|
||||
gint position);
|
||||
|
||||
|
||||
#endif /* __GIMP_CANVAS_GUIDE_H__ */
|
||||
|
|
|
@ -289,7 +289,7 @@ gimp_canvas_path_stroke (GimpCanvasItem *item,
|
|||
|
||||
GimpCanvasItem *
|
||||
gimp_canvas_path_new (GimpDisplayShell *shell,
|
||||
const GimpBezierDesc *path,
|
||||
const GimpBezierDesc *bezier,
|
||||
gboolean filled,
|
||||
gboolean path_style)
|
||||
{
|
||||
|
@ -297,8 +297,23 @@ gimp_canvas_path_new (GimpDisplayShell *shell,
|
|||
|
||||
return g_object_new (GIMP_TYPE_CANVAS_PATH,
|
||||
"shell", shell,
|
||||
"path", path,
|
||||
"path", bezier,
|
||||
"filled", filled,
|
||||
"path-style", path_style,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_canvas_path_set (GimpCanvasItem *path,
|
||||
const GimpBezierDesc *bezier)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_CANVAS_PATH (path));
|
||||
|
||||
gimp_canvas_item_begin_change (path);
|
||||
|
||||
g_object_set (path,
|
||||
"path", bezier,
|
||||
NULL);
|
||||
|
||||
gimp_canvas_item_end_change (path);
|
||||
}
|
||||
|
|
|
@ -50,9 +50,12 @@ struct _GimpCanvasPathClass
|
|||
GType gimp_canvas_path_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpCanvasItem * gimp_canvas_path_new (GimpDisplayShell *shell,
|
||||
const GimpBezierDesc *path,
|
||||
const GimpBezierDesc *bezier,
|
||||
gboolean filled,
|
||||
gboolean path_style);
|
||||
|
||||
void gimp_canvas_path_set (GimpCanvasItem *path,
|
||||
const GimpBezierDesc *bezier);
|
||||
|
||||
|
||||
#endif /* __GIMP_CANVAS_PATH_H__ */
|
||||
|
|
|
@ -339,3 +339,20 @@ gimp_canvas_sample_point_new (GimpDisplayShell *shell,
|
|||
"sample-point-style", sample_point_style,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_canvas_sample_point_set (GimpCanvasItem *sample_point,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_CANVAS_SAMPLE_POINT (sample_point));
|
||||
|
||||
gimp_canvas_item_begin_change (sample_point);
|
||||
|
||||
g_object_set (sample_point,
|
||||
"x", x,
|
||||
"y", y,
|
||||
NULL);
|
||||
|
||||
gimp_canvas_item_end_change (sample_point);
|
||||
}
|
||||
|
|
|
@ -55,5 +55,9 @@ GimpCanvasItem * gimp_canvas_sample_point_new (GimpDisplayShell *shell,
|
|||
gint index,
|
||||
gboolean sample_point_style);
|
||||
|
||||
void gimp_canvas_sample_point_set (GimpCanvasItem *sample_point,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
|
||||
|
||||
#endif /* __GIMP_CANVAS_SAMPLE_POINT_H__ */
|
||||
|
|
|
@ -139,9 +139,9 @@ gimp_display_shell_update_software_cursor (GimpDisplayShell *shell,
|
|||
{
|
||||
gimp_canvas_item_begin_change (shell->cursor);
|
||||
|
||||
gimp_canvas_cursor_set_coords (GIMP_CANVAS_CURSOR (shell->cursor),
|
||||
display_x,
|
||||
display_y);
|
||||
gimp_canvas_cursor_set (shell->cursor,
|
||||
display_x,
|
||||
display_y);
|
||||
gimp_canvas_item_set_visible (shell->cursor, TRUE);
|
||||
|
||||
gimp_canvas_item_end_change (shell->cursor);
|
||||
|
|
|
@ -639,12 +639,9 @@ gimp_display_shell_guide_move_handler (GimpImage *image,
|
|||
|
||||
item = gimp_canvas_proxy_group_get_item (group, guide);
|
||||
|
||||
gimp_canvas_item_begin_change (item);
|
||||
g_object_set (item,
|
||||
"orientation", gimp_guide_get_orientation (guide),
|
||||
"position", gimp_guide_get_position (guide),
|
||||
NULL);
|
||||
gimp_canvas_item_end_change (item);
|
||||
gimp_canvas_guide_set (item,
|
||||
gimp_guide_get_orientation (guide),
|
||||
gimp_guide_get_position (guide));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -717,12 +714,7 @@ gimp_display_shell_sample_point_move_handler (GimpImage *image,
|
|||
|
||||
item = gimp_canvas_proxy_group_get_item (group, sample_point);
|
||||
|
||||
gimp_canvas_item_begin_change (item);
|
||||
g_object_set (item,
|
||||
"x", sample_point->x,
|
||||
"y", sample_point->y,
|
||||
NULL);
|
||||
gimp_canvas_item_end_change (item);
|
||||
gimp_canvas_sample_point_set (item, sample_point->x, sample_point->y);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -857,11 +849,7 @@ gimp_display_shell_vectors_thaw_handler (GimpVectors *vectors,
|
|||
|
||||
item = gimp_canvas_proxy_group_get_item (group, vectors);
|
||||
|
||||
gimp_canvas_item_begin_change (item);
|
||||
g_object_set (item,
|
||||
"path", gimp_vectors_get_bezier (vectors),
|
||||
NULL);
|
||||
gimp_canvas_item_end_change (item);
|
||||
gimp_canvas_path_set (item, gimp_vectors_get_bezier (vectors));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1742,24 +1742,24 @@ gimp_display_shell_set_highlight (GimpDisplayShell *shell,
|
|||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
gimp_canvas_item_begin_change (shell->passe_partout);
|
||||
|
||||
if (highlight)
|
||||
{
|
||||
g_object_set (shell->passe_partout,
|
||||
"visible", TRUE,
|
||||
"x", (gdouble) highlight->x,
|
||||
"y", (gdouble) highlight->y,
|
||||
"width", (gdouble) highlight->width,
|
||||
"height", (gdouble) highlight->height,
|
||||
NULL);
|
||||
gimp_canvas_item_begin_change (shell->passe_partout);
|
||||
|
||||
gimp_canvas_rectangle_set (shell->passe_partout,
|
||||
highlight->x,
|
||||
highlight->y,
|
||||
highlight->width,
|
||||
highlight->height);
|
||||
|
||||
gimp_canvas_item_set_visible (shell->passe_partout, TRUE);
|
||||
|
||||
gimp_canvas_item_end_change (shell->passe_partout);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_canvas_item_set_visible (shell->passe_partout, FALSE);
|
||||
}
|
||||
|
||||
gimp_canvas_item_end_change (shell->passe_partout);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue