gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/character.h server/sprit...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/character.h server/sprit...
Date: Thu, 24 May 2007 13:01:47 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/05/24 13:01:47

Modified files:
        .              : ChangeLog 
        server         : character.h sprite_instance.cpp 
                         video_stream_instance.h 
        testsuite/misc-ming.all: replace_shapes1test.c shape_test.c 

Log message:
                * server/character.h: add isActionScriptReferenciable()
                  method to find "scriptable objects". See:
                  http://www.gnashdev.org/wiki/index.php/ScriptableCharacters
                * server/sprite_instance.cpp (get_member, get_relative_target):
                  When requested name matches a NON scriptable instance, return
                  self.
                * server/video_stream_instance.h: implement wantsInstanceName()
                  [ used by isActionScriptReferenciable ]
                * testsuite/misc-ming.all/replace_shapes1test.c: expect less 
failures.
                * testsuite/misc-ming.all/shape_test.c: don't expect any more 
failure

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3338&r2=1.3339
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.78&r2=1.79
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.277&r2=1.278
http://cvs.savannah.gnu.org/viewcvs/gnash/server/video_stream_instance.h?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/replace_shapes1test.c?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/shape_test.c?cvsroot=gnash&r1=1.1&r2=1.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3338
retrieving revision 1.3339
diff -u -b -r1.3338 -r1.3339
--- ChangeLog   24 May 2007 12:08:03 -0000      1.3338
+++ ChangeLog   24 May 2007 13:01:46 -0000      1.3339
@@ -1,5 +1,18 @@
 2007-05-24 Sandro Santilli <address@hidden>
 
+       * server/character.h: add isActionScriptReferenciable() 
+         method to find "scriptable objects". See:
+         http://www.gnashdev.org/wiki/index.php/ScriptableCharacters
+       * server/sprite_instance.cpp (get_member, get_relative_target):
+         When requested name matches a NON scriptable instance, return
+         self.
+       * server/video_stream_instance.h: implement wantsInstanceName()
+         [ used by isActionScriptReferenciable ]
+       * testsuite/misc-ming.all/replace_shapes1test.c: expect less failures.
+       * testsuite/misc-ming.all/shape_test.c: don't expect any more failure
+
+2007-05-24 Sandro Santilli <address@hidden>
+
        * testsuite/misc-ming.all/: Makefile.am,
          replace_buttons1test.c, replace_buttons1test_runner.cpp:
          New test for buttons replacement.

Index: server/character.h
===================================================================
RCS file: /sources/gnash/gnash/server/character.h,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -b -r1.78 -r1.79
--- server/character.h  23 May 2007 16:38:31 -0000      1.78
+++ server/character.h  24 May 2007 13:01:46 -0000      1.79
@@ -18,7 +18,7 @@
 //
 //
 
-/* $Id: character.h,v 1.78 2007/05/23 16:38:31 strk Exp $ */
+/* $Id: character.h,v 1.79 2007/05/24 13:01:46 strk Exp $ */
 
 #ifndef GNASH_CHARACTER_H
 #define GNASH_CHARACTER_H
@@ -839,6 +839,15 @@
                return false; 
        }
 
+       /// Returns true when the object (type) can be referenced by ActionScipt
+       bool isActionScriptReferenceable()
+       {
+               // The way around
+               // [ wantsInstanceName() returning 
isActionScriptReferenceable() ]
+               // would be cleaner, but I wouldn't want to touch all files now.
+               return wantsInstanceName();
+       }
+
        /// @}
 
        /// \brief

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.277
retrieving revision 1.278
diff -u -b -r1.277 -r1.278
--- server/sprite_instance.cpp  24 May 2007 11:30:15 -0000      1.277
+++ server/sprite_instance.cpp  24 May 2007 13:01:46 -0000      1.278
@@ -1872,7 +1872,18 @@
        if (ch)
        {
            // Found object.
-           val->set_as_object(static_cast<as_object*>(ch));
+
+           // If the object is an ActionScript referenciable one we
+           // return it, otherwise we return ourselves
+           if ( ch->isActionScriptReferenceable() )
+           {
+                   val->set_as_object(ch);
+           }
+           else
+           {
+                   val->set_as_object(this);
+           }
+
            return true;
        }
 
@@ -2105,8 +2116,9 @@
 //            GNASH_REPORT_FUNCTION;
 
     character* ch = m_display_list.get_character_by_name(name);
-    if (ch)
+    if (ch) // TODO: should we check for isActionScriptReferenceable here ?
        {
+
            std::vector<swf_event*>     dummy_event_handlers;
 
            add_display_object(
@@ -2134,7 +2146,7 @@
 //         GNASH_REPORT_FUNCTION;
 
        character* ch = m_display_list.get_character_by_name(name.c_str());
-       if (ch)
+       if (ch) // TODO: should we check for isActionScriptReferenceable here ?
        {
            // @@ TODO: should only remove movies that were created via 
clone_display_object --
            // apparently original movies, placed by anim events, are immune to 
this.
@@ -2205,14 +2217,20 @@
 sprite_instance::get_relative_target(const std::string& name)
 {
        character* ch = get_relative_target_common(name);
+       if ( ch ) return ch;
 
-       if ( ! ch )
-       {
                // See if we have a match on the display list.
-               return m_display_list.get_character_by_name(name);
+       ch =  m_display_list.get_character_by_name(name);
+       // TODO: should we check for isActionScriptReferenceable here ?
+       if ( ch )
+       {
+               // If the object is an ActionScript referenciable one we
+               // return it, otherwise we return ourselves
+               if ( ch->isActionScriptReferenceable() ) return ch;
+               else return this;
        }
 
-       return ch; // possibly NULL
+       return NULL;
 }
 
 void sprite_instance::set_member(const std::string& name,

Index: server/video_stream_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/video_stream_instance.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/video_stream_instance.h      3 May 2007 15:41:06 -0000       1.11
+++ server/video_stream_instance.h      24 May 2007 13:01:46 -0000      1.12
@@ -15,7 +15,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 // 
-// $Id: video_stream_instance.h,v 1.11 2007/05/03 15:41:06 strk Exp $
+// $Id: video_stream_instance.h,v 1.12 2007/05/24 13:01:46 strk Exp $
 
 #ifndef GNASH_VIDEO_STREAM_INSTANCE_H
 #define GNASH_VIDEO_STREAM_INSTANCE_H
@@ -57,6 +57,12 @@
        virtual void    advance(float delta_time);
        void    display();
 
+       // For sure isActionScriptReferenceable...
+       bool wantsInstanceName()
+       {
+               return true; // text fields can be referenced 
+       }       
+
        void add_invalidated_bounds(InvalidatedRanges& ranges, bool force);
 
        /// Set the input stream for this video

Index: testsuite/misc-ming.all/replace_shapes1test.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/replace_shapes1test.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- testsuite/misc-ming.all/replace_shapes1test.c       24 May 2007 09:14:48 
-0000      1.5
+++ testsuite/misc-ming.all/replace_shapes1test.c       24 May 2007 13:01:47 
-0000      1.6
@@ -150,16 +150,16 @@
                        ), SWFACTION_CONSTRUCT);
   add_actions(mo, "static1.name='static1';"); 
 
-  xcheck_equals(mo, "typeof(static1)", "'movieclip'"); 
-  xcheck_equals(mo, "static1", "_root");
+  check_equals(mo, "typeof(static1)", "'movieclip'"); 
+  check_equals(mo, "static1", "_root");
   check_equals(mo, "static1.name", "'static1'");
-  xcheck_equals(mo, "_root.name", "'static1'");
+  check_equals(mo, "_root.name", "'static1'");
 
   // Gnash allows custom members to shape characters...
   // this is important to verify, see next check for it after REPLACE
   check_equals(mo, "static1.name", "'static1'");
 
-  xcheck_equals(mo, "static1._target", "'/'");
+  check_equals(mo, "static1._target", "'/'");
   SWFMovie_nextFrame(mo); 
 
   // Frame 3: replace instance at depth -16381 with character 2
@@ -185,7 +185,7 @@
   xcheck_equals(mo, "typeof(static1)", "'movieclip'"); 
   xcheck_equals(mo, "static1", "_root");
   xcheck_equals(mo, "static1.name", "'static1'");
-  xcheck_equals(mo, "_root.name", "'static1'");
+  check_equals(mo, "_root.name", "'static1'");
 
   // While the new name results undefined...
   xcheck_equals(mo, "typeof(static2)", "'undefined'"); // the name wasn't 
changed
@@ -211,10 +211,10 @@
     "check_equals(typeof(_root.depth3Constructed), 'undefined');"
 
     // Original character name is still referenceable
-    "xcheck_equals(typeof(static1), 'movieclip');"
+    "check_equals(typeof(static1), 'movieclip');"
 
     // And it still has it's user-provided property
-    "xcheck_equals(static1.name, 'static1');"
+    "check_equals(static1.name, 'static1');"
 
     // We can't check the color or the _x in a self-contained testcase 
unfortunately,
     // we'll need a MovieTester-based runner for this.

Index: testsuite/misc-ming.all/shape_test.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/shape_test.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- testsuite/misc-ming.all/shape_test.c        23 May 2007 06:54:42 -0000      
1.1
+++ testsuite/misc-ming.all/shape_test.c        24 May 2007 13:01:47 -0000      
1.2
@@ -68,32 +68,36 @@
   check(mo, "sh1 != undefined");
   check(mo, "sh2 != undefined");
   
-  add_actions(mo, 
        // Do these checks mean that shapes are movieclips?
-    "xcheck_equals(typeof(sh1), 'movieclip');"
-    "xcheck_equals(typeof(sh2), 'movieclip');"
+  check_equals(mo, "typeof(sh1)", "'movieclip'");
+  check_equals(mo, "typeof(sh2)", "'movieclip'");
     
+  add_actions(mo, 
     "sh1.var1 = 10;"
     "sh2.var2 = 20;"
+    );
+
     // Do these checks mean that we can add variables to shapes?
-    "check_equals(sh1.var1, 10);"
-    "check_equals(sh2.var2, 20);"
+  check_equals(mo, "sh1.var1", "10");
+  check_equals(mo, "sh2.var2", "20");
+  check_equals(mo, "sh1._x", "0");
+  check_equals(mo, "sh2._x", "0");
 
-    "xcheck_equals(sh1._x, 0);"
-    "xcheck_equals(sh2._x, 0);"
+  add_actions(mo, 
     "sh1._x = 0;"
     "sh2._x = 400;"
-    "xcheck_equals(sh1._x, 400);" //odd, why???
-    "check_equals(sh2._x, 400);"
+    );
+
+  check_equals(mo, "sh1._x", "400");
+  check_equals(mo, "sh2._x", "400");
     
     // Do these checks mean that shapes are *not* movieclips?
-    "check_equals(typeof(sh1.getDepth()), 'undefined');"
-    "check_equals(typeof(sh2.getDepth()), 'undefined');"
+  check_equals(mo, "typeof(sh1.getDepth())", "'undefined'");
+  check_equals(mo, "typeof(sh2.getDepth())", "'undefined'");
     
     // Do these checks mean that shapes are *not* movieclips?
-    "check_equals(typeof(getInstanceAtDepth(-16381)), 'undefined');"
-    "check_equals(typeof(getInstanceAtDepth(-16380)), 'undefined');"
-  );
+  check_equals(mo, "typeof(getInstanceAtDepth(-16381))", "'undefined'");
+  check_equals(mo, "typeof(getInstanceAtDepth(-16380))", "'undefined'");
 
   add_actions(mo, "_root.totals(); stop();");
 




reply via email to

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