[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ./ChangeLog backend/gnash.cpp server/ASSo...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ./ChangeLog backend/gnash.cpp server/ASSo... |
Date: |
Sun, 07 May 2006 12:02:40 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Branch:
Changes by: Sandro Santilli <address@hidden> 06/05/07 12:02:39
Modified files:
. : ChangeLog
backend : gnash.cpp
server : ASSound.cpp Global.cpp Makefile.am Movie.cpp
Movie.h MovieClipLoader.cpp action.cpp
button.cpp font.cpp fontlib.cpp gnash.h
impl.cpp impl.h morph2.cpp sound.cpp
sprite_definition.h sprite_instance.h
styles.cpp text.cpp
utilities : processor.cpp
Added files:
server : movie_def_impl.cpp movie_def_impl.h
movie_definition.h movie_interface.h
movie_root.cpp movie_root.h
Log message:
Movie.{h,cpp} split in movie_definition.{h,cpp}, movie_def_impl.{h,cpp},
movie_interface.{h,cpp} and movie_root.{h,cpp}
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/ChangeLog.diff?tr1=1.265&tr2=1.266&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/backend/gnash.cpp.diff?tr1=1.29&tr2=1.30&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/ASSound.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Global.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Makefile.am.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Movie.cpp.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/Movie.h.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/MovieClipLoader.cpp.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/action.cpp.diff?tr1=1.65&tr2=1.66&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/button.cpp.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/font.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/fontlib.cpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/gnash.h.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/impl.cpp.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/impl.h.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/morph2.cpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/movie_def_impl.cpp?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/movie_def_impl.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/movie_definition.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/movie_interface.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/movie_root.cpp?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/movie_root.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/sound.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/sprite_definition.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/sprite_instance.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/styles.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/text.cpp.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/utilities/processor.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
Patches:
Index: gnash/ChangeLog
diff -u gnash/ChangeLog:1.265 gnash/ChangeLog:1.266
--- gnash/ChangeLog:1.265 Sat May 6 22:10:47 2006
+++ gnash/ChangeLog Sun May 7 12:02:39 2006
@@ -1,12 +1,21 @@
2006-05-07 Sandro Santilli <address@hidden>
- * server/Makefile.am, server/Movie.cpp, server/Sprite.cpp,
- server/Sprite.h, server/impl.cpp, server/sprite_definition.cpp,
- server/sprite_definition.h, server/sprite_instance.cpp,
- server/sprite_instance.h:
+ * server/Makefile.am, server/Movie.cpp, server/Movie.h,
+ server/Sprite.cpp, server/Sprite.h,
+ server/impl.cpp, server/impl.h,
+ server/sprite_definition.cpp, server/sprite_definition.h,
+ server/sprite_instance.cpp, server/sprite_instance.h,
+ backend/gnash.cpp, server/ASSound.cpp, server/Global.cpp,
+ server/MovieClipLoader.cpp, server/action.cpp, server/button.cpp,
+ server/font.cpp, server/fontlib.cpp, server/gnash.h,
+ server/morph2.cpp, server/movie_def_impl.cpp,
+ server/movie_def_impl.h, server/movie_definition.h,
+ server/movie_interface.h, server/movie_root.cpp,
+ server/movie_root.h, server/sound.cpp, server/styles.cpp,
+ server/text.cpp, utilities/processor.cpp:
sprite_instance and sprite_definition are now real classes
and are defined in their own files, named after the class
- themselves.
+ themselves, same split for Movie.h file.
2006-05-04 Sandro Santilli <address@hidden>
Index: gnash/backend/gnash.cpp
diff -u gnash/backend/gnash.cpp:1.29 gnash/backend/gnash.cpp:1.30
--- gnash/backend/gnash.cpp:1.29 Tue May 2 20:51:59 2006
+++ gnash/backend/gnash.cpp Sun May 7 12:02:39 2006
@@ -70,7 +70,8 @@
#include "tu_file.h"
#include "tu_types.h"
#include "xmlsocket.h"
-#include "Movie.h"
+//#include "Movie.h"
+#include "movie_definition.h"
using namespace std;
using namespace gnash;
Index: gnash/server/ASSound.cpp
diff -u gnash/server/ASSound.cpp:1.1 gnash/server/ASSound.cpp:1.2
--- gnash/server/ASSound.cpp:1.1 Wed May 3 07:56:55 2006
+++ gnash/server/ASSound.cpp Sun May 7 12:02:39 2006
@@ -22,7 +22,8 @@
#include "log.h"
#include "ASSound.h"
-#include "Movie.h"
+//#include "Movie.h"
+#include "movie_definition.h"
namespace gnash {
Index: gnash/server/Global.cpp
diff -u gnash/server/Global.cpp:1.4 gnash/server/Global.cpp:1.5
--- gnash/server/Global.cpp:1.4 Wed May 3 07:56:55 2006
+++ gnash/server/Global.cpp Sun May 7 12:02:39 2006
@@ -36,7 +36,8 @@
#include "Math.h"
#include "Mouse.h"
#include "MovieClipLoader.h"
-#include "Movie.h"
+#include "Movie.h" // for movieclip_init
+#include "movie_definition.h"
#include "NetConnection.h"
#include "NetStream.h"
#include "Object.h"
Index: gnash/server/Makefile.am
diff -u gnash/server/Makefile.am:1.30 gnash/server/Makefile.am:1.31
--- gnash/server/Makefile.am:1.30 Sat May 6 22:10:47 2006
+++ gnash/server/Makefile.am Sun May 7 12:02:39 2006
@@ -128,6 +128,8 @@
xmlattrs.cpp \
xmlnode.cpp \
MovieClipLoader.cpp\
+ movie_root.cpp \
+ movie_def_impl.cpp \
xmlsocket.cpp \
string.cpp \
action.cpp \
@@ -168,6 +170,10 @@
morph.h \
MovieClipLoader.h \
Movie.h \
+ movie_definition.h \
+ movie_def_impl.h \
+ movie_interface.h \
+ movie_root.h \
network.h \
Object.h \
render.h \
Index: gnash/server/Movie.cpp
diff -u gnash/server/Movie.cpp:1.18 gnash/server/Movie.cpp:1.19
--- gnash/server/Movie.cpp:1.18 Sat May 6 22:10:47 2006
+++ gnash/server/Movie.cpp Sun May 7 12:02:39 2006
@@ -44,13 +44,13 @@
#include "Movie.h"
#include "tu_file.h"
#include "zlib_adapter.h"
-#include "stream.h"
-#include "jpeg.h"
-#include "fontlib.h"
-#include "font.h"
+//#include "stream.h"
+//#include "jpeg.h"
+//#include "fontlib.h"
+//#include "font.h"
#include "log.h"
//#include "Sprite.h"
-#include "sprite_instance.h"
+//#include "sprite_instance.h"
#include "render.h"
using namespace std;
@@ -63,753 +63,6 @@
// @@ should be found somewhere else I guess..
//movie_interface* create_instance();
-//
-// progress callback stuff (from Vitaly)
-//
-progress_callback s_progress_function = NULL;
-
-// Host calls this to register a function for progress bar handling
-// during loading movies.
-void
-register_progress_callback(progress_callback progress_handle)
-{
- s_progress_function = progress_handle;
-}
-
-//
-// some utility stuff
-//
-
-void dump_tag_bytes(stream* in)
- // Log the contents of the current tag, in hex.
-{
- static const int ROW_BYTES = 16;
- char row_buf[ROW_BYTES];
- int row_count = 0;
-
- while(in->get_position() < in->get_tag_end_position())
- {
- int c = in->read_u8();
- log_msg("%02X", c);
-
- if (c < 32) c = '.';
- if (c > 127) c = '.';
- row_buf[row_count] = c;
-
- row_count++;
- if (row_count >= ROW_BYTES)
- {
- log_msg(" ");
- for (int i = 0; i < ROW_BYTES; i++)
- {
- log_msg("%c", row_buf[i]);
- }
-
- log_msg("\n");
- row_count = 0;
- }
- else
- {
- log_msg(" ");
- }
- }
-
- if (row_count > 0)
- {
- log_msg("\n");
- }
-}
-
-
-
-
-//
-// movie_def_impl
-//
-
-movie_def_impl::~movie_def_impl()
-{
- // Release our playlist data.
- {for (int i = 0, n = m_playlist.size(); i < n; i++)
- {
- for (int j = 0, m = m_playlist[i].size(); j < m; j++)
- {
- delete m_playlist[i][j];
- }
- }}
-
- // Release init action data.
- {for (int i = 0, n = m_init_action_list.size(); i < n; i++)
- {
- for (int j = 0, m = m_init_action_list[i].size(); j < m; j++)
- {
- delete m_init_action_list[i][j];
- }
- }}
-
- assert(m_jpeg_in == NULL); // It's supposed to be cleaned up in read()
-}
-
-bool movie_def_impl::in_import_table(int character_id)
-{
- for (int i = 0, n = m_imports.size(); i < n; i++)
- {
- if (m_imports[i].m_character_id == character_id)
- {
- return true;
- }
- }
- return false;
-}
-
-void movie_def_impl::visit_imported_movies(import_visitor* visitor)
-{
- stringi_hash<bool> visited; // ugh!
-
- for (int i = 0, n = m_imports.size(); i < n; i++)
- {
- const import_info& inf = m_imports[i];
- if (visited.find(inf.m_source_url) == visited.end())
- {
- // Call back the visitor.
- visitor->visit(inf.m_source_url.c_str());
- visited[inf.m_source_url] = true;
- }
- }
-}
-
-void movie_def_impl::resolve_import(const char* source_url, movie_definition*
source_movie)
-{
- // @@ should be safe, but how can we verify
- // it? Compare a member function pointer, or
- // something?
- movie_def_impl* def_impl = static_cast<movie_def_impl*>(source_movie);
- movie_definition* def = static_cast<movie_definition*>(def_impl);
-
- // Iterate in reverse, since we remove stuff along the way.
- for (int i = m_imports.size() - 1; i >= 0; i--)
- {
- const import_info& inf = m_imports[i];
- if (inf.m_source_url == source_url)
- {
- // Do the import.
- smart_ptr<resource> res =
def->get_exported_resource(inf.m_symbol);
- bool imported = true;
-
- if (res == NULL)
- {
- log_error("import error: resource '%s' is not
exported from movie '%s'\n",
- inf.m_symbol.c_str(), source_url);
- }
- else if (font* f = res->cast_to_font())
- {
- // Add this shared font to our fonts.
- add_font(inf.m_character_id, f);
- imported = true;
- }
- else if (character_def* ch = res->cast_to_character_def())
- {
- // Add this character to our characters.
- add_character(inf.m_character_id, ch);
- imported = true;
- }
- else
- {
- log_error("import error: resource '%s' from movie
'%s' has unknown type\n",
- inf.m_symbol.c_str(), source_url);
- }
-
- if (imported)
- {
- m_imports.erase(m_imports.begin() + i);
-
- // Hold a ref, to keep this source
movie_definition alive.
- m_import_source_movies.push_back(source_movie);
- }
- }
- }
-}
-
-void movie_def_impl::add_character(int character_id, character_def* c)
-{
- assert(c);
- m_characters.add(character_id, c);
-}
-
-character_def* movie_def_impl::get_character_def(int character_id)
-{
-#ifndef NDEBUG
- // make sure character_id is resolved
- if (in_import_table(character_id))
- {
- log_error("get_character_def(): character_id %d is still waiting
to be imported\n",
- character_id);
- }
-#endif // not NDEBUG
-
- smart_ptr<character_def> ch;
- m_characters.get(character_id, &ch);
- assert(ch == NULL || ch->get_ref_count() > 1);
- return ch.get_ptr();
-}
-
-void movie_def_impl::add_font(int font_id, font* f)
-{
- assert(f);
- m_fonts.add(font_id, f);
-}
-
-font* movie_def_impl::get_font(int font_id)
-{
-#ifndef NDEBUG
- // make sure font_id is resolved
- if (in_import_table(font_id))
- {
- log_error("get_font(): font_id %d is still waiting to be
imported\n",
- font_id);
- }
-#endif // not NDEBUG
-
- smart_ptr<font> f;
- m_fonts.get(font_id, &f);
- assert(f == NULL || f->get_ref_count() > 1);
- return f.get_ptr();
-}
-
-bitmap_character_def* movie_def_impl::get_bitmap_character(int character_id)
-{
- smart_ptr<bitmap_character_def> ch;
- m_bitmap_characters.get(character_id, &ch);
- assert(ch == NULL || ch->get_ref_count() > 1);
- return ch.get_ptr();
-}
-
-void movie_def_impl::add_bitmap_character(int character_id,
bitmap_character_def* ch)
-{
- assert(ch);
- m_bitmap_characters.add(character_id, ch);
-
- add_bitmap_info(ch->get_bitmap_info());
-}
-
-sound_sample* movie_def_impl::get_sound_sample(int character_id)
-{
- smart_ptr<sound_sample> ch;
- m_sound_samples.get(character_id, &ch);
- assert(ch == NULL || ch->get_ref_count() > 1);
- return ch.get_ptr();
-}
-
-void movie_def_impl::add_sound_sample(int character_id, sound_sample* sam)
-{
- assert(sam);
- m_sound_samples.add(character_id, sam);
-}
-
-
-// Read a .SWF movie.
-void movie_def_impl::read(tu_file* in)
-{
- Uint32 file_start_pos = in->get_position();
- Uint32 header = in->read_le32();
- m_file_length = in->read_le32();
- Uint32 file_end_pos = file_start_pos + m_file_length;
-
- m_version = (header >> 24) & 255;
- if ((header & 0x0FFFFFF) != 0x00535746
- && (header & 0x0FFFFFF) != 0x00535743)
- {
- // ERROR
- log_error("gnash::movie_def_impl::read() -- file does not start
with a SWF header!\n");
- return;
- }
- bool compressed = (header & 255) == 'C';
-
- IF_VERBOSE_PARSE(log_msg("version = %d, file_length = %d\n", m_version,
m_file_length));
-
- tu_file* original_in = NULL;
- if (compressed)
- {
-#if TU_CONFIG_LINK_TO_ZLIB == 0
- log_error("movie_def_impl::read(): unable to read zipped SWF data;
TU_CONFIG_LINK_TO_ZLIB is 0\n");
- return;
-#endif
-
- IF_VERBOSE_PARSE(log_msg("file is compressed.\n"));
- original_in = in;
-
- // Uncompress the input as we read it.
- in = zlib_adapter::make_inflater(original_in);
-
- // Subtract the size of the 8-byte header, since
- // it's not included in the compressed
- // stream length.
- file_end_pos = m_file_length - 8;
- }
-
- stream str(in);
-
- m_frame_size.read(&str);
- m_frame_rate = str.read_u16() / 256.0f;
- m_frame_count = str.read_u16();
-
- m_playlist.resize(m_frame_count);
- m_init_action_list.resize(m_frame_count);
-
- IF_VERBOSE_PARSE(m_frame_size.print());
- IF_VERBOSE_PARSE(log_msg("frame rate = %f, frames = %d\n", m_frame_rate,
m_frame_count));
-
- while ((Uint32) str.get_position() < file_end_pos)
- {
- int tag_type = str.open_tag();
-
- if (s_progress_function != NULL)
- {
- s_progress_function((Uint32) str.get_position(),
file_end_pos);
- }
-
- loader_function lf = NULL;
- //IF_VERBOSE_PARSE(log_msg("tag_type = %d\n", tag_type));
- if (tag_type == 1)
- {
- // show frame tag -- advance to the next frame.
- IF_VERBOSE_PARSE(log_msg(" show_frame\n"));
- m_loading_frame++;
- }
- else if (s_tag_loaders.get(tag_type, &lf))
- {
- // call the tag loader. The tag loader should add
- // characters or tags to the movie data structure.
- (*lf)(&str, tag_type, this);
-
- } else {
- // no tag loader for this tag type.
- IF_VERBOSE_PARSE(log_msg("*** no tag loader for type
%d\n", tag_type));
- IF_VERBOSE_PARSE(dump_tag_bytes(&str));
- }
-
- str.close_tag();
-
- if (tag_type == 0)
- {
- if ((unsigned int) str.get_position() != file_end_pos)
- {
- // Safety break, so we don't read past the end of
the
- // movie.
- log_msg("warning: hit stream-end tag, but not at
the "
- "end of the file yet; stopping for
safety\n");
- break;
- }
- }
- }
-
- if (m_jpeg_in)
- {
- delete m_jpeg_in;
- m_jpeg_in = NULL;
- }
-
- if (original_in)
- {
- // Done with the zlib_adapter.
- delete in;
- }
-}
-
-
-/* movie_def_impl */
-void movie_def_impl::get_owned_fonts(std::vector<font*>* fonts)
- // Fill up *fonts with fonts that we own.
-{
- assert(fonts);
- fonts->resize(0);
-
- std::vector<int> font_ids;
-
- for (hash<int, smart_ptr<font> >::iterator it = m_fonts.begin();
- it != m_fonts.end();
- ++it)
- {
- font* f = it->second.get_ptr();
- if (f->get_owning_movie() == this)
- {
- // Sort by character id, so the ordering is
- // consistent for cache read/write.
- int id = it->first;
-
- // Insert in correct place.
- unsigned int insert;
- for (insert = 0; insert < font_ids.size(); insert++)
- {
- if (font_ids[insert] > id)
- {
- // We want to insert here.
- break;
- }
- }
- fonts->insert(fonts->begin() + insert, f);
- font_ids.insert(font_ids.begin() + insert, id);
- }
- }
-}
-
-
-/* movie_def_impl */
-void movie_def_impl::generate_font_bitmaps()
- // Generate bitmaps for our fonts, if necessary.
-{
- // Collect list of fonts.
- std::vector<font*> fonts;
- get_owned_fonts(&fonts);
- fontlib::generate_font_bitmaps(fonts, this);
-}
-
-
-// Increment this when the cache data format changes.
-#define CACHE_FILE_VERSION 4
-
-
-/* movie_def_impl */
-void movie_def_impl::output_cached_data(tu_file* out, const cache_options&
options)
- // Dump our cached data into the given stream.
-{
- // Write a little header.
- char header[5];
- strcpy(header, "gscX");
- header[3] = CACHE_FILE_VERSION;
- compiler_assert(CACHE_FILE_VERSION < 256);
-
- out->write_bytes(header, 4);
-
- // Write font data.
- std::vector<font*> fonts;
- get_owned_fonts(&fonts);
- fontlib::output_cached_data(out, fonts, this, options);
-
- // Write character data.
- {for (hash<int, smart_ptr<character_def> >::iterator it =
m_characters.begin();
- it != m_characters.end();
- ++it)
- {
- out->write_le16(it->first);
- it->second->output_cached_data(out, options);
- }}
-
- out->write_le16((Sint16) -1); // end of characters marker
-}
-
-
-/* movie_def_impl */
-void movie_def_impl::input_cached_data(tu_file* in)
- // Read in cached data and use it to prime our loaded characters.
-{
- // Read the header & check version.
- unsigned char header[4];
- in->read_bytes(header, 4);
- if (header[0] != 'g' || header[1] != 's' || header[2] != 'c')
- {
- log_error("cache file does not have the correct format;
skipping\n");
- return;
- }
- else if (header[3] != CACHE_FILE_VERSION)
- {
- log_error(
- "cached data is version %d, but we require version %d;
skipping\n",
- int(header[3]), CACHE_FILE_VERSION);
- return;
- }
-
- // Read the cached font data.
- std::vector<font*> fonts;
- get_owned_fonts(&fonts);
- fontlib::input_cached_data(in, fonts, this);
-
- // Read the cached character data.
- for (;;)
- {
- if (in->get_error() != TU_FILE_NO_ERROR)
- {
- log_error("error reading cache file (characters);
skipping\n");
- return;
- }
- if (in->get_eof())
- {
- log_error("unexpected eof reading cache file (characters);
skipping\n");
- return;
- }
-
- Sint16 id = in->read_le16();
- if (id == (Sint16) -1) { break; } // done
-
- smart_ptr<character_def> ch;
- m_characters.get(id, &ch);
- if (ch != NULL)
- {
- ch->input_cached_data(in);
- }
- else
- {
- log_error("sync error in cache file (reading characters)!
"
- "Skipping rest of cache data.\n");
- return;
- }
- }
-}
-
-movie_interface* movie_def_impl::create_instance()
- // Create a playable movie instance from a def.
-{
- movie_root* m = new movie_root(this);
- assert(m);
-
- sprite_instance* root_movie = new sprite_instance(this, m,
- NULL, -1);
- assert(root_movie);
-
- root_movie->set_name("_root");
- m->set_root_movie(root_movie);
-
- // @@ somewhere in here I *might* add _url variable
- // (or is it a member?)
-
- m->add_ref();
- return m;
-}
-
-
-//
-// movie_root
-//
-
-
-movie_root::movie_root(movie_def_impl* def)
- :
- m_def(def),
- m_viewport_x0(0),
- m_viewport_y0(0),
- m_viewport_width(1),
- m_viewport_height(1),
- m_pixel_scale(1.0f),
- m_background_color(0, 0, 0, 255),
- m_timer(0.0f),
- m_mouse_x(0),
- m_mouse_y(0),
- m_mouse_buttons(0),
- m_userdata(NULL),
- m_on_event_load_called(false),
- m_on_event_xmlsocket_ondata_called(false),
- m_on_event_xmlsocket_onxml_called(false),
- m_on_event_load_progress_called(false)
-{
- assert(m_def != NULL);
-
- set_display_viewport(0, 0, (int) m_def->get_width_pixels(), (int)
m_def->get_height_pixels());
-}
-
-movie_root::~movie_root()
-{
- assert(m_def != NULL);
- m_movie = NULL;
- m_def = NULL;
-}
-
-
-
-void movie_root::set_root_movie(movie* root_movie)
-{
- m_movie = root_movie;
- assert(m_movie != NULL);
-}
-
-void movie_root::set_display_viewport(int x0, int y0, int w, int h)
-{
- m_viewport_x0 = x0;
- m_viewport_y0 = y0;
- m_viewport_width = w;
- m_viewport_height = h;
-
- // Recompute pixel scale.
- const rect& frame_size = m_def->get_frame_size();
-
- float scale_x = m_viewport_width /
TWIPS_TO_PIXELS(frame_size.width());
- float scale_y = m_viewport_height /
TWIPS_TO_PIXELS(frame_size.height());
- m_pixel_scale = fmax(scale_x, scale_y);
-}
-
-
-void movie_root::notify_mouse_state(int x, int y, int buttons)
-{
-// GNASH_REPORT_FUNCTION;
-// dbglogfile << "X is: " << x << " Y is: " << y << " Button is: "
-// << buttons << endl;
- m_mouse_x = x;
- m_mouse_y = y;
- m_mouse_buttons = buttons;
-}
-
-void movie_root::get_mouse_state(int* x, int* y, int* buttons)
-{
-// GNASH_REPORT_FUNCTION;
-
- assert(x);
- assert(y);
- assert(buttons);
-
-// dbglogfile << "X is: " << m_mouse_x << " Y is: " << m_mouse_y
-// << " Button is: "
-// << m_mouse_buttons << endl;
- *x = m_mouse_x;
- *y = m_mouse_y;
- *buttons = m_mouse_buttons;
-}
-
-void movie_root::get_url(const char *url)
-{
- GNASH_REPORT_FUNCTION;
-
- string command = "mozilla -remote \"openurl";
- command += url;
- command += ")\"";
- dbglogfile << "Launching URL... " << command << endl;
- system(command.c_str());
-}
-
-int movie_root::add_interval_timer(void *timer)
-{
- Timer *ptr = static_cast<Timer *>(timer);
-
- m_interval_timers.push_back(ptr);
- return m_interval_timers.size();
-}
-
-void movie_root::clear_interval_timer(int x)
-{
- m_interval_timers.erase(m_interval_timers.begin() + x-1);
- //m_interval_timers[x]->clearInterval();
-}
-
-void movie_root::do_something(void *timer)
-{
- log_msg("FIXME: %s: unimplemented\n", __FUNCTION__);
-}
-
-void movie_root::advance(float delta_time)
-{
-// GNASH_REPORT_FUNCTION;
-
- if (m_on_event_load_called == false)
- {
- // Must do loading events. For child sprites this is
- // done by the dlist, but root movies don't get added
- // to a dlist, so we do it here.
- m_on_event_load_called = true;
- m_movie->on_event_load();
- }
-#if 0
- // Must check the socket connection for data
- if (m_on_event_xmlsocket_ondata_called == true) {
- m_movie->on_event_xmlsocket_ondata();
- }
-
- if (m_on_event_xmlsocket_onxml_called == true) {
- m_movie->on_event_xmlsocket_onxml();
- }
-
-
- // Must check the progress of the MovieClip being loaded
- if (m_on_event_load_progress_called == true) {
- m_movie->on_event_load_progress();
- }
-#endif
- if (m_interval_timers.size() > 0) {
- for (unsigned int i=0; i<m_interval_timers.size(); i++) {
- if (m_interval_timers[i]->expired()) {
- // printf("FIXME: Interval Timer Expired!\n");
- //m_movie->on_event_interval_timer();
- m_movie->do_something(m_interval_timers[i]);
- //
clear_interval_timer(m_interval_timers[i]->getIntervalID()); // FIXME: we
shouldn't really disable the timer here
- }
- }
- }
-
-
- m_timer += delta_time;
- // @@ TODO handle multi-frame catch-up stuff
- // here, and make it optional. Make
- // movie::advance() a fixed framerate w/ no
- // dt.
-
- // Handle the mouse.
- m_mouse_button_state.m_topmost_entity =
- m_movie->get_topmost_mouse_entity(PIXELS_TO_TWIPS(m_mouse_x),
PIXELS_TO_TWIPS(m_mouse_y));
- m_mouse_button_state.m_mouse_button_state_current = (m_mouse_buttons & 1);
- generate_mouse_button_events(&m_mouse_button_state);
-
- m_movie->advance(delta_time);
-}
-
-
-void movie_root::display()
-{
-// GNASH_REPORT_FUNCTION;
- if (m_movie->get_visible() == false)
- {
- // Don't display.
- return;
- }
-
- const rect& frame_size = m_def->get_frame_size();
-
- gnash::render::begin_display(
- m_background_color,
- m_viewport_x0, m_viewport_y0,
- m_viewport_width, m_viewport_height,
- frame_size.m_x_min, frame_size.m_x_max,
- frame_size.m_y_min, frame_size.m_y_max);
-
- m_movie->display();
-
- gnash::render::end_display();
-}
-
-bool movie_root::goto_labeled_frame(const char* label)
-{
- int target_frame = -1;
- if (m_def->get_labeled_frame(label, &target_frame))
- {
- goto_frame(target_frame);
- return true;
- }
- else
- {
- IF_VERBOSE_ACTION(
- log_error("error: movie_impl::goto_labeled_frame('%s') unknown
label\n", label));
- return false;
- }
-}
-
-
-const char* movie_root::call_method(const char* method_name,
- const char* method_arg_fmt, ...)
-{
- assert(m_movie != NULL);
-
- va_list args;
- va_start(args, method_arg_fmt);
- const char* result = m_movie->call_method_args(method_name,
method_arg_fmt, args);
- va_end(args);
-
- return result;
-}
-
-const char* movie_root::call_method_args(const char* method_name,
- const char* method_arg_fmt, va_list
args)
-{
- assert(m_movie != NULL);
- return m_movie->call_method_args(method_name, method_arg_fmt, args);
-}
-
-
void
movieclip_init(as_object* global)
{
Index: gnash/server/Movie.h
diff -u gnash/server/Movie.h:1.14 gnash/server/Movie.h:1.15
--- gnash/server/Movie.h:1.14 Mon Apr 24 23:05:56 2006
+++ gnash/server/Movie.h Sun May 7 12:02:39 2006
@@ -58,613 +58,10 @@
#ifndef GNASH_MOVIE_H
#define GNASH_MOVIE_H
-#include "container.h"
-#include "button.h" // for mouse_button_state
-#include "timers.h" // for Timer
-#include "fontlib.h"
-#include "font.h"
-#include "jpeg.h"
-#include "tu_file.h"
-
namespace gnash
{
- // Forward declarations
- class import_info;
- struct movie_def_impl;
- struct movie_root;
- struct import_visitor; // in gnash.h
-
- //
- // Helper for movie_def_impl
- //
- class import_info
- {
- friend class movie_def_impl;
-
- tu_string m_source_url;
- int m_character_id;
- tu_string m_symbol;
-
- import_info()
- :
- m_character_id(-1)
- {
- }
-
- import_info(const char* source, int id, const char* symbol)
- :
- m_source_url(source),
- m_character_id(id),
- m_symbol(symbol)
- {
- }
- };
-
-/// Client program's interface to the definition of a movie
-//
-/// (i.e. the shared constant source info).
-///
-struct movie_definition : public character_def
-{
- virtual int get_version() const = 0;
- virtual float get_width_pixels() const = 0;
- virtual float get_height_pixels() const = 0;
- virtual int get_frame_count() const = 0;
- virtual float get_frame_rate() const = 0;
-
- /// Create a playable movie instance from a def.
- //
- /// This calls add_ref() on the movie_interface internally.
- /// Call drop_ref() on the movie_interface when you're done with it.
- /// Or use smart_ptr<T> from base/smart_ptr.h if you want.
- ///
- virtual movie_interface* create_instance() = 0;
-
- virtual void output_cached_data(tu_file* out, const cache_options&
options) = 0;
- virtual void input_cached_data(tu_file* in) = 0;
-
- /// \brief
- /// Causes this movie def to generate texture-mapped
- /// versions of all the fonts it owns.
- //
- /// This improves
- /// speed and quality of text rendering. The
- /// texture-map data is serialized in the
- /// output/input_cached_data() calls, so you can
- /// preprocess this if you load cached data.
- ///
- virtual void generate_font_bitmaps() = 0;
-
- //
- // (optional) API to support gnash::create_movie_no_recurse().
- //
-
- /// \brief
- /// Call visit_imported_movies() to retrieve a list of
- /// names of movies imported into this movie.
- //
- /// visitor->visit() will be called back with the name
- /// of each imported movie.
- struct import_visitor
- {
- virtual ~import_visitor() {}
- virtual void visit(const char* imported_movie_filename) = 0;
- };
- virtual void visit_imported_movies(import_visitor* visitor) = 0;
-
- /// Call this to resolve an import of the given movie.
- /// Replaces the dummy placeholder with the real
- /// movie_definition* given.
- virtual void resolve_import(const char* name, movie_definition* def)
= 0;
-
- //
- // (optional) API to support host-driven creation of textures.
- //
- // Create the movie using gnash::create_movie_no_recurse(...,
DO_NOT_LOAD_BITMAPS),
- // and then initialize each bitmap info via get_bitmap_info_count(),
get_bitmap_info(),
- // and bitmap_info::init_*_image() or your own subclassed API.
- //
- // E.g.:
- //
- // // During preprocessing:
- // // This will create bitmap_info's using the rgba, rgb, alpha
contructors.
- // my_def = gnash::create_movie_no_recurse("myfile.swf",
DO_LOAD_BITMAPS);
- // int ct = my_def->get_bitmap_info_count();
- // for (int i = 0; i < ct; i++)
- // {
- // my_bitmap_info_subclass* bi = NULL;
- // my_def->get_bitmap_info(i, (bitmap_info**) &bi);
- //
my_precomputed_textures.push_back(bi->m_my_internal_texture_reference);
- // }
- // // Save out my internal data.
- // my_precomputed_textures->write_into_some_cache_stream(...);
- //
- // // Later, during run-time loading:
- // my_precomputed_textures->read_from_some_cache_stream(...);
- // // This will create blank bitmap_info's.
- // my_def = gnash::create_movie_no_recurse("myfile.swf",
DO_NOT_LOAD_BITMAPS);
- //
- // // Push cached texture info into the movie's bitmap_info structs.
- // int ct = my_def->get_bitmap_info_count();
- // for (int i = 0; i < ct; i++)
- // {
- // my_bitmap_info_subclass* bi = (my_bitmap_info_subclass*)
my_def->get_bitmap_info(i);
- // bi->set_internal_texture_reference(my_precomputed_textures[i]);
- // }
- virtual int get_bitmap_info_count() const = 0;
- virtual bitmap_info* get_bitmap_info(int i) const = 0;
-
- // From movie_definition_sub
-
- virtual const std::vector<execute_tag*>& get_playlist(int
frame_number) = 0;
- virtual const std::vector<execute_tag*>* get_init_actions(int
frame_number) = 0;
- virtual smart_ptr<resource> get_exported_resource(const tu_string&
symbol) = 0;
- virtual character_def* get_character_def(int id) = 0;
-
- virtual bool get_labeled_frame(const char* label, int* frame_number)
= 0;
-
- // For use during creation.
- virtual int get_loading_frame() const = 0;
- virtual void add_character(int id, character_def* ch) = 0;
- virtual void add_font(int id, font* ch) = 0;
- virtual font* get_font(int id) = 0;
- virtual void add_execute_tag(execute_tag* c) = 0;
- virtual void add_init_action(int sprite_id, execute_tag* c) = 0;
- virtual void add_frame_name(const char* name) = 0;
- virtual void set_jpeg_loader(jpeg::input* j_in) = 0;
- virtual jpeg::input* get_jpeg_loader() = 0;
- virtual bitmap_character_def* get_bitmap_character(int character_id)
= 0;
- virtual void add_bitmap_character(int character_id,
bitmap_character_def* ch) = 0;
- virtual sound_sample* get_sound_sample(int character_id) = 0;
- virtual void add_sound_sample(int character_id, sound_sample* sam) =
0;
- virtual void export_resource(const tu_string& symbol, resource* res)
= 0;
- virtual void add_import(const char* source_url, int id, const char*
symbol_name) = 0;
- virtual void add_bitmap_info(bitmap_info* ch) = 0;
-
- virtual create_bitmaps_flag get_create_bitmaps() const = 0;
- virtual create_font_shapes_flag get_create_font_shapes() const = 0;
-};
-
-/// Immutable definition of a movie's contents.
-//
-/// It cannot be played directly, and does not hold
-/// current state; for that you need to call create_instance()
-/// to get a movie_instance (movie_interface).
-///
-class movie_def_impl : public movie_definition
-{
- hash<int, smart_ptr<character_def> > m_characters;
- hash<int, smart_ptr<font> > m_fonts;
- hash<int, smart_ptr<bitmap_character_def> > m_bitmap_characters;
- hash<int, smart_ptr<sound_sample> > m_sound_samples;
-
- /// A list of movie control events for each frame.
- std::vector<std::vector<execute_tag*> > m_playlist;
-
- /// Init actions for each frame.
- std::vector<std::vector<execute_tag*> > m_init_action_list;
-
- /// 0-based frame #'s
- stringi_hash<int> m_named_frames;
-
- stringi_hash<smart_ptr<resource> > m_exports;
-
- /// Items we import.
- std::vector<import_info> m_imports;
-
- /// Movies we import from; hold a ref on these,
- /// to keep them alive
- std::vector<smart_ptr<movie_definition> > m_import_source_movies;
-
- /// Bitmaps used in this movie; collected in one place to make
- /// it possible for the host to manage them as textures.
- std::vector<smart_ptr<bitmap_info> > m_bitmap_list;
-
- create_bitmaps_flag m_create_bitmaps;
- create_font_shapes_flag m_create_font_shapes;
-
- rect m_frame_size;
- float m_frame_rate;
- int m_frame_count;
- int m_version;
- int m_loading_frame;
- uint32 m_file_length;
-
- jpeg::input* m_jpeg_in;
-
-public:
- movie_def_impl(create_bitmaps_flag cbf,
- create_font_shapes_flag cfs)
- :
- m_create_bitmaps(cbf),
- m_create_font_shapes(cfs),
- m_frame_rate(30.0f),
- m_frame_count(0),
- m_version(0),
- m_loading_frame(0),
- m_jpeg_in(0)
- {
- }
-
- ~movie_def_impl();
-
- // ...
- int get_frame_count() const { return m_frame_count; }
- float get_frame_rate() const { return m_frame_rate; }
- const rect& get_frame_size() const { return m_frame_size; }
-
- float get_width_pixels() const
- {
- return ceilf(TWIPS_TO_PIXELS(m_frame_size.width()));
- }
-
- float get_height_pixels() const
- {
- return ceilf(TWIPS_TO_PIXELS(m_frame_size.height()));
- }
-
- virtual int get_version() const { return m_version; }
-
- virtual int get_loading_frame() const
- {
- return m_loading_frame;
- }
-
- uint32 get_file_bytes() const { return m_file_length; }
-
- /// Returns DO_CREATE_BITMAPS if we're supposed to
- /// initialize our bitmap infos, or DO_NOT_INIT_BITMAPS
- /// if we're supposed to create blank placeholder
- /// bitmaps (to be init'd later explicitly by the host
- /// program).
- virtual create_bitmaps_flag get_create_bitmaps() const
- {
- return m_create_bitmaps;
- }
-
- /// Returns DO_LOAD_FONT_SHAPES if we're supposed to
- /// initialize our font shape info, or
- /// DO_NOT_LOAD_FONT_SHAPES if we're supposed to not
- /// create any (vector) font glyph shapes, and instead
- /// rely on precached textured fonts glyphs.
- virtual create_font_shapes_flag get_create_font_shapes() const
- {
- return m_create_font_shapes;
- }
-
- /// All bitmap_info's used by this movie should be
- /// registered with this API.
- virtual void add_bitmap_info(bitmap_info* bi)
- {
- m_bitmap_list.push_back(bi);
- }
-
- virtual int get_bitmap_info_count() const
- {
- return m_bitmap_list.size();
- }
-
- virtual bitmap_info* get_bitmap_info(int i) const
- {
- return m_bitmap_list[i].get_ptr();
- }
-
- /// Expose one of our resources under the given symbol,
- /// for export. Other movies can import it.
- virtual void export_resource(const tu_string& symbol,
- resource* res)
- {
- // SWF sometimes exports the same thing more than once!
- m_exports[symbol] = res;
- }
-
- /// Get the named exported resource, if we expose it.
- /// Otherwise return NULL.
- virtual smart_ptr<resource> get_exported_resource(const tu_string&
symbol)
- {
- smart_ptr<resource> res;
- m_exports.get(symbol, &res);
- return res;
- }
-
- /// Adds an entry to a table of resources that need to
- /// be imported from other movies. Client code must
- /// call resolve_import() later, when the source movie
- /// has been loaded, so that the actual resource can be
- /// used.
- virtual void add_import(const char* source_url, int id, const char*
symbol)
- {
- assert(in_import_table(id) == false);
-
- m_imports.push_back(import_info(source_url, id, symbol));
- }
-
- /// Debug helper; returns true if the given
- /// character_id is listed in the import table.
- bool in_import_table(int character_id);
-
- /// Calls back the visitor for each movie that we
- /// import symbols from.
- virtual void visit_imported_movies(import_visitor* visitor);
-
- /// Grabs the stuff we want from the source movie.
- virtual void resolve_import(const char* source_url,
- movie_definition* source_movie);
-
- void add_character(int character_id, character_def* c);
-
- character_def* get_character_def(int character_id);
-
- /// Returns 0-based frame #
- bool get_labeled_frame(const char* label, int* frame_number)
- {
- return m_named_frames.get(label, frame_number);
- }
-
- void add_font(int font_id, font* f);
- font* get_font(int font_id);
- bitmap_character_def* get_bitmap_character(int character_id);
- void add_bitmap_character(int character_id, bitmap_character_def*
ch);
- sound_sample* get_sound_sample(int character_id);
- virtual void add_sound_sample(int character_id, sound_sample* sam);
-
- /// Add an execute_tag to this movie_definition's playlist
- void add_execute_tag(execute_tag* e)
- {
- assert(e);
- m_playlist[m_loading_frame].push_back(e);
- }
-
- /// Need to execute the given tag before entering the
- /// currently-loading frame for the first time.
- ///
- /// @@ AFAIK, the sprite_id is totally pointless -- correct?
- void add_init_action(int sprite_id, execute_tag* e)
- {
- assert(e);
- m_init_action_list[m_loading_frame].push_back(e);
- }
-
- /// Labels the frame currently being loaded with the
- /// given name. A copy of the name string is made and
- /// kept in this object.
- void add_frame_name(const char* name)
- {
- assert(m_loading_frame >= 0 && m_loading_frame < m_frame_count);
-
- tu_string n = name;
- assert(m_named_frames.get(n, NULL) == false); // frame should
not already have a name (?)
- m_named_frames.add(n, m_loading_frame); // stores 0-based frame
#
- }
-
- /// Set an input object for later loading DefineBits
- /// images (JPEG images without the table info).
- void set_jpeg_loader(jpeg::input* j_in)
- {
- assert(m_jpeg_in == NULL);
- m_jpeg_in = j_in;
- }
-
- /// Get the jpeg input loader, to load a DefineBits
- /// image (one without table info).
- jpeg::input* get_jpeg_loader()
- {
- return m_jpeg_in;
- }
-
- virtual const std::vector<execute_tag*>& get_playlist(int frame_number)
{ return m_playlist[frame_number]; }
-
- virtual const std::vector<execute_tag*>*get_init_actions(int
frame_number) { return &m_init_action_list[frame_number]; }
-
- /// Read Movie definition from an SWF file.
- //
- /// This function uses the gnash::s_tag_loaders
- /// global variable to interpret specific tag types.
- ///
- void read(tu_file *in);
-
- /// Fill up *fonts with fonts that we own.
- void get_owned_fonts(std::vector<font*>* fonts);
-
- /// Generate bitmaps for our fonts, if necessary.
- void generate_font_bitmaps();
-
- /// Dump our cached data into the given stream.
- void output_cached_data(tu_file* out,
- const cache_options& options);
-
- /// Read in cached data and use it to prime our
- /// loaded characters.
- void input_cached_data(tu_file* in);
-
- /// Create a playable movie_root instance from a def.
- //
- /// The _root reference of the newly created instance
- /// will be set to a newly created sprite_instace (Help!)
- ///
- movie_interface* create_instance();
-};
-
-
- /// Global, shared root state for a movie and all its characters.
- class movie_root : public movie_interface
- {
- smart_ptr<movie_def_impl> m_def;
- int m_viewport_x0, m_viewport_y0;
- int m_viewport_width, m_viewport_height;
- float m_pixel_scale;
-
- rgba m_background_color;
- float m_timer;
- int m_mouse_x, m_mouse_y, m_mouse_buttons;
- void * m_userdata;
-
- mouse_button_state m_mouse_button_state;
- bool m_on_event_load_called;
-
- // Flags for event handlers
- bool m_on_event_xmlsocket_ondata_called;
- bool m_on_event_xmlsocket_onxml_called;
- bool m_on_event_load_progress_called;
- std::vector<Timer *> m_interval_timers;
-
- public:
- // XXXbastiaan: make these two variables private
- smart_ptr<movie> m_movie;
- /// @@ fold this into m_mouse_button_state?
- movie::drag_state m_drag_state;
-
- movie_root(movie_def_impl* def);
-
- ~movie_root();
-
- /// @@ should these delegate to m_movie? Probably...
- virtual void set_member(const tu_stringi& name,
- const as_value& val) {}
- virtual bool get_member(const tu_stringi& name,
- as_value* val) { return false; }
-
- /// @@ should this return m_movie.get_ptr()?
- virtual movie* to_movie() { assert(0); return 0; }
-
- void set_root_movie(movie* root_movie);
-
- void set_display_viewport(int x0, int y0, int w, int h);
-
- /// The host app uses this to tell the movie where the
- /// user's mouse pointer is.
- void notify_mouse_state(int x, int y, int buttons);
-
- /// Use this to retrieve the last state of the mouse, as set via
- /// notify_mouse_state(). Coordinates are in PIXELS, NOT TWIPS.
- virtual void get_mouse_state(int* x, int* y, int* buttons);
-
- movie* get_root_movie() { return m_movie.get_ptr(); }
-
- void stop_drag() { m_drag_state.m_character = NULL; }
-
- movie_definition* get_movie_definition() {
- return m_movie->get_movie_definition();
- }
-
- uint32 get_file_bytes() const {
- return m_def->get_file_bytes();
- }
-
- virtual void get_url(const char *url);
- virtual int add_interval_timer(void *timer);
- virtual void clear_interval_timer(int x);
- virtual void do_something(void *timer);
-
- /// 0-based!!
- int get_current_frame() const {
- return m_movie->get_current_frame();
- }
-
- float get_frame_rate() const {
- return m_def->get_frame_rate();
- }
-
- /// Return the size of a logical movie pixel as
- /// displayed on-screen, with the current device
- /// coordinates.
- virtual float get_pixel_scale() const
- {
- return m_pixel_scale;
- }
-
- // @@ Is this one necessary?
- character* get_character(int character_id)
- {
- return m_movie->get_character(character_id);
- }
-
- void set_background_color(const rgba& color)
- {
- m_background_color = color;
- }
-
- void set_background_alpha(float alpha)
- {
- m_background_color.m_a = iclamp(frnd(alpha * 255.0f), 0,
255);
- }
-
- float get_background_alpha() const
- {
- return m_background_color.m_a / 255.0f;
- }
-
- float get_timer() const { return m_timer; }
-
- void restart() { m_movie->restart(); }
-
- void advance(float delta_time);
-
- /// 0-based!!
- void goto_frame(int target_frame_number) {
- m_movie->goto_frame(target_frame_number);
- }
-
- virtual bool has_looped() const {
- return m_movie->has_looped();
- }
-
- void display();
-
- virtual bool goto_labeled_frame(const char* label);
-
- virtual void set_play_state(play_state s) {
- m_movie->set_play_state(s);
- }
-
- virtual play_state get_play_state() const {
- return m_movie->get_play_state();
- }
-
- virtual void set_variable(const char* path_to_var,
- const char* new_value)
- {
- m_movie->set_variable(path_to_var, new_value);
- }
-
- virtual void set_variable(const char* path_to_var,
- const wchar_t* new_value)
- {
- m_movie->set_variable(path_to_var, new_value);
- }
-
- virtual const char* get_variable(const char* path_to_var) const
- {
- return m_movie->get_variable(path_to_var);
- }
-
- /// For ActionScript interfacing convenience.
- virtual const char* call_method(const char* method_name,
- const char* method_arg_fmt, ...);
- virtual const char* call_method_args(const char* method_name,
- const char* method_arg_fmt, va_list args);
-
- virtual void set_visible(bool visible) {
- m_movie->set_visible(visible);
- }
- virtual bool get_visible() const {
- return m_movie->get_visible();
- }
-
- virtual void * get_userdata() { return m_userdata; }
- virtual void set_userdata(void * ud ) { m_userdata = ud; }
-
- virtual void attach_display_callback(
- const char* path_to_object,
- void (*callback)(void* user_ptr),
- void* user_ptr)
- {
- m_movie->attach_display_callback(path_to_object,
- callback, user_ptr);
- }
- };
-
+class as_object;
/// Initialize the global MovieClip constructor
void movieclip_init(as_object* global);
Index: gnash/server/MovieClipLoader.cpp
diff -u gnash/server/MovieClipLoader.cpp:1.15
gnash/server/MovieClipLoader.cpp:1.16
--- gnash/server/MovieClipLoader.cpp:1.15 Thu May 4 19:50:02 2006
+++ gnash/server/MovieClipLoader.cpp Sun May 7 12:02:39 2006
@@ -62,7 +62,8 @@
#endif
#endif
#include "MovieClipLoader.h"
-#include "Movie.h" // for movie_definition::create_instance, to be renamed
+//#include "Movie.h" // for movie_definition::create_instance, to be renamed
+#include "movie_definition.h"
#include "log.h"
#include "tu_file.h"
#include "image.h"
Index: gnash/server/action.cpp
diff -u gnash/server/action.cpp:1.65 gnash/server/action.cpp:1.66
--- gnash/server/action.cpp:1.65 Sat Apr 29 00:56:38 2006
+++ gnash/server/action.cpp Sun May 7 12:02:39 2006
@@ -19,7 +19,8 @@
#include "tu_random.h"
#include "gstring.h"
-#include "Movie.h" // for movie_definition::create_instance
+//#include "Movie.h" // for movie_definition::create_instance
+#include "movie_definition.h"
#include "MovieClipLoader.h"
#include "Function.h"
#include "timers.h"
Index: gnash/server/button.cpp
diff -u gnash/server/button.cpp:1.10 gnash/server/button.cpp:1.11
--- gnash/server/button.cpp:1.10 Thu Apr 20 17:21:40 2006
+++ gnash/server/button.cpp Sun May 7 12:02:39 2006
@@ -12,7 +12,8 @@
#include "render.h"
#include "sound.h"
#include "stream.h"
-#include "Movie.h"
+//#include "Movie.h"
+#include "movie_definition.h"
/*
Index: gnash/server/font.cpp
diff -u gnash/server/font.cpp:1.7 gnash/server/font.cpp:1.8
--- gnash/server/font.cpp:1.7 Thu Apr 20 19:58:31 2006
+++ gnash/server/font.cpp Sun May 7 12:02:39 2006
@@ -12,7 +12,8 @@
#include "log.h"
#include "shape.h"
#include "tu_file.h"
-#include "Movie.h"
+//#include "Movie.h"
+#include "movie_definition.h"
namespace gnash {
font::font()
Index: gnash/server/fontlib.cpp
diff -u gnash/server/fontlib.cpp:1.6 gnash/server/fontlib.cpp:1.7
--- gnash/server/fontlib.cpp:1.6 Thu Apr 20 17:21:40 2006
+++ gnash/server/fontlib.cpp Sun May 7 12:02:39 2006
@@ -17,7 +17,8 @@
#include "styles.h"
#include "tesselate.h"
#include "render.h"
-#include "Movie.h"
+//#include "Movie.h"
+#include "movie_definition.h"
namespace gnash {
Index: gnash/server/gnash.h
diff -u gnash/server/gnash.h:1.17 gnash/server/gnash.h:1.18
--- gnash/server/gnash.h:1.17 Tue May 2 20:51:59 2006
+++ gnash/server/gnash.h Sun May 7 12:02:39 2006
@@ -226,137 +226,6 @@
};
-
-/// An independent stateful live movie.
-//
-/// This is the client program's interface to an instance of a
-/// movie.
-///
-struct movie_interface : public as_object
-{
- virtual movie_definition* get_movie_definition() = 0;
-
- /// Frame counts in this API are 0-based (unlike ActionScript)
- virtual int get_current_frame() const = 0;
- virtual bool has_looped() const = 0;
-
- virtual void restart() = 0;
- virtual void advance(float delta_time) = 0;
- virtual void goto_frame(int frame_number) = 0;
- /// Returns true if labeled frame is found.
- virtual bool goto_labeled_frame(const char* label) = 0;
- virtual void display() = 0;
-
- enum play_state
- {
- PLAY,
- STOP
- };
-
- virtual void set_play_state(play_state s) = 0;
- virtual play_state get_play_state() const = 0;
-
- virtual void set_background_color(const rgba& bg_color) = 0;
-
- /// Set to 0 if you don't want the movie to render its
- /// background at all. 1 == full opacity.
- virtual void set_background_alpha(float alpha) = 0;
- virtual float get_background_alpha() const = 0;
-
- /// move/scale the movie...
- virtual void set_display_viewport(int x0, int y0, int w, int h) = 0;
-
- /// Input.
- virtual void notify_mouse_state(int x, int y, int buttons) = 0;
-
- /// Set an ActionScript variable within this movie.
- /// You can use this to set the value of text fields,
- /// ordinary variables, or properties of characters
- /// within the script.
- ///
- /// This version accepts UTF-8
- virtual void set_variable(const char* path_to_var, const char*
new_value) = 0;
- /// This version accepts UCS-2 or UCS-4, depending on sizeof(wchar_t)
- virtual void set_variable(const char* path_to_var, const wchar_t*
new_value) = 0;
- // @@ do we want versions that take a number?
-
- /// Get the value of an ActionScript variable.
- ///
- /// Value is ephemeral & not thread safe!!! Use it or
- /// copy it immediately.
- ///
- /// Returns UTF-8
- virtual const char* get_variable(const char* path_to_var) const = 0;
- // @@ do we want a version that returns a number?
-
- /// ActionScript method call. Return value points to a
- /// static string buffer with the result; caller should
- /// use the value immediately before making more calls
- /// to gnash. NOT THREAD SAFE!!!
- ///
- /// method_name is the name of the method (possibly namespaced).
- ///
- /// method_arg_fmt is a printf-style declaration of
- /// the method call, where the arguments are
- /// represented by { %d, %s, %f, %ls }, followed by the
- /// vararg list of actual arguments.
- ///
- /// E.g.
- ///
- /// m->call_method("path.to.method_name", "%d, %s, %f", i, "hello",
2.7f);
- ///
- /// The format args are a small subset of printf, namely:
- ///
- /// %d -- integer arg
- /// %s -- 0-terminated char* string arg
- /// %ls -- 0-terminated wchar_t* string arg
- /// %f -- float/double arg
- ///
- /// Whitespace and commas in the format string are ignored.
- ///
- /// This is not an ActionScript language parser, it
- /// doesn't recognize expressions or anything tricky.
-#ifdef __GNUC__
- // use the following to catch errors: (only with gcc)
- virtual const char* call_method(const char* method_name, const
char* method_arg_fmt, ...)
- __attribute__((format (printf, 3, 4))) = 0; // "this" is an
implied param, so fmt is 3 and ... is 4!
-#else // not __GNUC__
- virtual const char* call_method(const char* method_name, const
char* method_arg_fmt, ...) = 0;
-#endif // not __GNUC__
- virtual const char* call_method_args(const char* method_name, const
char* method_arg_fmt, va_list args) = 0;
-
-
- /// Make the movie visible/invisible.
- //
- /// An invisible
- /// movie does not advance and does not render.
- virtual void set_visible(bool visible) = 0;
-
- /// Return visibility status.
- virtual bool get_visible() const = 0;
-
- /// Get userdata, that's useful for the fs_command handler.
- virtual void *get_userdata() = 0;
-
- /// Set userdata, that's useful for the fs_command handler.
- virtual void set_userdata(void *) = 0;
-
- /// Display callbacks, for client rendering.
- //
- /// Callback is called after rendering the object
- /// it's attached to.
- ///
- /// Attach NULL to disable the callback.
- virtual void attach_display_callback(const char* path_to_object,
void (*callback)(void* user_ptr), void* user_ptr) = 0;
-
- virtual void get_url(const char *url) = 0;
- virtual int add_interval_timer(void *timer) = 0;
- virtual void clear_interval_timer(int x) = 0;
-
- /// for external movies
- virtual movie* get_root_movie() = 0;
-};
-
/// Try to grab movie info from the header of the given .swf file.
//
/// Sets *version to 0 if info can't be extracted.
Index: gnash/server/impl.cpp
diff -u gnash/server/impl.cpp:1.27 gnash/server/impl.cpp:1.28
--- gnash/server/impl.cpp:1.27 Sat May 6 22:10:47 2006
+++ gnash/server/impl.cpp Sun May 7 12:02:39 2006
@@ -70,7 +70,8 @@
//#include "Sprite.h"
#include "sprite_definition.h"
#include "Function.h"
-#include "Movie.h"
+//#include "Movie.h"
+#include "movie_def_impl.h"
#include "swf.h"
namespace gnash
Index: gnash/server/impl.h
diff -u gnash/server/impl.h:1.20 gnash/server/impl.h:1.21
--- gnash/server/impl.h:1.20 Mon Apr 24 23:05:56 2006
+++ gnash/server/impl.h Sun May 7 12:02:39 2006
@@ -51,6 +51,7 @@
#include "container.h"
#include "utility.h"
#include "smart_ptr.h"
+#include "movie_interface.h"
#include <stdarg.h>
namespace gnash {
Index: gnash/server/morph2.cpp
diff -u gnash/server/morph2.cpp:1.6 gnash/server/morph2.cpp:1.7
--- gnash/server/morph2.cpp:1.6 Wed Mar 29 05:42:41 2006
+++ gnash/server/morph2.cpp Sun May 7 12:02:39 2006
@@ -8,7 +8,8 @@
#include "morph2.h"
#include "stream.h"
-#include "Movie.h"
+//#include "Movie.h"
+#include "movie_definition.h"
namespace gnash {
Index: gnash/server/sound.cpp
diff -u gnash/server/sound.cpp:1.3 gnash/server/sound.cpp:1.4
--- gnash/server/sound.cpp:1.3 Sun Feb 26 21:44:53 2006
+++ gnash/server/sound.cpp Sun May 7 12:02:39 2006
@@ -10,7 +10,8 @@
#include "stream.h"
#include "impl.h"
#include "log.h"
-#include "Movie.h"
+//#include "Movie.h"
+#include "movie_definition.h"
namespace gnash {
// Callback interface to host, for handling sounds. If it's NULL,
Index: gnash/server/sprite_definition.h
diff -u gnash/server/sprite_definition.h:1.1
gnash/server/sprite_definition.h:1.2
--- gnash/server/sprite_definition.h:1.1 Sat May 6 22:10:47 2006
+++ gnash/server/sprite_definition.h Sun May 7 12:02:39 2006
@@ -44,7 +44,8 @@
#include <vector>
-#include "Movie.h"
+//#include "Movie.h"
+#include "movie_definition.h"
//#include "dlist.h" // display_list
#include "stream.h"
#include "log.h"
Index: gnash/server/sprite_instance.h
diff -u gnash/server/sprite_instance.h:1.1 gnash/server/sprite_instance.h:1.2
--- gnash/server/sprite_instance.h:1.1 Sat May 6 22:10:47 2006
+++ gnash/server/sprite_instance.h Sun May 7 12:02:39 2006
@@ -47,7 +47,8 @@
#include <vector>
-#include "Movie.h"
+#include "movie_definition.h"
+#include "movie_root.h"
#include "dlist.h" // display_list
#include "stream.h"
#include "log.h"
@@ -79,14 +80,14 @@
// sprite instance of add_interval_handler()
virtual int add_interval_timer(void *timer)
- {
- return m_root->add_interval_timer(timer);
- }
+ {
+ return m_root->add_interval_timer(timer);
+ }
virtual void clear_interval_timer(int x)
- {
- m_root->clear_interval_timer(x);
- }
+ {
+ m_root->clear_interval_timer(x);
+ }
/// Interval timer timeout executor
@@ -101,12 +102,12 @@
}
movie* get_root_movie() {
- return m_root->get_root_movie();
- }
+ return m_root->get_root_movie();
+ }
- movie_definition* get_movie_definition() {
- return m_def.get_ptr();
- }
+ movie_definition* get_movie_definition() {
+ return m_def.get_ptr();
+ }
float get_width();
Index: gnash/server/styles.cpp
diff -u gnash/server/styles.cpp:1.7 gnash/server/styles.cpp:1.8
--- gnash/server/styles.cpp:1.7 Wed Mar 29 05:42:41 2006
+++ gnash/server/styles.cpp Sun May 7 12:02:39 2006
@@ -11,7 +11,8 @@
#include "log.h"
#include "render.h"
#include "stream.h"
-#include "Movie.h"
+//#include "Movie.h"
+#include "movie_definition.h"
namespace gnash {
//
Index: gnash/server/text.cpp
diff -u gnash/server/text.cpp:1.12 gnash/server/text.cpp:1.13
--- gnash/server/text.cpp:1.12 Wed Mar 29 05:42:41 2006
+++ gnash/server/text.cpp Sun May 7 12:02:39 2006
@@ -17,7 +17,8 @@
#include "render.h"
#include "textformat.h"
#include "text.h"
-#include "Movie.h"
+//#include "Movie.h"
+#include "movie_definition.h"
namespace gnash {
Index: gnash/utilities/processor.cpp
diff -u gnash/utilities/processor.cpp:1.7 gnash/utilities/processor.cpp:1.8
--- gnash/utilities/processor.cpp:1.7 Sun Mar 12 00:35:15 2006
+++ gnash/utilities/processor.cpp Sun May 7 12:02:39 2006
@@ -44,7 +44,9 @@
#include "tu_file.h"
#include "container.h"
#include "gnash.h"
-#include "Movie.h"
+//#include "Movie.h"
+#include "movie_definition.h"
+#include "movie_interface.h"
#include "log.h"
#include <iostream>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ./ChangeLog backend/gnash.cpp server/ASSo...,
Sandro Santilli <=