00001 // 00002 // Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 00003 // 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00017 00018 #ifndef GNASH_SWF_DOACTIONTAG_H 00019 #define GNASH_SWF_DOACTIONTAG_H 00020 00021 #include "ControlTag.h" // for inheritance 00022 #include "SWF.h" // for TagType definition 00023 #include "action_buffer.h" // for composition 00024 #include "MovieClip.h" // for inlines 00025 #include "SWFStream.h" // for inlines 00026 00027 // Forward declarations 00028 namespace gnash { 00029 class movie_definition; 00030 } 00031 00032 namespace gnash { 00033 namespace SWF { 00034 00036 // 00039 class DoActionTag : public ControlTag 00040 { 00041 public: 00042 00044 // 00045 void read(SWFStream& in) { 00046 m_buf.read(in, in.get_tag_end_position()); 00047 } 00048 00049 virtual void executeActions(MovieClip* m, DisplayList& /* dlist */) const { 00050 m->add_action_buffer(&m_buf); 00051 } 00052 00053 static void loader(SWFStream& in, TagType tag, movie_definition& m, 00054 const RunResources& /*r*/) 00055 { 00056 if (m.isAS3()) { 00057 IF_VERBOSE_MALFORMED_SWF( 00058 log_swferror("SWF contains DoAction tag, but is an " 00059 "AS3 SWF!"); 00060 ); 00061 throw ParserException("DoAction tag found in AS3 SWF!"); 00062 } 00063 00064 DoActionTag* da = new DoActionTag(m); 00065 da->read(in); 00066 00067 IF_VERBOSE_PARSE ( 00068 log_parse(_("tag %d: do_action_loader"), tag); 00069 log_parse(_("-- actions in frame %d"), m.get_loading_frame()); 00070 ); 00071 00072 m.addControlTag(da); // ownership transferred 00073 } 00074 00075 private: 00076 00077 DoActionTag(movie_definition& md) 00078 : 00079 m_buf(md) 00080 {} 00081 00082 action_buffer m_buf; 00083 }; 00084 00085 } // namespace gnash::SWF 00086 } // namespace gnash 00087 00088 00089 #endif // GNASH_SWF_DOACTIONTAG_H 00090 00091 00092 // Local Variables: 00093 // mode: C++ 00094 // indent-tabs-mode: t 00095 // End: