[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: |
Tue, 18 Sep 2007 14:57:23 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/09/18 14:57:23
Modified files:
. : ChangeLog
server : sprite_instance.cpp sprite_instance.h
testsuite/misc-ming.all: DefineEditTextVariableNameTest2.c
Log message:
* server/sprite_instance.{cpp,h}: allow multiple
edit_text_character
to be registered with a single variable name.
* testsuite/misc-ming.all/DefineEditTextVariableNameTest2.c:
success in most tests (one still fails).
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4342&r2=1.4343
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.344&r2=1.345
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.139&r2=1.140
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DefineEditTextVariableNameTest2.c?cvsroot=gnash&r1=1.3&r2=1.4
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4342
retrieving revision 1.4343
diff -u -b -r1.4342 -r1.4343
--- ChangeLog 18 Sep 2007 14:25:57 -0000 1.4342
+++ ChangeLog 18 Sep 2007 14:57:22 -0000 1.4343
@@ -1,5 +1,12 @@
2007-09-18 Sandro Santilli <address@hidden>
+ * server/sprite_instance.{cpp,h}: allow multiple edit_text_character
+ to be registered with a single variable name.
+ * testsuite/misc-ming.all/DefineEditTextVariableNameTest2.c:
+ success in most tests (one still fails).
+
+2007-09-18 Sandro Santilli <address@hidden>
+
* server/dlist.cpp (unload): don't unload again already-unloaded
characters. Fixes the assertion failure in
action_execution_order_test12.sc.
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.344
retrieving revision 1.345
diff -u -b -r1.344 -r1.345
--- server/sprite_instance.cpp 18 Sep 2007 09:49:23 -0000 1.344
+++ server/sprite_instance.cpp 18 Sep 2007 14:57:23 -0000 1.345
@@ -73,6 +73,7 @@
//#define GNASH_DEBUG 1
//#define GNASH_DEBUG_TIMELINE 1
//#define GNASH_DEBUG_REPLACE 1
+//#define DEBUG_DYNTEXT_VARIABLES 1
// Forward declarations
static as_object* getMovieClipInterface();
@@ -1863,10 +1864,14 @@
}
// Try textfield variables
- edit_text_character* etc = get_textfield_variable(name);
+ TextFieldPtrVect* etc = get_textfield_variable(name);
if ( etc )
{
- val->set_string(etc->get_text_value());
+ for (TextFieldPtrVect::iterator i=etc->begin(), e=etc->end();
i!=e; ++i)
+ {
+ TextFieldPtr tf = *i;
+ val->set_string(tf->get_text_value());
+ }
return true;
}
@@ -2209,7 +2214,7 @@
const as_value& val)
{
#ifdef DEBUG_DYNTEXT_VARIABLES
- log_debug(_("sprite[%p]::set_member(%s, %s)"), (void*)this,
string_table::value(name), val.to_debug_string().c_str());
+ //log_debug(_("sprite[%p]::set_member(%s, %s)"), (void*)this,
string_table::value(name).c_str(), val.to_debug_string().c_str());
#endif
if ( val.is_function() )
@@ -2226,14 +2231,18 @@
// property (ie: have a textfield use _x as variable name and
// be scared)
//
- edit_text_character* etc =
get_textfield_variable(string_table::value(name).c_str());
+ TextFieldPtrVect* etc =
get_textfield_variable(string_table::value(name).c_str());
if ( etc )
{
#ifdef DEBUG_DYNTEXT_VARIABLES
- log_debug(_("it's a Text Variable"));
+ log_debug(_("it's a Text Variable, associated with " SIZET_FMT
" TextFields"), etc->size());
#endif
as_environment* env =
const_cast<as_environment*>(&m_as_environment);
- etc->set_text_value(val.to_string(env).c_str());
+ for (TextFieldPtrVect::iterator i=etc->begin(), e=etc->end();
i!=e; ++i)
+ {
+ TextFieldPtr tf = *i;
+ tf->set_text_value(val.to_string(env).c_str());
+ }
}
#ifdef DEBUG_DYNTEXT_VARIABLES
else
@@ -3121,35 +3130,28 @@
// lazy allocation
if ( ! _text_variables.get() )
{
- _text_variables.reset(new TextfieldMap);
+ _text_variables.reset(new TextFieldMap);
}
- // TODO: should variable name be considered case-insensitive ?
- TextfieldMap::iterator it = _text_variables->find(name);
- // Don't replace the original textfiled character
- // TODO: more tests for TextField variables.
- if ( it == _text_variables->end() )
- {
- _text_variables->operator[] (name) = ch;
- }
+ (*_text_variables)[name].push_back(ch);
}
/* private */
-edit_text_character*
+sprite_instance::TextFieldPtrVect*
sprite_instance::get_textfield_variable(const std::string& name)
{
// nothing allocated yet...
if ( ! _text_variables.get() ) return NULL;
// TODO: should variable name be considered case-insensitive ?
- TextfieldMap::iterator it = _text_variables->find(name);
+ TextFieldMap::iterator it = _text_variables->find(name);
if ( it == _text_variables->end() )
{
- return NULL;
+ return 0;
}
else
{
- return it->second.get();
+ return &(it->second);
}
}
@@ -3656,14 +3658,18 @@
// Mark our own definition
if ( m_def.get() ) m_def->setReachable();
- // Mark textfields in the TextfieldMap
+ // Mark textfields in the TextFieldMap
if ( _text_variables.get() )
{
- for(TextfieldMap::const_iterator i=_text_variables->begin(),
+ for(TextFieldMap::const_iterator i=_text_variables->begin(),
e=_text_variables->end();
i!=e; ++i)
{
- i->second->setReachable();
+ const TextFieldPtrVect& tfs=i->second;
+ for (TextFieldPtrVect::const_iterator j=tfs.begin(),
je=tfs.end(); j!=je; ++j)
+ {
+ (*j)->setReachable();
+ }
}
}
Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -b -r1.139 -r1.140
--- server/sprite_instance.h 16 Sep 2007 16:48:13 -0000 1.139
+++ server/sprite_instance.h 18 Sep 2007 14:57:23 -0000 1.140
@@ -913,16 +913,19 @@
bool m_has_mouse_event;
+ typedef boost::intrusive_ptr< edit_text_character > TextFieldPtr;
+ typedef std::vector< TextFieldPtr > TextFieldPtrVect;
+
/// A container for textfields, indexed by their variable name
- typedef std::map< std::string,
boost::intrusive_ptr<edit_text_character> > TextfieldMap;
+ typedef std::map< std::string, TextFieldPtrVect > TextFieldMap;
/// We'll only allocate Textfield variables map if
/// we need them (ie: anyone calls set_textfield_variable)
///
- std::auto_ptr<TextfieldMap> _text_variables;
+ std::auto_ptr<TextFieldMap> _text_variables;
/// \brief
- /// Returns a TextField given it's variable name,
+ /// Returns a vector of TextField associated with the given variable
name,
/// or NULL if no such variable name is known.
//
/// A TextField variable is a variable that acts
@@ -932,7 +935,10 @@
///
/// @todo find out wheter we should be case sensitive or not
///
- edit_text_character* get_textfield_variable(const std::string& name);
+ /// @return a pointer inside a vector, will be invalidated by
modifications
+ /// of the vector (set_textfield_variable)
+ ///
+ TextFieldPtrVect* get_textfield_variable(const std::string& name);
/// soundid for current playing stream. If no stream set to -1
int m_sound_stream_id;
Index: testsuite/misc-ming.all/DefineEditTextVariableNameTest2.c
===================================================================
RCS file:
/sources/gnash/gnash/testsuite/misc-ming.all/DefineEditTextVariableNameTest2.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- testsuite/misc-ming.all/DefineEditTextVariableNameTest2.c 18 Sep 2007
11:33:52 -0000 1.3
+++ testsuite/misc-ming.all/DefineEditTextVariableNameTest2.c 18 Sep 2007
14:57:23 -0000 1.4
@@ -149,15 +149,15 @@
add_actions(mo, "edit_text_var = 'Hahaha'; ");
check_equals(mo, "edit_text_var", "'Hahaha'");
check_equals(mo, "dtext1.text", "'Hahaha'");
- xcheck_equals(mo, "dtext2.text", "'Hahaha'");
- xcheck_equals(mo, "dtext3.text", "'Hahaha'");
+ check_equals(mo, "dtext2.text", "'Hahaha'");
+ check_equals(mo, "dtext3.text", "'Hahaha'");
add_actions(mo, "dtext1.variable = 'newName'; ");
// Maybe 'variable' is the connection point?
xcheck_equals(mo, "dtext1.text", "'Hello'");
// Change 'variable' back to its orignal string.
add_actions(mo, "dtext1.variable = 'edit_text_var'; ");
- xcheck_equals(mo, "dtext1.text", "'Hahaha'");
+ check_equals(mo, "dtext1.text", "'Hahaha'");
SWFMovie_nextFrame(mo);
// Frame6: remove dtext1
@@ -195,7 +195,7 @@
add_actions(mo, "edit_text_var = new Object();");
check_equals(mo, "typeof(edit_text_var)", "'object'");
check_equals(mo, "typeof(dtext4.text)", "'string'");
- xcheck_equals(mo, "dtext4.text", "'[object Object]'");
+ check_equals(mo, "dtext4.text", "'[object Object]'");
SWFMovie_nextFrame(mo);
// Frame 11: provide a user defined toString for edit_text_var
@@ -203,23 +203,23 @@
add_actions(mo, "Object.prototype.toString = function() {return
'TO_STRING';}; ");
check_equals(mo, "typeof(dtext4.text)", "'string'");
// Object.prototype.toString not invoked for dtext4.text!
- xcheck_equals(mo, "dtext4.text", "'[object Object]'");
+ check_equals(mo, "dtext4.text", "'[object Object]'");
check_equals(mo, "typeof(dtext4.text.toString)", "'function'");
- xcheck_equals(mo, "dtext4.text.toString()", "'[object Object]'");
- xcheck_equals(mo, "dtext4.text.valueOf()", "'[object Object]'");
+ check_equals(mo, "dtext4.text.toString()", "'[object Object]'");
+ check_equals(mo, "dtext4.text.valueOf()", "'[object Object]'");
SWFMovie_nextFrame(mo);
// Frame 12: dtext4.text still not updated
// Deduction: dtext4.text won't update if edit_text_var is untouched.
check_equals(mo, "edit_text_var.toString()", "'TO_STRING'");
- xcheck_equals(mo, "dtext4.text", "'[object Object]'");
+ check_equals(mo, "dtext4.text", "'[object Object]'");
SWFMovie_nextFrame(mo);
// Frame 13: dtext4.text updated.
// Deduction: setting edit_text_var triggered updating dtext4.text.
add_actions(mo, "edit_text_var = new Object();");
check_equals(mo, "edit_text_var.toString()", "'TO_STRING'");
- xcheck_equals(mo, "dtext4.text", "'TO_STRING'");
+ check_equals(mo, "dtext4.text", "'TO_STRING'");
SWFMovie_nextFrame(mo);
// Frame 14: end
- [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv..., Sandro Santilli, 2007/09/04
- [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv..., Sandro Santilli, 2007/09/07
- [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv..., Sandro Santilli, 2007/09/13
- [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv..., Sandro Santilli, 2007/09/17
- [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv...,
Sandro Santilli <=
- [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv..., Sandro Santilli, 2007/09/19
- [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv..., Sandro Santilli, 2007/09/24