gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/avm2 r9520: Add TextFieldAutoSize actionsc


From: Tom Stellard
Subject: [Gnash-commit] /srv/bzr/gnash/avm2 r9520: Add TextFieldAutoSize actionscript class.
Date: Fri, 22 Aug 2008 23:42:16 +0800
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9520
committer: Tom Stellard <address@hidden>
branch nick: gnash_dev
timestamp: Fri 2008-08-22 23:42:16 +0800
message:
  Add TextFieldAutoSize actionscript class.
added:
  libcore/asobj/TextFieldAutoSize_as.cpp
  libcore/asobj/TextFieldAutoSize_as.h
modified:
  libcore/asobj/ClassHierarchy.cpp
  libcore/asobj/Makefile.am
  libcore/namedStrings.cpp
  libcore/namedStrings.h
=== modified file 'libcore/asobj/ClassHierarchy.cpp'
--- a/libcore/asobj/ClassHierarchy.cpp  2008-08-19 09:30:27 +0000
+++ b/libcore/asobj/ClassHierarchy.cpp  2008-08-22 15:42:16 +0000
@@ -56,6 +56,7 @@
 #include "Sprite_as.h"
 #include "Stage.h"
 #include "System.h"
+#include "TextFieldAutoSize_as.h"
 #include "TextSnapshot.h"
 #include "TextFormat.h"
 #include "video_stream_instance.h"
@@ -300,7 +301,8 @@
        { interactive_object_class_init, NSV::CLASS_INTERACTIVEOBJECT, 
NSV::CLASS_DISPLAYOBJECT, 9 },
        { display_object_container_class_init, 
NSV::CLASS_DISPLAYOBJECTCONTAINER, NSV::CLASS_INTERACTIVEOBJECT, 9 },
        { sprite_as_class_init, NSV::CLASS_SPRITE, 
NSV::CLASS_DISPLAYOBJECTCONTAINER, 9 },
-       { int_class_init, NSV::CLASS_INT, NSV::CLASS_OBJECT, 9 }
+       { int_class_init, NSV::CLASS_INT, NSV::CLASS_OBJECT, 9 },
+       { text_field_auto_size_class_init, NSV::CLASS_TEXTFIELDAUTOSIZE, 
NSV::CLASS_OBJECT, 9 }
 
 // These classes are all implicitly constructed; that is, it is not necessary 
for
 // the class name to be used to construct the class, so they must always be 
available.

=== modified file 'libcore/asobj/Makefile.am'
--- a/libcore/asobj/Makefile.am 2008-08-19 09:30:27 +0000
+++ b/libcore/asobj/Makefile.am 2008-08-22 15:42:16 +0000
@@ -74,6 +74,7 @@
        Stage.cpp \
        System.cpp \
        TextFormat.cpp \
+       TextFieldAutoSize_as.cpp \
        TextSnapshot.cpp \
        MovieClipLoader.cpp\
        String_as.cpp \
@@ -150,6 +151,7 @@
        Sprite_as.h \
        Stage.h \
        System.h \
+       TextFieldAutoSize_as.h \
        TextFormat.h \
        TextSnapshot.h \
        String_as.h \

=== added file 'libcore/asobj/TextFieldAutoSize_as.cpp'
--- a/libcore/asobj/TextFieldAutoSize_as.cpp    1970-01-01 00:00:00 +0000
+++ b/libcore/asobj/TextFieldAutoSize_as.cpp    2008-08-22 15:42:16 +0000
@@ -0,0 +1,94 @@
+// EventDispatcher.cpp:  Implementation of ActionScript TextFieldAutoSize 
class, for Gnash.
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008 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 3 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
+//
+
+#include "smart_ptr.h"
+#include "fn_call.h"
+#include "as_object.h" // for inheritance
+#include "builtin_function.h" // need builtin_function
+#include "Object.h"
+
+#include "log.h"
+
+#include <string>
+#include <sstream>
+
+namespace gnash {
+void attachTextFieldAutoSizeInterface(as_object& o);
+
+class text_field_auto_size_as_object : public as_object
+{
+
+public:
+
+       text_field_auto_size_as_object()
+               :
+               as_object()
+       {
+       }
+
+};
+
+static as_value
+text_field_auto_size_ctor(const fn_call& fn)
+{
+       boost::intrusive_ptr<as_object> obj = new 
text_field_auto_size_as_object();
+       
+       return as_value(obj.get()); // will keep alive
+}
+
+as_object*
+getTextFieldAutoSizeInterface()
+{
+       static boost::intrusive_ptr<as_object> o;
+       if ( ! o )
+       {
+               o = new as_object(getObjectInterface());
+               attachTextFieldAutoSizeInterface(*o);
+       }
+       return o.get();
+}
+
+// extern (used by Global.cpp)
+void text_field_auto_size_class_init(as_object& global)
+{
+    static boost::intrusive_ptr<builtin_function> cl;
+
+       cl=new builtin_function(&text_field_auto_size_ctor, 
getTextFieldAutoSizeInterface());
+
+       // Register _global.DisplayObject
+       global.init_member("TextFieldAutoSize", cl.get());
+}
+
+std::auto_ptr<as_object>
+init_text_field_auto_size_instance()
+{
+       return std::auto_ptr<as_object>(new text_field_auto_size_as_object);
+}
+
+void
+attachTextFieldAutoSizeInterface(as_object& o)
+{
+       o.init_member("CENTER", as_value("center"));
+       o.init_member("LEFT", as_value("left"));
+       o.init_member("RIGHT", as_value("right"));
+       o.init_member("NONE", as_value("none"));
+}
+
+
+}
\ No newline at end of file

=== added file 'libcore/asobj/TextFieldAutoSize_as.h'
--- a/libcore/asobj/TextFieldAutoSize_as.h      1970-01-01 00:00:00 +0000
+++ b/libcore/asobj/TextFieldAutoSize_as.h      2008-08-22 15:42:16 +0000
@@ -0,0 +1,44 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008 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 3 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
+
+// 
+//
+//
+
+// Implementation for ActionScript TextFieldAutoSize object.
+
+#ifndef GNASH_TEXTFIELDAUTOSIZE_H
+#define GNASH_TEXTFIELDAUTOSIZE_H
+
+#include <memory> // for auto_ptr
+
+namespace gnash {
+
+class as_object;
+
+/// Initialize the global int class
+void text_field_auto_size_class_init(as_object& global);
+
+/// Return an int instance
+std::auto_ptr<as_object> init_text_field_auto_size_instance();
+
+as_object* getTextFieldAutoSizeInterface();
+
+
+}
+
+#endif // GNASH_INT_AS_H

=== modified file 'libcore/namedStrings.cpp'
--- a/libcore/namedStrings.cpp  2008-08-19 17:45:09 +0000
+++ b/libcore/namedStrings.cpp  2008-08-22 15:42:16 +0000
@@ -185,6 +185,7 @@
        string_table::svt( "DisplayObjectContainer", 
NSV::CLASS_DISPLAYOBJECTCONTAINER ),
        string_table::svt( "Sprite", NSV::CLASS_SPRITE ),
        string_table::svt( "int", NSV::CLASS_INT ),
+       string_table::svt( "TextFieldAutoSize", NSV::CLASS_TEXTFIELDAUTOSIZE),
        string_table::svt( "flash.display", NSV::NS_FLASH_DISPLAY ),
        string_table::svt( "flash.text", NSV::NS_FLASH_TEXT ),
        string_table::svt( "flash.geom", NSV::NS_FLASH_GEOM ),

=== modified file 'libcore/namedStrings.h'
--- a/libcore/namedStrings.h    2008-08-19 17:45:09 +0000
+++ b/libcore/namedStrings.h    2008-08-22 15:42:16 +0000
@@ -203,6 +203,7 @@
                CLASS_DISPLAYOBJECTCONTAINER,
                CLASS_SPRITE,
                CLASS_INT,
+               CLASS_TEXTFIELDAUTOSIZE,
                NS_FLASH_DISPLAY,
                NS_FLASH_TEXT,
                NS_FLASH_GEOM,


reply via email to

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