CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/08/30 14:13:07
Modified files: . : ChangeLog server : character.cpp character.h edit_text_character.cpp edit_text_character.h sprite_instance.cpp sprite_instance.h Log message: * server/: character.{cpp,h}, edit_text_character.{cpp,h}, sprite_instance.{cpp,h}: change signature of character::unload() to return a boolean value stating wheter any onUnload event was queued due to removal. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4162&r2=1.4163 http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.cpp?cvsroot=gnash&r1=1.48&r2=1.49 http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.90&r2=1.91 http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.104&r2=1.105 http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.47&r2=1.48 http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.314&r2=1.315 http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.131&r2=1.132 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4162 retrieving revision 1.4163 diff -u -b -r1.4162 -r1.4163 --- ChangeLog 30 Aug 2007 13:32:05 -0000 1.4162 +++ ChangeLog 30 Aug 2007 14:13:06 -0000 1.4163 @@ -1,5 +1,12 @@ 2007-08-30 Sandro Santilli <[EMAIL PROTECTED]> + * server/: character.{cpp,h}, edit_text_character.{cpp,h}, + sprite_instance.{cpp,h}: change signature of character::unload() + to return a boolean value stating wheter any onUnload event was + queued due to removal. + +2007-08-30 Sandro Santilli <[EMAIL PROTECTED]> + * server/character.h: add const for removed clips depth offset. * testsuite/actionscript.all/MovieClip.as: test for depth shift when onUnload method is defined and a clip is removed. Index: server/character.cpp =================================================================== RCS file: /sources/gnash/gnash/server/character.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -u -b -r1.48 -r1.49 --- server/character.cpp 23 Aug 2007 16:50:56 -0000 1.48 +++ server/character.cpp 30 Aug 2007 14:13:07 -0000 1.49 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: character.cpp,v 1.48 2007/08/23 16:50:56 strk Exp $ */ +/* $Id: character.cpp,v 1.49 2007/08/30 14:13:07 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -673,16 +673,16 @@ { } -void +bool character::unload() { _unloaded = true; //log_msg(_("Queuing unload event for character %p"), this); - queueEventHandler(event_id::UNLOAD); + return queueEventHandler(event_id::UNLOAD); //on_event(event_id::UNLOAD); } -void +bool character::queueEventHandler(const event_id& id) { bool called=false; @@ -708,8 +708,11 @@ if ( method ) { root.pushAction(method, boost::intrusive_ptr<character>(this)); + called = true; } + return called; + } boost::intrusive_ptr<as_function> Index: server/character.h =================================================================== RCS file: /sources/gnash/gnash/server/character.h,v retrieving revision 1.90 retrieving revision 1.91 diff -u -b -r1.90 -r1.91 --- server/character.h 30 Aug 2007 13:32:05 -0000 1.90 +++ server/character.h 30 Aug 2007 14:13:07 -0000 1.91 @@ -19,7 +19,7 @@ // // -/* $Id: character.h,v 1.90 2007/08/30 13:32:05 strk Exp $ */ +/* $Id: character.h,v 1.91 2007/08/30 14:13:07 strk Exp $ */ #ifndef GNASH_CHARACTER_H #define GNASH_CHARACTER_H @@ -848,7 +848,10 @@ } /// Queue event handler(s), if any. - void queueEventHandler(const event_id& id); + // + /// @return true if any event handler was queued, false otherwise. + /// + bool queueEventHandler(const event_id& id); virtual void on_button_event(const event_id& id) { @@ -988,11 +991,15 @@ // /// This function must be called when the character is removed /// from the stage. - /// stage for the first time. It will take care of properly - /// unloading any child characters and queuing the 'UNLOAD' - /// event handler. + /// It will take care of properly calling + /// unload against any child characters and queuing the + /// 'UNLOAD' event handler. + /// + /// @return true if any onUnload event handler was defined + /// by either this or any child characters, false + /// otherwise. /// - virtual void unload(); + virtual bool unload(); bool isUnloaded() { return _unloaded; } Index: server/edit_text_character.cpp =================================================================== RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v retrieving revision 1.104 retrieving revision 1.105 diff -u -b -r1.104 -r1.105 --- server/edit_text_character.cpp 23 Aug 2007 09:53:03 -0000 1.104 +++ server/edit_text_character.cpp 30 Aug 2007 14:13:07 -0000 1.105 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: edit_text_character.cpp,v 1.104 2007/08/23 09:53:03 udog Exp $ */ +/* $Id: edit_text_character.cpp,v 1.105 2007/08/30 14:13:07 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -425,11 +425,13 @@ { } -void +bool edit_text_character::unload() { // TODO: unregisterTextVariable() ? on_event(event_id::KILLFOCUS); + + return false; // assuming TextField never has onUnload ... } void Index: server/edit_text_character.h =================================================================== RCS file: /sources/gnash/gnash/server/edit_text_character.h,v retrieving revision 1.47 retrieving revision 1.48 diff -u -b -r1.47 -r1.48 --- server/edit_text_character.h 21 Aug 2007 14:42:12 -0000 1.47 +++ server/edit_text_character.h 30 Aug 2007 14:13:07 -0000 1.48 @@ -118,8 +118,13 @@ // See dox in character.h bool pointInShape(float x, float y) const; - // See dox in character.h - void unload(); + /// See dox in character::unload (character.h) + // + /// NOTE: edit_text_character (TextField) never has + /// an onUnload event, so we always return false + /// here. (TODO: verify this) + /// + bool unload(); /// Return true if the 'background' should be drawn bool getDrawBackground() const; Index: server/sprite_instance.cpp =================================================================== RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v retrieving revision 1.314 retrieving revision 1.315 diff -u -b -r1.314 -r1.315 --- server/sprite_instance.cpp 29 Aug 2007 12:31:09 -0000 1.314 +++ server/sprite_instance.cpp 30 Aug 2007 14:13:07 -0000 1.315 @@ -1690,12 +1690,25 @@ }; /// A DisplayList visitor used to unload all characters -struct UnloaderVisitor { +class UnloaderVisitor { + int unloadEvents; + +public: + UnloaderVisitor() + : + unloadEvents(0) + {} + bool operator() (character* ch) { - ch->unload(); + if ( ch->unload() ) ++unloadEvents; return true; } + + bool foundUnloadEvents() const + { + return unloadEvents != 0; + } }; @@ -3409,7 +3422,7 @@ } } -void +bool sprite_instance::unload() { #ifdef GNASH_DEBUG @@ -3418,7 +3431,8 @@ UnloaderVisitor visitor; m_display_list.visitForward(visitor); - character::unload(); + + return character::unload() || visitor.foundUnloadEvents(); } Index: server/sprite_instance.h =================================================================== RCS file: /sources/gnash/gnash/server/sprite_instance.h,v retrieving revision 1.131 retrieving revision 1.132 diff -u -b -r1.131 -r1.132 --- server/sprite_instance.h 29 Aug 2007 12:31:09 -0000 1.131 +++ server/sprite_instance.h 30 Aug 2007 14:13:07 -0000 1.132 @@ -407,7 +407,7 @@ /// Unload all contents in the displaylist and this instance /// See character::unload for more info - void unload(); + bool unload(); /// See DisplayList::move_display_object, this method is just a proxy to that... // _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit