CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/09/20 15:44:41
Modified files: . : ChangeLog server : edit_text_character.cpp testsuite/misc-swfc.all: edittext_test1.sc Log message: * server/edit_text_character.cpp (set_variable_name): create the new variable if it doesn't exist in registering sprite. * testsuite/misc-swfc.all/edittext_test1.sc: no more failures here, but I'm sure it would be easy to break gnash more. Zou, good luck :) CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4361&r2=1.4362 http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.119&r2=1.120 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-swfc.all/edittext_test1.sc?cvsroot=gnash&r1=1.5&r2=1.6 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4361 retrieving revision 1.4362 diff -u -b -r1.4361 -r1.4362 --- ChangeLog 20 Sep 2007 14:07:30 -0000 1.4361 +++ ChangeLog 20 Sep 2007 15:44:40 -0000 1.4362 @@ -1,5 +1,13 @@ 2007-09-20 Sandro Santilli <[EMAIL PROTECTED]> + * server/edit_text_character.cpp (set_variable_name): create + the new variable if it doesn't exist in registering sprite. + * testsuite/misc-swfc.all/edittext_test1.sc: no more failures + here, but I'm sure it would be easy to break gnash more. + Zou, good luck :) + +2007-09-20 Sandro Santilli <[EMAIL PROTECTED]> + * server/edit_text_character.{cpp,h}: add an updateText method intended to be called by sprite_instance when a registered text variable is updated; have set_text_value forward the Index: server/edit_text_character.cpp =================================================================== RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v retrieving revision 1.119 retrieving revision 1.120 diff -u -b -r1.119 -r1.120 --- server/edit_text_character.cpp 20 Sep 2007 14:07:31 -0000 1.119 +++ server/edit_text_character.cpp 20 Sep 2007 15:44:41 -0000 1.120 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: edit_text_character.cpp,v 1.119 2007/09/20 14:07:31 strk Exp $ */ +/* $Id: edit_text_character.cpp,v 1.120 2007/09/20 15:44:41 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -740,7 +740,7 @@ else { // nothing to do (too early ?) - log_debug("set_text_value: variable name %s points to an unexisting sprite", _variable_name.c_str()); + log_debug("set_text_value: variable name %s points to an unexisting sprite, I guess we would not be registered in this was true, or the sprite we've registered our variable name has been unloaded", _variable_name.c_str()); } } } @@ -1504,6 +1504,10 @@ { //#define DEBUG_DYNTEXT_VARIABLES 1 +#ifdef DEBUG_DYNTEXT_VARIABLES + log_debug(_("registerTextVariable() called")); +#endif + if ( _text_variable_registered ) { #ifdef DEBUG_DYNTEXT_VARIABLES @@ -1525,11 +1529,11 @@ sprite_instance* sprite = varRef.first; if ( ! sprite ) { - IF_VERBOSE_MALFORMED_SWF( + //IF_VERBOSE_MALFORMED_SWF( log_swferror(_("VariableName associated to text field (%s) refer to an unknown target. " "It is possible that the character will be instantiated later in the SWF stream. " "Gnash will try to register again on next access."), _variable_name.c_str()); - ); + //); return; } @@ -1547,15 +1551,19 @@ // as_environment& env = get_environment(); set_text_value(val.to_string().c_str()); } -#ifdef DEBUG_DYNTEXT_VARIABLES else { +#ifdef DEBUG_DYNTEXT_VARIABLES log_msg(_("target sprite (%p) does NOT have a member named %s (no problem, we'll add it)"), (void*)sprite, _vm.getStringTable().value(key).c_str()); - } #endif + sprite->set_member(key, as_value(_text)); + } // add the textfield variable to the target sprite // TODO: have set_textfield_variable take a string_table::key instead ? +#ifdef DEBUG_DYNTEXT_VARIABLES + log_debug("Calling set_textfield_variable(%s) against sprite %s", _vm.getStringTable().value(key).c_str(), sprite->getTarget().c_str()); +#endif sprite->set_textfield_variable(_vm.getStringTable().value(key), this); _text_variable_registered=true; @@ -1568,7 +1576,14 @@ { _variable_name = newname; _text_variable_registered = false; - set_text_value(m_def->get_default_text().c_str()); + //set_text_value(m_def->get_default_text().c_str()); +#ifdef DEBUG_DYNTEXT_VARIABLES + log_debug("Calling updateText after change of variable name"); +#endif + updateText(m_def->get_default_text()); +#ifdef DEBUG_DYNTEXT_VARIABLES + log_debug("Calling registerTextVariable after change of variable name and updateText call"); +#endif registerTextVariable(); //reset_bounding_box(0, 0); // does this make sense ? it's called in the constructor... } Index: testsuite/misc-swfc.all/edittext_test1.sc =================================================================== RCS file: /sources/gnash/gnash/testsuite/misc-swfc.all/edittext_test1.sc,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- testsuite/misc-swfc.all/edittext_test1.sc 20 Sep 2007 14:07:31 -0000 1.5 +++ testsuite/misc-swfc.all/edittext_test1.sc 20 Sep 2007 15:44:41 -0000 1.6 @@ -69,6 +69,7 @@ .action: // rename the EditText variable to 'textVar2' edtext1.variable = 'textVar2'; + check_equals(_root.hasOwnProperty('textVar2'), true); check_equals(edtext1.variable, 'textVar2'); // textVar2 automatically initialized to 'Hello' // (the InitialText in DefineTextField tag, make sense!) @@ -106,8 +107,8 @@ .frame 7 .action: check_equals(_root.hasOwnProperty('textVar1'), true); - xcheck_equals(_root.hasOwnProperty('textVar2'), true); - xcheck_equals(_root.hasOwnProperty('textVar3'), true); + check_equals(_root.hasOwnProperty('textVar2'), true); + check_equals(_root.hasOwnProperty('textVar3'), true); .end @@ -116,8 +117,8 @@ .action: // after removing the TextField instance, all registered variables still keep alive check_equals(_root.hasOwnProperty('textVar1'), true); - xcheck_equals(_root.hasOwnProperty('textVar2'), true); - xcheck_equals(_root.hasOwnProperty('textVar3'), true); + check_equals(_root.hasOwnProperty('textVar2'), true); + check_equals(_root.hasOwnProperty('textVar3'), true); check_equals(typeof(edtext1), 'undefined'); .end _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit