[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv... |
Date: |
Thu, 21 Dec 2006 12:06:53 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/12/21 12:06:52
Modified files:
. : ChangeLog
server : sprite_instance.cpp sprite_instance.h
Log message:
* server/sprite_instance.h: add a static integer keeping
number of unnamed character placements and a function
to return a syntetized name for them.
* server/sprite_instance.cpp (add_display_object): always
provide a name for placed object, syntetizing it if
not provided. This is needed for MOVIECLIP as_values,
now that they basically store a clip's target.
This is experimental, Zou should have a testcase for
this, which would help making it stable.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1986&r2=1.1987
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.112&r2=1.113
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.50&r2=1.51
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1986
retrieving revision 1.1987
diff -u -b -r1.1986 -r1.1987
--- ChangeLog 21 Dec 2006 11:34:48 -0000 1.1986
+++ ChangeLog 21 Dec 2006 12:06:52 -0000 1.1987
@@ -1,5 +1,17 @@
2006-12-21 Sandro Santilli <address@hidden>
+ * server/sprite_instance.h: add a static integer keeping
+ number of unnamed character placements and a function
+ to return a syntetized name for them.
+ * server/sprite_instance.cpp (add_display_object): always
+ provide a name for placed object, syntetizing it if
+ not provided. This is needed for MOVIECLIP as_values,
+ now that they basically store a clip's target.
+ This is experimental, Zou should have a testcase for
+ this, which would help making it stable.
+
+2006-12-21 Sandro Santilli <address@hidden>
+
* testsuite/actionscript.all/String.as: check that no automatic
converstion to String object is performed on a string literal
when instanceOf is called on it.
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- server/sprite_instance.cpp 21 Dec 2006 11:34:49 -0000 1.112
+++ server/sprite_instance.cpp 21 Dec 2006 12:06:52 -0000 1.113
@@ -62,6 +62,9 @@
namespace gnash {
+// Initialize unnamed instance count
+unsigned int sprite_instance::_lastUnnamedInstanceNum=0;
+
//------------------------------------------------
// Utility funx
//------------------------------------------------
@@ -2492,10 +2495,16 @@
boost::intrusive_ptr<character> ch =
cdef->create_character_instance(this,
character_id);
assert(ch.get() != NULL);
- if (name != NULL && name[0] != 0)
- {
- ch->set_name(name);
- }
+
+ // Syntetize an instance name if this character doesn't have one
+ // TODO: check if we need to do this *only* for sprite characters
+ // also, consider asking for "nextInstanceName" to the
character
+ // definition...
+ std::string instance_name;
+ if ( name ) instance_name = name;
+ else instance_name = getNextUnnamedInstanceName();
+
+ ch->set_name(instance_name.c_str());
// Attach event handlers (if any).
{for (int i = 0, n = event_handlers.size(); i < n; i++)
@@ -3040,4 +3049,13 @@
_target_dot.clear();
}
+/*private static*/
+std::string
+sprite_instance::getNextUnnamedInstanceName()
+{
+ std::stringstream ss;
+ ss << "instance" << ++_lastUnnamedInstanceNum;
+ return ss.str();
+}
+
} // namespace gnash
Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- server/sprite_instance.h 18 Dec 2006 15:51:35 -0000 1.50
+++ server/sprite_instance.h 21 Dec 2006 12:06:52 -0000 1.51
@@ -17,7 +17,7 @@
//
//
-/* $Id: sprite_instance.h,v 1.50 2006/12/18 15:51:35 strk Exp $ */
+/* $Id: sprite_instance.h,v 1.51 2006/12/21 12:06:52 strk Exp $ */
// Stateful live Sprite instance
@@ -37,6 +37,7 @@
#include <vector>
#include <list>
#include <map>
+#include <string>
// Forward declarations
namespace gnash {
@@ -282,6 +283,9 @@
///
/// @param name
/// The name to give to the newly created instance.
+ /// If NULL, the new instance will be assigned a sequential
+ /// name in the form 'instanceN', where N is incremented
+ /// at each call, starting from 1.
///
/// @param event_handlers
///
@@ -552,6 +556,12 @@
private:
+ // Used to assign a name to unnamed (movieclip-only?) instances
+ static unsigned int _lastUnnamedInstanceNum;
+
+ // Used to assign a name to unnamed (movieclip-only?) instances
+ static std::string getNextUnnamedInstanceName();
+
/// Execute a single action buffer (DOACTION block)
void execute_action(action_buffer& ab);