[gimp] app: add and use more GimpCanvasItem setters
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add and use more GimpCanvasItem setters
- Date: Mon, 28 Mar 2011 13:16:03 +0000 (UTC)
commit b529d556fa02fd15c2c364c6a15d974dc8c38d56
Author: Michael Natterer <mitch gimp org>
Date: Mon Mar 28 15:15:43 2011 +0200
app: add and use more GimpCanvasItem setters
app/display/gimpcanvascursor.c | 12 +++++++-----
app/display/gimpcanvascursor.h | 10 +++++-----
app/display/gimpcanvasguide.c | 17 +++++++++++++++++
app/display/gimpcanvasguide.h | 4 ++++
app/display/gimpcanvaspath.c | 19 +++++++++++++++++--
app/display/gimpcanvaspath.h | 5 ++++-
app/display/gimpcanvassamplepoint.c | 17 +++++++++++++++++
app/display/gimpcanvassamplepoint.h | 4 ++++
app/display/gimpdisplayshell-cursor.c | 6 +++---
app/display/gimpdisplayshell-handlers.c | 22 +++++-----------------
app/display/gimpdisplayshell.c | 22 +++++++++++-----------
11 files changed, 94 insertions(+), 44 deletions(-)
---
diff --git a/app/display/gimpcanvascursor.c b/app/display/gimpcanvascursor.c
index ea83ea0..81089b6 100644
--- a/app/display/gimpcanvascursor.c
+++ b/app/display/gimpcanvascursor.c
@@ -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);
}
}
diff --git a/app/display/gimpcanvascursor.h b/app/display/gimpcanvascursor.h
index aacf9ee..17dd940 100644
--- a/app/display/gimpcanvascursor.h
+++ b/app/display/gimpcanvascursor.h
@@ -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__ */
diff --git a/app/display/gimpcanvasguide.c b/app/display/gimpcanvasguide.c
index a5e4610..42980e4 100644
--- a/app/display/gimpcanvasguide.c
+++ b/app/display/gimpcanvasguide.c
@@ -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);
+}
diff --git a/app/display/gimpcanvasguide.h b/app/display/gimpcanvasguide.h
index f2f8356..29d6295 100644
--- a/app/display/gimpcanvasguide.h
+++ b/app/display/gimpcanvasguide.h
@@ -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__ */
diff --git a/app/display/gimpcanvaspath.c b/app/display/gimpcanvaspath.c
index 349db93..03d5f3c 100644
--- a/app/display/gimpcanvaspath.c
+++ b/app/display/gimpcanvaspath.c
@@ -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);
+}
diff --git a/app/display/gimpcanvaspath.h b/app/display/gimpcanvaspath.h
index eb73348..9bfe4d6 100644
--- a/app/display/gimpcanvaspath.h
+++ b/app/display/gimpcanvaspath.h
@@ -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__ */
diff --git a/app/display/gimpcanvassamplepoint.c b/app/display/gimpcanvassamplepoint.c
index 30d3f30..07685cf 100644
--- a/app/display/gimpcanvassamplepoint.c
+++ b/app/display/gimpcanvassamplepoint.c
@@ -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);
+}
diff --git a/app/display/gimpcanvassamplepoint.h b/app/display/gimpcanvassamplepoint.h
index 3f54a77..f8e3002 100644
--- a/app/display/gimpcanvassamplepoint.h
+++ b/app/display/gimpcanvassamplepoint.h
@@ -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__ */
diff --git a/app/display/gimpdisplayshell-cursor.c b/app/display/gimpdisplayshell-cursor.c
index c483f24..4c43f2b 100644
--- a/app/display/gimpdisplayshell-cursor.c
+++ b/app/display/gimpdisplayshell-cursor.c
@@ -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);
diff --git a/app/display/gimpdisplayshell-handlers.c b/app/display/gimpdisplayshell-handlers.c
index 44dea35..904d7d6 100644
--- a/app/display/gimpdisplayshell-handlers.c
+++ b/app/display/gimpdisplayshell-handlers.c
@@ -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
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index e2c970d..a97629c 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -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);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]