changeset 289:13ce87b6dbf5

Fix bug of sh_text_t that do not update it-self after changes. - It is wrong to compute bounding box. - location of left-top corner is (text->d_x, text->d_y) not (text->x, text->y).
author Thinker K.F. Li <thinker@branda.to>
date Sat, 31 Jan 2009 18:28:50 +0800
parents d5327265da1e
children f65c4589549f
files examples/dynamic/text.c src/redraw_man.c src/shape_text.c
diffstat 3 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/examples/dynamic/text.c	Sat Jan 31 17:35:27 2009 +0800
+++ b/examples/dynamic/text.c	Sat Jan 31 18:28:50 2009 +0800
@@ -42,7 +42,12 @@
         sh_text_set_text(text,"This is 1");
     }
     rdman_shape_changed(MBAPP_RDMAN(myApp), text);
+#if 0
+    /* Removed!
+     * X_MB_handle_connection() will invoke it automatically.
+     */
     rdman_redraw_changed(MBAPP_RDMAN(myApp));
+#endif
 }
 
 int main(int argc, char * const argv[]) {
--- a/src/redraw_man.c	Sat Jan 31 17:35:27 2009 +0800
+++ b/src/redraw_man.c	Sat Jan 31 18:28:50 2009 +0800
@@ -1152,7 +1152,6 @@
     if(dirty && coord->flags & COF_OWN_CANVAS) {
 	update_canvas_2_parent(rdman, coord);
 	clean_canvas_black(coord->canvas, rdman->w, rdman->h);
-	printf("update\n");
     } 
 
     return dirty;
--- a/src/shape_text.c	Sat Jan 31 17:35:27 2009 +0800
+++ b/src/shape_text.c	Sat Jan 31 18:28:50 2009 +0800
@@ -117,8 +117,8 @@
      * We add 5 pixels in get right bbox.  But, it is unreasonable.
      */
 
-    poses[0][0] = x + extents.x - shw;
-    poses[0][1] = y + extents.y - shw;
+    poses[0][0] = text->d_x + extents.x - shw;
+    poses[0][1] = text->d_y + extents.y - shw;
     poses[1][0] = poses[0][0] + extents.width +  shape->stroke_width;
     poses[1][1] = poses[0][1] + extents.height +  shape->stroke_width;
     geo_from_positions(shape->geo, 2, poses);