gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ...
Date: Wed, 19 Dec 2007 18:40:09 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/12/19 18:40:07

Modified files:
        .              : ChangeLog 
        server         : edit_text_character.cpp edit_text_character.h 
        testsuite/actionscript.all: TextField.as 

Log message:
        implement TextField.removeTextField().

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5219&r2=1.5220
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.138&r2=1.139
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.61&r2=1.62
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/TextField.as?cvsroot=gnash&r1=1.37&r2=1.38

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5219
retrieving revision 1.5220
diff -u -b -r1.5219 -r1.5220
--- ChangeLog   19 Dec 2007 16:38:48 -0000      1.5219
+++ ChangeLog   19 Dec 2007 18:40:06 -0000      1.5220
@@ -1,5 +1,12 @@
 2007-12-18 Sandro Santilli <address@hidden>
 
+       * server/edit_text_character.{cpp,h}:
+         implement removeTextField().
+       * testsuite/actionscript.all/TextField.as: update expected
+         results (2 xpass, 2 fail - used to suceed by luck).
+
+2007-12-18 Sandro Santilli <address@hidden>
+
        * testsuite/actionscript.all/TextField.as: add tests for
          TextField soft references (unimplemented in Gnash).
 

Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -b -r1.138 -r1.139
--- server/edit_text_character.cpp      19 Dec 2007 09:40:54 -0000      1.138
+++ server/edit_text_character.cpp      19 Dec 2007 18:40:07 -0000      1.139
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: edit_text_character.cpp,v 1.138 2007/12/19 09:40:54 strk Exp $ */
+/* $Id: edit_text_character.cpp,v 1.139 2007/12/19 18:40:07 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -267,11 +267,12 @@
 textfield_removeTextField(const fn_call& fn)
 {
        boost::intrusive_ptr<edit_text_character> text = 
ensureType<edit_text_character>(fn.this_ptr);
-       UNUSED(text);
+
+       text->removeTextField();
 
        static bool warned = false;
        if ( ! warned ) {
-               log_unimpl("TextField.removeTextField()");
+               log_debug("TextField.removeTextField() TESTING");
                warned = true;
        }
 
@@ -458,6 +459,36 @@
 }
 
 void
+edit_text_character::removeTextField()
+{
+       int depth = get_depth();
+       if ( depth < 0 || depth > 1048575 )
+       {
+               //IF_VERBOSE_ASCODING_ERRORS(
+               log_debug(_("CHECKME: removeTextField(%s): TextField depth (%d) 
out of the "
+                       "'dynamic' zone [0..1048575], won't remove"),
+                       getTarget().c_str(), depth);
+               //);
+               return;
+       }
+
+       character* parent = get_parent();
+       assert(parent); // every TextField must have a parent, right ?
+
+       sprite_instance* parentSprite = parent->to_movie();
+
+       if ( ! parentSprite )
+       {
+               log_error("FIXME: attempt to remove a TextField being a child 
of a %s", typeName(*parent).c_str());
+               return;
+       }
+
+       // second argument is arbitrary, see comments above
+       // the function declaration in sprite_instance.h
+       parentSprite->remove_display_object(depth, 0);
+}
+
+void
 edit_text_character::show_cursor(const matrix& mat)
 {
        boost::uint16_t x = static_cast<boost::uint16_t>(m_xcursor);

Index: server/edit_text_character.h
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- server/edit_text_character.h        18 Dec 2007 23:39:59 -0000      1.61
+++ server/edit_text_character.h        19 Dec 2007 18:40:07 -0000      1.62
@@ -278,6 +278,16 @@
                return isSelectable();
        }
 
+       /// Remove this textfield from the stage
+       //
+       /// This is to implement TextField.removeTextField, will
+       /// basically forward the request to its parent.
+       /// Eventually this and sprite_instance::removeMovieClip
+       /// will be merged in a single function to be later used
+       /// also for AS3 removeChild().
+       ///
+       void removeTextField();
+
 private:
 
        /// Set focus 

Index: testsuite/actionscript.all/TextField.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/TextField.as,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- testsuite/actionscript.all/TextField.as     19 Dec 2007 16:38:49 -0000      
1.37
+++ testsuite/actionscript.all/TextField.as     19 Dec 2007 18:40:07 -0000      
1.38
@@ -19,7 +19,7 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: TextField.as,v 1.37 2007/12/19 16:38:49 strk Exp $";
+rcsid="$Id: TextField.as,v 1.38 2007/12/19 18:40:07 strk Exp $";
 
 #include "check.as"
 
@@ -609,19 +609,19 @@
 check_equals(softref.prop, 5);
 check_equals(softref.getDepth(), 23);
 hardref.removeTextField();
-xcheck_equals(typeof(hardref), 'undefined');
+check_equals(typeof(hardref), 'undefined');
 xcheck_equals(typeof(softref), 'movieclip'); // becomes a movieclip ??
 xcheck_equals(typeof(softref.prop), 'undefined');
 createEmptyMovieClip("hardref", 24);
-xcheck_equals(typeof(hardref), 'movieclip');
+check_equals(typeof(hardref), 'movieclip');
 hardref.prop = 7;
 xcheck_equals(typeof(softref), 'movieclip');
-check_equals(softref.prop, 7);
+xcheck_equals(softref.prop, 7);
 hardref.removeMovieClip();
 createTextField("hardref", 25, 10, 10, 160, 200);
 hardref.prop = 9;
 check_equals(typeof(softref), 'object'); // changes type on rebind
-check_equals(softref.prop, 9);
+xcheck_equals(softref.prop, 9);
 
 
 //-------------------------------------------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]