[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ... |
Date: |
Tue, 18 Dec 2007 23:39:59 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/12/18 23:39:59
Modified files:
. : ChangeLog
server : edit_text_character.cpp edit_text_character.h
testsuite/actionscript.all: TextField.as
Log message:
allow TextField.variable to point to a normal object.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5210&r2=1.5211
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.136&r2=1.137
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/TextField.as?cvsroot=gnash&r1=1.34&r2=1.35
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5210
retrieving revision 1.5211
diff -u -b -r1.5210 -r1.5211
--- ChangeLog 18 Dec 2007 22:05:13 -0000 1.5210
+++ ChangeLog 18 Dec 2007 23:39:58 -0000 1.5211
@@ -1,5 +1,12 @@
2007-12-18 Sandro Santilli <address@hidden>
+ * server/edit_text_character.{cpp,h}: allow TextField.variable
+ to point to a normal object, not fully correct yet but a minimal
+ step forward.
+ * testsuite/actionscript.all/TextField.as: 2 small successes.
+
+2007-12-18 Sandro Santilli <address@hidden>
+
* doc/C/extensions.xml: gave a review of how to create extensions.
Should be a currently correct way of doing it.
* server/character.cpp (destroy): make sure to set the _unloaded
Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -b -r1.136 -r1.137
--- server/edit_text_character.cpp 4 Dec 2007 11:45:28 -0000 1.136
+++ server/edit_text_character.cpp 18 Dec 2007 23:39:59 -0000 1.137
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: edit_text_character.cpp,v 1.136 2007/12/04 11:45:28 strk Exp $ */
+/* $Id: edit_text_character.cpp,v 1.137 2007/12/18 23:39:59 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -725,15 +725,15 @@
{
// TODO: notify sprite_instance if we have a variable name !
VariableRef ref = parseTextVariableRef(_variable_name);
- sprite_instance* sp = ref.first;
- if ( sp )
+ as_object* tgt = ref.first;
+ if ( tgt )
{
- sp->set_member(ref.second, newText); // we shouldn't
truncate, right ?
+ tgt->set_member(ref.second, newText); // we shouldn't
truncate, right ?
}
else
{
// nothing to do (too early ?)
- 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());
+ log_debug("set_text_value: variable name %s points to
an unexisting target, 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());
}
}
}
@@ -1483,11 +1483,7 @@
VariableRef ret;
ret.first = 0;
- std::string var_str = variableName;
- if ( _vm.getSWFVersion() < 7 )
- {
- boost::to_lower( var_str, _vm.getLocale() );
- }
+ std::string var_str = PROPNAME(variableName);
const char* varname = var_str.c_str();
@@ -1498,7 +1494,7 @@
/// Why isn't get_environment const again ?
as_environment& env =
const_cast<edit_text_character*>(this)->get_environment();
- character* target = env.get_target();
+ as_object* target = env.get_target();
assert(target); // is this correct ?
// If the variable string contains a path, we extract
@@ -1512,7 +1508,7 @@
#endif
// find target for the path component
// we use our parent's environment for this
- target = env.find_target(path);
+ target = env.find_object(path);
// update varname (with path component stripped)
varname = var.c_str();
@@ -1526,10 +1522,7 @@
return ret;
}
- assert(dynamic_cast<sprite_instance*>(target));
- sprite_instance* sprite = static_cast<sprite_instance*>(target);
-
- ret.first = sprite;
+ ret.first = target;
ret.second = _vm.getStringTable().find(varname);
return ret;
@@ -1562,23 +1555,21 @@
}
VariableRef varRef = parseTextVariableRef(_variable_name);
- sprite_instance* sprite = varRef.first;
- if ( ! sprite )
+ as_object* target = varRef.first;
+ if ( ! target )
{
- //IF_VERBOSE_MALFORMED_SWF(
- log_swferror(_("VariableName associated to text field
(%s) refer to an unknown target. "
+ log_debug(_("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;
}
- string_table::key& key = varRef.second;
+ string_table::key key = varRef.second;
// check if the VariableName already has a value,
// in that case update text value
as_value val;
- if (sprite->get_member(key, &val) )
+ if (target->get_member(key, &val) )
{
#ifdef DEBUG_DYNTEXT_VARIABLES
log_msg(_("target sprite (%p) does have a member named %s"),
(void*)sprite, _vm.getStringTable().value(key).c_str());
@@ -1592,9 +1583,13 @@
#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));
+ target->set_member(key, as_value(_text));
}
+ sprite_instance* sprite = target->to_movie();
+
+ if ( sprite )
+ {
// add the textfield variable to the target sprite
// TODO: have set_textfield_variable take a string_table::key instead ?
#ifdef DEBUG_DYNTEXT_VARIABLES
@@ -1602,7 +1597,9 @@
#endif
sprite->set_textfield_variable(_vm.getStringTable().value(key), this);
+ }
_text_variable_registered=true;
+
}
void
@@ -2063,7 +2060,6 @@
{
string_table& st = _vm.getStringTable();
string_table::key key = st.find(PROPNAME("onChanged"));
- as_environment& env =
const_cast<edit_text_character*>(this)->get_environment();
callMethod(key);
}
@@ -2072,7 +2068,6 @@
{
string_table& st = _vm.getStringTable();
string_table::key key = st.find(PROPNAME("onSetFocus"));
- as_environment& env =
const_cast<edit_text_character*>(this)->get_environment();
callMethod(key);
}
@@ -2081,7 +2076,6 @@
{
string_table& st = _vm.getStringTable();
string_table::key key = st.find(PROPNAME("onKillFocus"));
- as_environment& env =
const_cast<edit_text_character*>(this)->get_environment();
callMethod(key);
}
Index: server/edit_text_character.h
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.h,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- server/edit_text_character.h 30 Nov 2007 23:11:11 -0000 1.60
+++ server/edit_text_character.h 18 Dec 2007 23:39:59 -0000 1.61
@@ -363,7 +363,7 @@
///
void registerTextVariable();
- typedef std::pair<sprite_instance*, string_table::key> VariableRef;
+ typedef std::pair<as_object*, string_table::key> VariableRef;
/// \brief
/// Parse the given variable name
Index: testsuite/actionscript.all/TextField.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/TextField.as,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- testsuite/actionscript.all/TextField.as 18 Dec 2007 11:24:45 -0000
1.34
+++ testsuite/actionscript.all/TextField.as 18 Dec 2007 23:39:59 -0000
1.35
@@ -19,7 +19,7 @@
// compile this test case with Ming makeswf, and then
// execute it like this gnash -1 -r 0 -v out.swf
-rcsid="$Id: TextField.as,v 1.34 2007/12/18 11:24:45 strk Exp $";
+rcsid="$Id: TextField.as,v 1.35 2007/12/18 23:39:59 strk Exp $";
#include "check.as"
@@ -574,7 +574,7 @@
o.t = "from object"; // here we create _level0.o.t
xcheck_equals(tf.text, "back-propagated"); // but creating _level0.o.t doesn't
trigger textfield text update
tf.text = "back-to-object"; // instead, assigning to TextField.text updates
the object
-xcheck_equals(o.t, "back-to-object");
+check_equals(o.t, "back-to-object");
o.t = "from object again"; // but updates to the object still don't update the
TextField
check_equals(tf.text, "back-to-object"); // assigning to the object doesn't
trigger update of text ?
tf.variable = "_level0.o.t"; // We re-assign TextField.variable, now the
variable exists
@@ -583,7 +583,7 @@
o.t = "and forever";
xcheck_equals(tf.text, "from object again"); // but updating o.t still doesn't
trigger update of the text ?
tf.text = "and forever back";
-xcheck_equals(o.t, "and forever back"); // while updating textfield's text
updates o.t
+check_equals(o.t, "and forever back"); // while updating textfield's text
updates o.t
// Check TextField._visible
- [Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ...,
Sandro Santilli <=