Takuro Ashie
makei****@users*****
2006年 11月 25日 (土) 22:25:58 JST
Index: libtomoe-gtk/src/tomoe-canvas.c diff -u libtomoe-gtk/src/tomoe-canvas.c:1.33 libtomoe-gtk/src/tomoe-canvas.c:1.34 --- libtomoe-gtk/src/tomoe-canvas.c:1.33 Fri Nov 24 15:47:31 2006 +++ libtomoe-gtk/src/tomoe-canvas.c Sat Nov 25 22:25:58 2006 @@ -46,16 +46,21 @@ guint size; gint width; gint height; + GdkGC *handwrite_line_gc; GdkGC *adjust_line_gc; GdkGC *annotate_gc; GdkGC *axis_gc; + GdkPixmap *pixmap; + gboolean drawing; + + TomoeContext *context; + TomoeWriting *writing; GList *candidates; + gint auto_find_time; guint auto_find_id; - TomoeContext *context; - TomoeWriting *writing; gboolean locked; }; @@ -190,15 +195,23 @@ TomoeCanvasPriv *priv = TOMOE_CANVAS_GET_PRIVATE (canvas); priv->size = TOMOE_CANVAS_DEFAULT_SIZE; + priv->width = 300; + priv->height = 300; + priv->handwrite_line_gc = NULL; priv->adjust_line_gc = NULL; priv->annotate_gc = NULL; priv->axis_gc = NULL; + priv->pixmap = NULL; + priv->drawing = FALSE; + + priv->context = NULL; + priv->writing = tomoe_writing_new (); priv->candidates = NULL; + priv->auto_find_time = 0; priv->auto_find_id = 0; - priv->writing = tomoe_writing_new (); priv->locked = FALSE; instance_list = g_list_append (instance_list, (gpointer) canvas); @@ -361,7 +374,8 @@ /* tomoe_canvas_refresh (canvas); */ - if (event->button == 1 && priv->pixmap != NULL) { + if (event->button == 1) { + priv->drawing = TRUE; tomoe_writing_move_to (priv->writing, (gint) event->x, (gint) event->y); } @@ -383,25 +397,23 @@ gboolean retval = FALSE; if (priv->locked) return retval; + if (!priv->drawing) return retval; - if (event->button != 1) - return retval; - - tomoe_writing_line_to (priv->writing, (gint) event->x, (gint) event->y); + /* 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); */ + priv->drawing = FALSE; + g_signal_emit (G_OBJECT (widget), canvas_signals[STROKE_ADDED_SIGNAL], 0); if (priv->auto_find_id) { g_source_remove (priv->auto_find_id); priv->auto_find_id = 0; } - if (priv->auto_find_time > 0) { + if (priv->auto_find_time >= 0) { priv->auto_find_id = g_timeout_add (priv->auto_find_time, timeout_auto_find, (gpointer)canvas); - } else if (priv->auto_find_time == 0) { - tomoe_canvas_find (canvas); } return retval; @@ -417,6 +429,7 @@ gboolean retval = FALSE; if (priv->locked) return retval; + if (!priv->drawing) return retval; if (event->is_hint) { gdk_window_get_pointer(event->window, &x, &y, &state); @@ -426,9 +439,7 @@ state = (GdkModifierType) event->state; } - if (state & GDK_BUTTON1_MASK && priv->pixmap) { - tomoe_canvas_append_point (canvas, x, y); - } + tomoe_canvas_append_point (canvas, x, y); return retval; }