Hiroyuki Ikezoe
ikezo****@users*****
2006年 11月 23日 (木) 15:02:06 JST
Index: libtomoe-gtk/src/tomoe-canvas.c diff -u libtomoe-gtk/src/tomoe-canvas.c:1.21 libtomoe-gtk/src/tomoe-canvas.c:1.22 --- libtomoe-gtk/src/tomoe-canvas.c:1.21 Thu Nov 23 11:43:36 2006 +++ libtomoe-gtk/src/tomoe-canvas.c Thu Nov 23 15:02:05 2006 @@ -388,10 +388,9 @@ if (event->button != 1) return retval; -#if 0 - tomoe_writing_line_to (priv->writing); - draw_annotate (canvas, tomoe_writing_get_number_of_strokes (priv->writing) + 1, &color); -#endif + + tomoe_writing_line_to (priv->writing, (gint) event->x, (gint) event->y); + /* draw_annotate (points, canvas, tomoe_writing_get_number_of_strokes (priv->writing) + 1, &color); */ g_signal_emit (G_OBJECT (widget), canvas_signals[STROKE_ADDED_SIGNAL], 0); @@ -415,7 +414,7 @@ { TomoeCanvas *canvas = TOMOE_CANVAS (widget); TomoeCanvasPriv *priv = TOMOE_CANVAS_GET_PRIVATE (canvas); - int x, y; + gint x, y; GdkModifierType state; gboolean retval = FALSE; @@ -424,8 +423,8 @@ if (event->is_hint) { gdk_window_get_pointer(event->window, &x, &y, &state); } else { - x = (int) event->x; - y = (int) event->y; + x = (gint) event->x; + y = (gint) event->y; state = (GdkModifierType) event->state; } @@ -440,14 +439,14 @@ static TomoeWriting * create_sparse_writing (TomoeCanvas *canvas) { - TomoeWriting *g; + TomoeWriting *new; TomoeCanvasPriv *priv; const GList *strokes, *list; g_return_val_if_fail (TOMOE_IS_CANVAS (canvas), NULL); priv = TOMOE_CANVAS_GET_PRIVATE (canvas); - g = tomoe_writing_new (); + new = tomoe_writing_new (); strokes = tomoe_writing_get_strokes (priv->writing); for (list = strokes; list; list = g_list_next (list)) { @@ -455,7 +454,7 @@ GList *point, *new_points; TomoePoint *start_point = (TomoePoint *) points->data; - tomoe_writing_move_to (g, start_point->x, start_point->y); + tomoe_writing_move_to (new, start_point->x, start_point->y); new_points = g_list_prepend (get_vertex(points, g_list_last(points)), points->data); @@ -465,11 +464,11 @@ gint x, y; x = p->x * ((gdouble)TOMOE_WRITING_DEFAULT_SIZE / priv->size); y = p->y * ((gdouble)TOMOE_WRITING_DEFAULT_SIZE / priv->size); - tomoe_writing_line_to (g, x, y); + tomoe_writing_line_to (new, x, y); } } - return g; + return new; } static void @@ -480,6 +479,7 @@ const GList *strokes, *list; TomoeWriting *writing; TomoeQuery *query; + guint i; GdkColor color = { 0, 0x8000, 0x0000, 0x0000}; g_return_if_fail (TOMOE_IS_CANVAS (canvas)); @@ -492,16 +492,15 @@ /* draw thin red lines and annotations for sparse points */ strokes = tomoe_writing_get_strokes (writing); - for (list = strokes; list; list = g_list_next (list)) { + for (list = strokes, i = 1; list; list = g_list_next (list), i++) { GList *points = (GList *) list->data; GList *point; - guint i; TomoePoint *pp = NULL; - for (point = points, i = 0; point; point = g_list_next (point), i++) { + for (point = points; point; point = g_list_next (point)) { TomoePoint *p = (TomoePoint *) point->data; if (pp) { - tomoe_canvas_draw_line (canvas, pp, p, FALSE, &color); + tomoe_canvas_draw_line (canvas, pp, p, TRUE, &color); } else { draw_annotate (points, canvas, i, &color); } @@ -1189,8 +1188,8 @@ dx = x; dy = y; } else { - dx = 0; - dy = 0; + dx = ((TomoePoint*)((g_list_last (points))->data))->x * factor - x; + dy = ((TomoePoint*)((g_list_last (points))->data))->y * factor - y; } dl = sqrt (dx*dx + dy*dy); @@ -1205,7 +1204,6 @@ x += (0.5 + (0.5 * r * dx / dl) + (sign * 0.5 * r * dy / dl) - (width / 2)); y += (0.5 + (0.5 * r * dy / dl) - (sign * 0.5 * r * dx / dl) - (height / 2)); - gdk_draw_layout (priv->pixmap, priv->annotate_gc, x, y, layout);