changeset 885:2b492008ce26 abs_n_rel_center

Told redraw manager that a text is dirty when change its text at JS
author Thinker K.F. Li <thinker@codemud.net>
date Sun, 26 Sep 2010 00:54:12 +0800
parents 6c8e4e1f3a39
children 3457f2d8b0b8
files nodejs/shapes.cc nodejs/shapes.m4
diffstat 2 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/nodejs/shapes.cc	Sun Sep 26 00:53:16 2010 +0800
+++ b/nodejs/shapes.cc	Sun Sep 26 00:54:12 2010 +0800
@@ -70,6 +70,25 @@
     }
 }
 
+static void
+xnjsmb_sh_stext_set_text(shape_t *sh, Handle<Object> self,
+			 const char *txt) {
+    Handle<Object> rt;
+    redraw_man_t *rdman;
+    
+    sh_stext_set_text(sh, txt);
+    
+    /*
+     * Mark changed.
+     */
+    rt = GET(self, "mbrt")->ToObject();
+    ASSERT(rt != NULL);
+    rdman = xnjsmb_rt_rdman(rt);
+
+    if(sh_get_coord(sh))
+	rdman_shape_changed(rdman, sh);
+}
+
 /*! \brief Set style blocks for a stext object from JS.
  *
  * A style block is style setting of a chip of text.  It is a 3-tuple,
--- a/nodejs/shapes.m4	Sun Sep 26 00:53:16 2010 +0800
+++ b/nodejs/shapes.m4	Sun Sep 26 00:54:12 2010 +0800
@@ -12,7 +12,8 @@
        (([INHERIT], [shape]), ([STMOD], [xnjsmb_shape_mod])))
 
 STRUCT([stext], [shape_t], [],
-       [METHOD([set_text], [sh_stext_set_text], (STR([txt])), 1, []),
+       [METHOD([set_text], [xnjsmb_sh_stext_set_text],
+       			    (SELF, STR([txt])), 1, []),
         METHOD([set_style], [xnjsmb_sh_stext_set_style],
 	       (SELF, ARRAY([blks]), ERR), 1, [])],
        (([INHERIT], [shape]), ([STMOD], [xnjsmb_shape_mod])))