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, 28 Mar 2007 20:01:04 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/03/28 20:01:04

Modified files:
        .              : ChangeLog 
        server         : edit_text_character.cpp edit_text_character.h 
        server/asobj   : Global.cpp 
        testsuite/actionscript.all: Makefile.am 
Added files:
        testsuite/actionscript.all: TextField.as 

Log message:
                * server/edit_text_character.{cpp,h}: add stubs
                  for all known TextField methods.
                * server/asobj/Global.cpp: initialize the global
                  TextField class
                * testsuite/actionscript.all/: Makefile.am, TextField.as:
                  New testcase for TextField class (just checks availability
                  of stuff).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2703&r2=1.2704
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.cpp?cvsroot=gnash&r1=1.55&r2=1.56
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Makefile.am?cvsroot=gnash&r1=1.68&r2=1.69
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/TextField.as?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2703
retrieving revision 1.2704
diff -u -b -r1.2703 -r1.2704
--- ChangeLog   28 Mar 2007 16:24:39 -0000      1.2703
+++ ChangeLog   28 Mar 2007 20:01:03 -0000      1.2704
@@ -1,5 +1,15 @@
 2007-03-28 Sandro Santilli <address@hidden>
 
+       * server/edit_text_character.{cpp,h}: add stubs
+         for all known TextField methods.
+       * server/asobj/Global.cpp: initialize the global
+         TextField class
+       * testsuite/actionscript.all/: Makefile.am, TextField.as:
+         New testcase for TextField class (just checks availability
+         of stuff).
+
+2007-03-28 Sandro Santilli <address@hidden>
+
        * libbase/GnashException.h: Add ActionLimitException
        * server/as_environment.{cpp,h}: provide callStackDepth()
          and cleanCallstack() methods, throw an ActionLimitException

Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- server/edit_text_character.cpp      20 Mar 2007 15:01:20 -0000      1.47
+++ server/edit_text_character.cpp      28 Mar 2007 20:01:04 -0000      1.48
@@ -15,7 +15,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 
-/* $Id: edit_text_character.cpp,v 1.47 2007/03/20 15:01:20 strk Exp $ */
+/* $Id: edit_text_character.cpp,v 1.48 2007/03/28 20:01:04 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -45,6 +45,24 @@
 // Forward declarations
 static as_value textfield_get_variable(const fn_call& fn);
 static as_value textfield_set_variable(const fn_call& fn);
+static as_value textfield_setTextFormat(const fn_call& fn);
+static as_value textfield_getTextFormat(const fn_call& fn);
+static as_value textfield_setNewTextFormat(const fn_call& fn);
+static as_value textfield_getNewTextFormat(const fn_call& fn);
+static as_value textfield_addListener(const fn_call& fn);
+static as_value textfield_removeListener(const fn_call& fn);
+
+static as_value textfield_getDepth(const fn_call& fn);
+static as_value textfield_getFontList(const fn_call& fn);
+static as_value textfield_removeTextField(const fn_call& fn);
+static as_value textfield_replaceSel(const fn_call& fn);
+static as_value textfield_replaceText(const fn_call& fn);
+static as_object* getTextFieldInterface();
+
+
+//
+// TextField interface functions
+//
 
 static as_value
 textfield_get_variable(const fn_call& fn)
@@ -68,17 +86,179 @@
        return as_value();
 }
 
-//
-// TextField interface functions
-//
+static as_value
+textfield_setTextFormat(const fn_call& fn)
+{
+       boost::intrusive_ptr<edit_text_character> text = 
ensureType<edit_text_character>(fn.this_ptr);
+       UNUSED(text);
+
+       static bool warned = false;
+       if ( ! warned ) {
+               log_error("FIXME: TextField.setTextFormat() unimplemented");
+               warned = true;
+       }
+
+       return as_value();
+
+}
 
 static as_value
-textfield_ctor(const fn_call& /* fn */)
+textfield_addListener(const fn_call& fn)
+{
+       boost::intrusive_ptr<edit_text_character> text = 
ensureType<edit_text_character>(fn.this_ptr);
+       UNUSED(text);
+
+       static bool warned = false;
+       if ( ! warned ) {
+               log_error("FIXME: TextField.addListener() unimplemented");
+               warned = true;
+       }
+
+       return as_value();
+}
+
+static as_value
+textfield_removeListener(const fn_call& fn)
+{
+       boost::intrusive_ptr<edit_text_character> text = 
ensureType<edit_text_character>(fn.this_ptr);
+       UNUSED(text);
+
+       static bool warned = false;
+       if ( ! warned ) {
+               log_error("FIXME: TextField.removeListener() unimplemented");
+               warned = true;
+       }
+
+       return as_value();
+}
+
+static as_value
+textfield_setNewTextFormat(const fn_call& fn)
+{
+       boost::intrusive_ptr<edit_text_character> text = 
ensureType<edit_text_character>(fn.this_ptr);
+       UNUSED(text);
+
+       static bool warned = false;
+       if ( ! warned ) {
+               log_error("FIXME: TextField.setNewTextFormat() unimplemented");
+               warned = true;
+       }
+
+       return as_value();
+}
+
+static as_value
+textfield_getDepth(const fn_call& fn)
+{
+       boost::intrusive_ptr<edit_text_character> text = 
ensureType<edit_text_character>(fn.this_ptr);
+       UNUSED(text);
+
+       static bool warned = false;
+       if ( ! warned ) {
+               log_error("FIXME: TextField.getDepth() unimplemented");
+               warned = true;
+       }
+
+       return as_value();
+}
+
+static as_value
+textfield_getFontList(const fn_call& fn)
+{
+       boost::intrusive_ptr<edit_text_character> text = 
ensureType<edit_text_character>(fn.this_ptr);
+       UNUSED(text);
+
+       static bool warned = false;
+       if ( ! warned ) {
+               log_error("FIXME: TextField.getFontList() unimplemented");
+               warned = true;
+       }
+
+       return as_value();
+}
+
+static as_value
+textfield_getNewTextFormat(const fn_call& fn)
+{
+       boost::intrusive_ptr<edit_text_character> text = 
ensureType<edit_text_character>(fn.this_ptr);
+       UNUSED(text);
+
+       static bool warned = false;
+       if ( ! warned ) {
+               log_error("FIXME: TextField.getNewTextFormat() unimplemented");
+               warned = true;
+       }
+
+       return as_value();
+}
+
+static as_value
+textfield_getTextFormat(const fn_call& fn)
+{
+       boost::intrusive_ptr<edit_text_character> text = 
ensureType<edit_text_character>(fn.this_ptr);
+       UNUSED(text);
+
+       static bool warned = false;
+       if ( ! warned ) {
+               log_error("FIXME: TextField.getTextFormat() unimplemented");
+               warned = true;
+       }
+
+       return as_value();
+}
+
+static as_value
+textfield_replaceSel(const fn_call& fn)
+{
+       boost::intrusive_ptr<edit_text_character> text = 
ensureType<edit_text_character>(fn.this_ptr);
+       UNUSED(text);
+
+       static bool warned = false;
+       if ( ! warned ) {
+               log_error("FIXME: TextField.replaceSel() unimplemented");
+               warned = true;
+       }
+
+       return as_value();
+}
+
+static as_value
+textfield_replaceText(const fn_call& fn)
+{
+       boost::intrusive_ptr<edit_text_character> text = 
ensureType<edit_text_character>(fn.this_ptr);
+       UNUSED(text);
+
+       static bool warned = false;
+       if ( ! warned ) {
+               log_error("FIXME: TextField.replaceText() unimplemented");
+               warned = true;
+       }
+
+       return as_value();
+}
+
+static as_value
+textfield_removeTextField(const fn_call& fn)
 {
-       log_msg("User tried to invoke new TextField()");
+       boost::intrusive_ptr<edit_text_character> text = 
ensureType<edit_text_character>(fn.this_ptr);
+       UNUSED(text);
+
+       static bool warned = false;
+       if ( ! warned ) {
+               log_error("FIXME: TextField.removeTextField() unimplemented");
+               warned = true;
+       }
+
        return as_value();
 }
 
+static as_value
+textfield_ctor(const fn_call& /* fn */)
+{
+       boost::intrusive_ptr<as_object> obj = new 
as_object(getTextFieldInterface());
+       return as_value(obj);
+}
+
 //
 // TextField interface initialization
 //
@@ -95,6 +275,34 @@
        boost::intrusive_ptr<builtin_function> variable_getter(new 
builtin_function(&textfield_get_variable, NULL));
        boost::intrusive_ptr<builtin_function> variable_setter(new 
builtin_function(&textfield_set_variable, NULL));
        o.init_property("variable", *variable_getter, *variable_setter);
+       o.init_member("setTextFormat", new 
builtin_function(textfield_setTextFormat));
+       o.init_member("getTextFormat", new 
builtin_function(textfield_getTextFormat));
+       o.init_member("addListener", new 
builtin_function(textfield_addListener));
+       o.init_member("removeListener", new 
builtin_function(textfield_removeListener));
+       o.init_member("setNewTextFormat", new 
builtin_function(textfield_setNewTextFormat));
+       o.init_member("getNewTextFormat", new 
builtin_function(textfield_getNewTextFormat));
+       o.init_member("getNewTextFormat", new 
builtin_function(textfield_getNewTextFormat));
+       o.init_member("getDepth", new builtin_function(textfield_getDepth));
+       o.init_member("removeTextField", new 
builtin_function(textfield_removeTextField));
+       o.init_member("replaceSel", new builtin_function(textfield_replaceSel));
+       if ( target_version  < 7 ) return;
+
+       // SWF7 or higher
+       o.init_member("replaceText", new 
builtin_function(textfield_replaceText));
+       if ( target_version  < 8 ) return;
+
+}
+
+static void
+attachTextFieldStaticMembers(as_object& o)
+{
+       int target_version = o.getVM().getSWFVersion();
+
+       // SWF5 or higher
+       if ( target_version  < 6 ) return;
+
+       // SWF6 or higher
+       o.init_member("getFontList", new 
builtin_function(textfield_getFontList));
        if ( target_version  < 7 ) return;
 
        // SWF7 or higher
@@ -1085,6 +1293,25 @@
        }
 }
 
+void
+textfield_class_init(as_object& global)
+{
+       // This is going to be the global TextField "class"/"function"
+       static boost::intrusive_ptr<builtin_function> cl=NULL;
+
+       if ( cl == NULL )
+       {
+               cl=new builtin_function(&textfield_ctor, 
getTextFieldInterface());
+               // replicate all interface to class, to be able to access
+               // all methods as static functions
+               attachTextFieldStaticMembers(*cl);
+                    
+       }
+
+       // Register _global.MovieClip
+       global.init_member("TextField", cl.get());
+}
+
 } // namespace gnash
 
 

Index: server/edit_text_character.h
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- server/edit_text_character.h        15 Mar 2007 22:39:53 -0000      1.24
+++ server/edit_text_character.h        28 Mar 2007 20:01:04 -0000      1.25
@@ -177,6 +177,9 @@
 
 };
 
+/// Initialize the global TextField class
+void textfield_class_init(as_object& global);
+
 } // namespace gnash
 
 #endif // _GNASH_EDIT_TEXT_CHARACTER_H_

Index: server/asobj/Global.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- server/asobj/Global.cpp     22 Mar 2007 22:37:45 -0000      1.55
+++ server/asobj/Global.cpp     28 Mar 2007 20:01:04 -0000      1.56
@@ -18,7 +18,7 @@
 
 // Implementation of the Global ActionScript Object
 
-/* $Id: Global.cpp,v 1.55 2007/03/22 22:37:45 bjacques Exp $ */
+/* $Id: Global.cpp,v 1.56 2007/03/28 20:01:04 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -63,6 +63,7 @@
 #include "timers.h"
 #include "URL.h" // for URL::encode and URL::decode (escape/unescape)
 #include "builtin_function.h"
+#include "edit_text_character.h"
 
 #include "fn_call.h"
 #include "sprite_instance.h"
@@ -397,6 +398,7 @@
        //-----------------------
 
        movieclip_class_init(*this);
+       textfield_class_init(*this);
 
        if ( vm.getSWFVersion() < 4 ) goto extscan;
        //-----------------------

Index: testsuite/actionscript.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Makefile.am,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- testsuite/actionscript.all/Makefile.am      10 Mar 2007 16:44:00 -0000      
1.68
+++ testsuite/actionscript.all/Makefile.am      28 Mar 2007 20:01:04 -0000      
1.69
@@ -16,7 +16,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-# $Id: Makefile.am,v 1.68 2007/03/10 16:44:00 strk Exp $
+# $Id: Makefile.am,v 1.69 2007/03/28 20:01:04 strk Exp $
 
 AUTOMAKE_OPTIONS = dejagnu
 
@@ -93,6 +93,7 @@
        Stage.as                \
        String.as               \
        System.as               \
+       TextField.as            \
        TextSnapshot.as         \
        Video.as                \
        Object.as               \

Index: testsuite/actionscript.all/TextField.as
===================================================================
RCS file: testsuite/actionscript.all/TextField.as
diff -N testsuite/actionscript.all/TextField.as
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/actionscript.all/TextField.as     28 Mar 2007 20:01:04 -0000      
1.1
@@ -0,0 +1,68 @@
+// 
+//   Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+//
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+// Test case for TextField ActionScript class
+// 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.1 2007/03/28 20:01:04 strk Exp $";
+
+#include "check.as"
+
+#if OUTPUT_VERSION > 5
+
+check_equals(typeof(TextField), 'function');
+check_equals(typeof(TextField.prototype), 'object');
+check_equals(typeof(TextField.prototype.setTextFormat), 'function');
+check_equals(typeof(TextField.prototype.getTextFormat), 'function');
+check_equals(typeof(TextField.prototype.setNewTextFormat), 'function');
+check_equals(typeof(TextField.prototype.getNewTextFormat), 'function');
+check_equals(typeof(TextField.prototype.addListener), 'function');
+check_equals(typeof(TextField.prototype.removeListener), 'function');
+check_equals(typeof(TextField.prototype.getDepth), 'function');
+check_equals(typeof(TextField.prototype.removeTextField), 'function');
+check_equals(typeof(TextField.prototype.replaceSel), 'function');
+// this is a static method
+check_equals(typeof(TextField.getFontList), 'function');
+
+check_equals(typeof(TextField.prototype.getFontList), 'undefined');
+
+#if OUTPUT_VERSION > 6
+check_equals(typeof(TextField.prototype.replaceText), 'function');
+#else
+check_equals(typeof(TextField.prototype.replaceText), 'undefined');
+#endif
+
+tfObj = new TextField();
+check_equals(typeof(tfObj), 'object');
+check(tfObj instanceof TextField);
+
+check_equals(typeof(tfObj.setTextFormat), 'function');
+check_equals(typeof(tfObj.getTextFormat), 'function');
+check_equals(typeof(tfObj.setNewTextFormat), 'function');
+check_equals(typeof(tfObj.getNewTextFormat), 'function');
+check_equals(typeof(tfObj.addListener), 'function');
+check_equals(typeof(tfObj.removeListener), 'function');
+check_equals(typeof(tfObj.getDepth), 'function');
+check_equals(typeof(tfObj.removeTextField), 'function');
+check_equals(typeof(tfObj.replaceSel), 'function');
+// this is a static method, it's available as TextField.getFontList
+check_equals(typeof(tfObj.getFontList), 'undefined');
+
+
+#endif // OUTPUT_VERSION > 5




reply via email to

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