gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11009: Migrated accessibility code


From: Jon Crider
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11009: Migrated accessibility code into new class hierarchy
Date: Fri, 05 Jun 2009 14:31:43 -0600
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11009
committer: Jon Crider <address@hidden>
branch nick: trunk
timestamp: Fri 2009-06-05 14:31:43 -0600
message:
  Migrated accessibility code into new class hierarchy
removed:
  libcore/asobj/Accessibility_as.cpp
  libcore/asobj/Accessibility_as.h
modified:
  libcore/ClassHierarchy.cpp
  libcore/asobj/Makefile.am
  libcore/asobj/flash/accessibility/Accessibility.cpp
  libcore/asobj/flash/accessibility/Accessibility_as.cpp
  libcore/asobj/flash/accessibility/accessibility.am
    ------------------------------------------------------------
    revno: 10997.1.1
    committer: Jon Crider <address@hidden>
    branch nick: srcmv1
    timestamp: Fri 2009-06-05 14:25:23 -0600
    message:
      Migrated accessibility code into new class hierarchy
    removed:
      libcore/asobj/Accessibility_as.cpp
      libcore/asobj/Accessibility_as.h
    modified:
      libcore/ClassHierarchy.cpp
      libcore/asobj/Makefile.am
      libcore/asobj/flash/accessibility/Accessibility.cpp
      libcore/asobj/flash/accessibility/Accessibility_as.cpp
      libcore/asobj/flash/accessibility/accessibility.am
=== modified file 'libcore/ClassHierarchy.cpp'
--- a/libcore/ClassHierarchy.cpp        2009-06-04 21:48:41 +0000
+++ b/libcore/ClassHierarchy.cpp        2009-06-05 20:31:43 +0000
@@ -22,7 +22,7 @@
 #include "as_function.h" // for function_class_init
 #include "Button.h"
 #include "AsBroadcaster.h"
-#include "Accessibility_as.h"
+#include "flash/accessibility/Accessibility_as.h"
 #include "Boolean_as.h"
 #include "Camera.h"
 #include "Color_as.h"
@@ -340,7 +340,7 @@
        { moviecliploader_class_init, NSV::CLASS_MOVIE_CLIP_LOADER,
         NSV::CLASS_OBJECT, NS_GLOBAL, 7 },
        { Error_class_init, NSV::CLASS_ERROR, NSV::CLASS_OBJECT, NS_GLOBAL, 5 },
-       { Accessibility_class_init, NSV::CLASS_ACCESSIBILITY, NSV::CLASS_OBJECT,
+       { accessibility_class_init, NSV::CLASS_ACCESSIBILITY, NSV::CLASS_OBJECT,
           NSV::NS_FLASH_ACCESSIBILITY, 5 },
        { int_class_init, NSV::CLASS_INT, NSV::CLASS_OBJECT, NS_GLOBAL, 9 },
        { namespace_class_init, NSV::CLASS_NAMESPACE, NSV::CLASS_OBJECT,

=== removed file 'libcore/asobj/Accessibility_as.cpp'
--- a/libcore/asobj/Accessibility_as.cpp        2009-02-25 22:33:03 +0000
+++ b/libcore/asobj/Accessibility_as.cpp        1970-01-01 00:00:00 +0000
@@ -1,95 +0,0 @@
-// Accessibility_as.cpp:  ActionScript "Accessibility" class, for Gnash.
-//
-//   Copyright (C) 2005, 2006, 2007, 2008, 2009 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
-//
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-#include "Accessibility_as.h"
-#include "as_object.h" // for inheritance
-#include "log.h"
-#include "fn_call.h"
-#include "smart_ptr.h" // for boost intrusive_ptr
-#include "builtin_function.h" // need builtin_function
-#include "GnashException.h" // for ActionException
-#include "Object.h" // for AS inheritance
-#include "VM.h" // for addStatics
-
-#include <sstream>
-
-namespace gnash {
-
-static as_value Accessibility_isActive(const fn_call& fn);
-static as_value Accessibility_updateProperties(const fn_call& fn);
-static as_value Accessibility_sendEvent(const fn_call& fn);
-
-as_value Accessibility_ctor(const fn_call& fn);
-
-static void
-attachAccessibilityInterface(as_object& o)
-{
-    const int flags = as_prop_flags::dontDelete
-                | as_prop_flags::readOnly;
-
-    o.init_member("isActive", new builtin_function(Accessibility_isActive), 
flags);
-    o.init_member("updateProperties", new 
builtin_function(Accessibility_updateProperties), flags);
-    o.init_member("sendEvent", new builtin_function(Accessibility_sendEvent), 
flags);
-}
-
-
-static as_value
-Accessibility_isActive(const fn_call& fn)
-{
-       boost::intrusive_ptr<as_object> ptr = 
ensureType<as_object>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
-
-static as_value
-Accessibility_updateProperties(const fn_call& fn)
-{
-       boost::intrusive_ptr<as_object> ptr = 
ensureType<as_object>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
-
-static as_value
-Accessibility_sendEvent(const fn_call& fn)
-{
-       boost::intrusive_ptr<as_object> ptr = 
ensureType<as_object>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
-
-// extern 
-void Accessibility_class_init(as_object& where)
-{
-       // This is going to be the Accessibility "class"/"function"
-       // in the 'where' package
-       boost::intrusive_ptr<as_object> obj = new 
as_object(getObjectInterface());
-       attachAccessibilityInterface(*obj);
-
-       // Register _global.Accessibility
-       where.init_member("Accessibility", obj.get());
-}
-
-} // end of gnash namespace

=== removed file 'libcore/asobj/Accessibility_as.h'
--- a/libcore/asobj/Accessibility_as.h  2009-02-25 22:33:03 +0000
+++ b/libcore/asobj/Accessibility_as.h  1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-// Accessibility_as.h:  ActionScript "Accessibility" class, for Gnash.
-//
-//   Copyright (C) 2005, 2006, 2007, 2008, 2009 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
-//
-
-#ifndef GNASH_ASOBJ_ACCESSIBILITY_H
-#define GNASH_ASOBJ_ACCESSIBILITY_H
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-//#include <smart_ptr.h> // for intrusive_ptr and GC stuff
-
-namespace gnash {
-
-class as_object;
-
-/// Initialize the global Accessibility class
-void Accessibility_class_init(as_object& global);
-
-/// Return a Accessibility instance (in case the core lib needs it)
-//boost::intrusive_ptr<as_object> init_Accessibility_instance();
-
-} // end of gnash namespace
-
-// GNASH_ASOBJ_ACCESSIBILITY_H
-#endif

=== modified file 'libcore/asobj/Makefile.am'
--- a/libcore/asobj/Makefile.am 2009-06-04 21:48:41 +0000
+++ b/libcore/asobj/Makefile.am 2009-06-05 20:31:43 +0000
@@ -51,9 +51,9 @@
        $(BOOST_CFLAGS) \
        $(FREETYPE2_CFLAGS)
 
+#      Accessibility_as.cpp 
 libgnashasobjs_la_SOURCES = \
        AsBroadcaster.cpp \
-       Accessibility_as.cpp \
        Array_as.cpp \
        Boolean_as.cpp \
        Camera.cpp \
@@ -88,9 +88,9 @@
        LoadableObject.cpp \
        Object.cpp
 
+#      Accessibility_as.h 
 noinst_HEADERS = \
        AsBroadcaster.h \
-       Accessibility_as.h \
        Boolean_as.h \
        Camera.h \
        Color_as.h      \

=== modified file 'libcore/asobj/flash/accessibility/Accessibility.cpp'
--- a/libcore/asobj/flash/accessibility/Accessibility.cpp       2009-05-25 
02:00:57 +0000
+++ b/libcore/asobj/flash/accessibility/Accessibility.cpp       2009-06-05 
20:25:23 +0000
@@ -22,6 +22,7 @@
 #endif
 
 #include "accessibility/Accessibility_as.h"
+#include "as_object.h" // for inheritance
 #include "log.h"
 #include "fn_call.h"
 #include "smart_ptr.h" // for boost intrusive_ptr
@@ -30,6 +31,8 @@
 #include "Object.h" // for AS inheritance
 #include "VM.h" // for addStatics
 
+#include <sstream>
+
 namespace gnash {
 
 as_value accessibility_ctor(const fn_call& fn);
@@ -73,7 +76,7 @@
 }
 
 // extern (used by Global.cpp)
-void accessibility_class_init(as_object& global)
+void Accessibility_class_init(as_object& global)
 {
     boost::intrusive_ptr<as_object> obj = new as_object(getObjectInterface());
     attachAccessibilityInterface(*obj);
@@ -81,7 +84,7 @@
 }
 
 as_value
-accessibility_ctor(const fn_call& /* fn */)
+Accessibility_ctor(const fn_call& /* fn */)
 {
     GNASH_REPORT_FUNCTION;
     boost::intrusive_ptr<as_object> obj = new Accessibility_as;

=== modified file 'libcore/asobj/flash/accessibility/Accessibility_as.cpp'
--- a/libcore/asobj/flash/accessibility/Accessibility_as.cpp    2009-05-28 
17:09:36 +0000
+++ b/libcore/asobj/flash/accessibility/Accessibility_as.cpp    2009-06-05 
20:25:23 +0000
@@ -22,11 +22,12 @@
 #endif
 
 #include "accessibility/Accessibility_as.h"
+#include "as_object.h" // for inheritance
 #include "log.h"
 #include "fn_call.h"
 #include "smart_ptr.h" // for boost intrusive_ptr
 #include "builtin_function.h" // need builtin_function
-#include "GnashException.h" // for ActionException
+#include "Object.h" // for AS inheritance
 
 namespace gnash {
 
@@ -37,6 +38,10 @@
     void attachAccessibilityStaticInterface(as_object& o);
     as_object* getAccessibilityInterface();
 
+    as_value Accessibility_isActive(const fn_call& fn);
+    as_value Accessibility_active(const fn_call& fn);
+    as_value Accessibility_updateProperties(const fn_call& fn);
+    as_value Accessibility_sendEvent(const fn_call& fn);
 }
 
 class Accessibility_as : public as_object
@@ -53,15 +58,11 @@
 // extern (used by Global.cpp)
 void accessibility_class_init(as_object& global)
 {
-    static boost::intrusive_ptr<builtin_function> cl;
-
-    if (!cl) {
-        cl = new builtin_function(&accessibility_ctor, 
getAccessibilityInterface());
-        attachAccessibilityStaticInterface(*cl);
-    }
-
+
+    boost::intrusive_ptr<as_object> obj = new as_object(getObjectInterface());
+    attachAccessibilityInterface(*obj);
     // Register _global.Accessibility
-    global.init_member("Accessibility", cl.get());
+    global.init_member("Accessibility", obj.get());
 }
 
 namespace {
@@ -69,6 +70,21 @@
 void
 attachAccessibilityInterface(as_object& o)
 {
+    const int flags = as_prop_flags::dontDelete
+                | as_prop_flags::readOnly;
+
+    const VM& vm = o.getVM();
+    // For swf v9 or greater, the isActive() method has been changed to a
+    // the property "active".
+    if ( vm.getSWFVersion() >= 9 ) {
+       o.init_member("active", new builtin_function(Accessibility_active), 
flags);
+    } else {
+       o.init_member("isActive", new builtin_function(Accessibility_isActive), 
flags);
+       o.init_member("sendEvent", new 
builtin_function(Accessibility_sendEvent), flags);
+    }
+    
+    o.init_member("updateProperties", new 
builtin_function(Accessibility_updateProperties), flags);
+
 }
 
 void
@@ -96,6 +112,47 @@
     return as_value(obj.get()); // will keep alive
 }
 
+
+as_value
+Accessibility_isActive(const fn_call& fn)
+{
+       boost::intrusive_ptr<as_object> ptr = 
ensureType<as_object>(fn.this_ptr);
+       UNUSED(ptr);
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+Accessibility_active(const fn_call& fn)
+{
+    GNASH_REPORT_FUNCTION;
+    
+//     boost::intrusive_ptr<as_object> ptr = 
ensureType<as_object>(fn.this_ptr);
+//     UNUSED(ptr);
+    LOG_ONCE( log_unimpl (__FUNCTION__) );
+    return as_value(false);
+}
+
+as_value
+Accessibility_updateProperties(const fn_call& fn)
+{
+    GNASH_REPORT_FUNCTION;
+    boost::intrusive_ptr<as_object> ptr = ensureType<as_object>(fn.this_ptr);
+    UNUSED(ptr);
+    LOG_ONCE( log_unimpl (__FUNCTION__) );
+    return as_value();
+}
+
+as_value
+Accessibility_sendEvent(const fn_call& fn)
+{
+    GNASH_REPORT_FUNCTION;
+    boost::intrusive_ptr<as_object> ptr = ensureType<as_object>(fn.this_ptr);
+    UNUSED(ptr);
+    LOG_ONCE( log_unimpl (__FUNCTION__) );
+    return as_value();
+}
+
 } // anonymous namespace 
 } // gnash namespace
 

=== modified file 'libcore/asobj/flash/accessibility/accessibility.am'
--- a/libcore/asobj/flash/accessibility/accessibility.am        2009-06-05 
12:55:19 +0000
+++ b/libcore/asobj/flash/accessibility/accessibility.am        2009-06-05 
20:31:43 +0000
@@ -26,7 +26,7 @@
 endif
 
 if BUILD_ACCESSIBILITY_AS3
-# ACCESSIBILITY_SOURCES += flash/accessibility/Accessibility_as.cpp
+ACCESSIBILITY_SOURCES += flash/accessibility/Accessibility_as.cpp
 ACCESSIBILITY_HEADERS += flash/accessibility/Accessibility_as.h
 endif
 


reply via email to

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