Author: fejj
Date: 2007-11-01 10:52:11 -0500 (Thu, 01 Nov 2007)
New Revision: 88655

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/text.cpp
Log:
2007-11-01  Jeffrey Stedfast  <[EMAIL PROTECTED]>

        * text.cpp (TextBlock::SetValue): Oops - if we are setting an
        empty string on the Text property, then we need to clear out
        whatever was there before (if anything).



Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-11-01 15:41:52 UTC (rev 88654)
+++ trunk/moon/src/ChangeLog    2007-11-01 15:52:11 UTC (rev 88655)
@@ -1,3 +1,9 @@
+2007-11-01  Jeffrey Stedfast  <[EMAIL PROTECTED]>
+
+       * text.cpp (TextBlock::SetValue): Oops - if we are setting an
+       empty string on the Text property, then we need to clear out
+       whatever was there before (if anything).
+
 2007-10-31  Jeffrey Stedfast  <[EMAIL PROTECTED]>
 
        Fixes for handling lwsp cdata between <Run> elements.

Modified: trunk/moon/src/text.cpp
===================================================================
--- trunk/moon/src/text.cpp     2007-11-01 15:41:52 UTC (rev 88654)
+++ trunk/moon/src/text.cpp     2007-11-01 15:52:11 UTC (rev 88655)
@@ -1028,26 +1028,28 @@
                // Text is a virtual property and setting it deletes all 
current runs,
                // creating a new run
                const char *str = value ? value->AsString () : NULL;
-               
-               if (!str || !str[0])
-                       return;
-               
-               Run *run = new Run ();
-               run_set_text (run, value->AsString ());
-               
                Inlines *inlines = text_block_get_inlines (this);
                
-               if (!inlines) {
-                       inlines = new Inlines ();
-                       text_block_set_inlines (this, inlines);
-                       inlines->unref ();
-               } else {
+               if (str && str[0]) {
+                       Run *run = new Run ();
+                       run_set_text (run, value->AsString ());
+                       
+                       if (!inlines) {
+                               inlines = new Inlines ();
+                               text_block_set_inlines (this, inlines);
+                               inlines->unref ();
+                       } else {
+                               inlines->Clear ();
+                       }
+                       
+                       inlines->Add (run);
+                       run->unref ();
+                       dirty = true;
+               } else if (inlines) {
                        inlines->Clear ();
+                       dirty = true;
                }
                
-               inlines->Add (run);
-               run->unref ();
-               dirty = true;
                return;
        }
        

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to