[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog gui/Player.cpp gui/Player.h gui...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog gui/Player.cpp gui/Player.h gui... |
Date: |
Tue, 21 Nov 2006 00:25:47 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/11/21 00:25:47
Modified files:
. : ChangeLog
gui : Player.cpp Player.h gui.cpp gui.h
server : action.cpp action.h as_object.h
button_character_instance.cpp
button_character_instance.h character.h
dlist.cpp dlist.h edit_text_character.cpp
edit_text_character.h execute_tag.h
generic_character.cpp generic_character.h
gnash.h impl.cpp impl.h mouse_button_state.h
movie.h movie_interface.h movie_root.cpp
movie_root.h sound.cpp sound.h
sprite_instance.cpp sprite_instance.h
timers.cpp xmlsocket.cpp
server/asobj : MovieClipLoader.cpp
server/parser : movie_def_impl.cpp movie_def_impl.h
movie_definition.h sprite_definition.h
server/swf : ASHandlers.cpp tag_loaders.cpp
testsuite : MovieTester.cpp
testsuite/misc-ming.all:
DefineEditTextVariableNameTest-Runner.cpp
RollOverOutTest-Runner.cpp
utilities : processor.cpp
Log message:
Got rid of 'movie' and 'movie_interface' classes.
Please anyone help checking in the next days.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1684&r2=1.1685
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.h?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.49&r2=1.50
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/gnash/server/action.cpp?cvsroot=gnash&r1=1.108&r2=1.109
http://cvs.savannah.gnu.org/viewcvs/gnash/server/action.h?cvsroot=gnash&r1=1.49&r2=1.50
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.h?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button_character_instance.cpp?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button_character_instance.h?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.h?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/execute_tag.h?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/generic_character.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/generic_character.h?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/gnash.h?cvsroot=gnash&r1=1.74&r2=1.75
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.cpp?cvsroot=gnash&r1=1.74&r2=1.75
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.h?cvsroot=gnash&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/gnash/server/mouse_button_state.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie.h?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_interface.h?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sound.cpp?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sound.h?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.82&r2=1.83
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.cpp?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/xmlsocket.cpp?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/MovieClipLoader.cpp?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.cpp?cvsroot=gnash&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.h?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_definition.h?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/sprite_definition.h?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/ASHandlers.cpp?cvsroot=gnash&r1=1.97&r2=1.98
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/tag_loaders.cpp?cvsroot=gnash&r1=1.59&r2=1.60
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/MovieTester.cpp?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/RollOverOutTest-Runner.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/processor.cpp?cvsroot=gnash&r1=1.37&r2=1.38
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1684
retrieving revision 1.1685
diff -u -b -r1.1684 -r1.1685
--- ChangeLog 20 Nov 2006 23:21:43 -0000 1.1684
+++ ChangeLog 21 Nov 2006 00:25:46 -0000 1.1685
@@ -1,5 +1,33 @@
2006-11-20 Sandro Santilli <address@hidden>
+ * gui/Player.cpp, gui/Player.h, gui/gui.cpp,
+ gui/gui.h, server/action.cpp, server/action.h,
+ server/as_object.h, server/button_character_instance.cpp,
+ server/button_character_instance.h, server/character.h,
+ server/dlist.cpp, server/dlist.h, server/edit_text_character.cpp,
+ server/edit_text_character.h, server/execute_tag.h,
+ server/generic_character.cpp, server/generic_character.h,
+ server/gnash.h, server/impl.cpp, server/impl.h,
+ server/mouse_button_state.h, server/movie.h,
+ server/movie_interface.h, server/movie_root.cpp,
+ server/movie_root.h, server/sound.cpp, server/sound.h,
+ server/sprite_instance.cpp, server/sprite_instance.h,
+ server/timers.cpp, server/xmlsocket.cpp,
+ server/asobj/MovieClipLoader.cpp,
+ server/parser/movie_def_impl.cpp,
+ server/parser/movie_def_impl.h, server/parser/movie_definition.h,
+ server/parser/sprite_definition.h, server/swf/ASHandlers.cpp,
+ server/swf/tag_loaders.cpp, testsuite/MovieTester.cpp,
+ testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp,
+ testsuite/misc-ming.all/RollOverOutTest-Runner.cpp,
+ utilities/processor.cpp:
+ Got rid of 'movie' and 'movie_interface' classes.
+ Feel much better now.
+ Make check succeeds, but I'm sure we lost something...
+ please anyone help checking in the next days.
+
+2006-11-20 Sandro Santilli <address@hidden>
+
* server/event_id.h: include gnash.h for gnash::key def.
* server/shm.h: streamlined header inclusion.
Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- gui/Player.cpp 19 Nov 2006 17:39:01 -0000 1.29
+++ gui/Player.cpp 21 Nov 2006 00:25:46 -0000 1.30
@@ -53,6 +53,7 @@
#include "gnash.h"
#include "movie_definition.h"
#include "sprite_instance.h" // for setting FlashVars
+#include "movie_root.h"
#include "Player.h"
#include "URL.h"
@@ -73,7 +74,7 @@
/*static private*/
void
-Player::setFlashVars(gnash::movie_interface& m, const string& varstr)
+Player::setFlashVars(gnash::sprite_instance& m, const string& varstr)
{
gnash::sprite_instance* si = m.get_root_movie();
assert(si);
@@ -301,7 +302,7 @@
// Now that we know about movie size, create gui window.
_gui->createWindow(infile, width, height);
- gnash::movie_interface *m = create_library_movie_inst(_movie_def);
+ gnash::sprite_instance *m = create_library_movie_inst(_movie_def);
assert(m);
// Parse parameters
@@ -323,8 +324,10 @@
gnash::set_current_root(m);
- m->set_display_viewport(0, 0, width, height);
- m->set_background_alpha(background ? 1.0f : 0.05f);
+ movie_root* root = dynamic_cast<movie_root*>(m);
+ assert(root);
+ root->set_display_viewport(0, 0, width, height);
+ root->set_background_alpha(background ? 1.0f : 0.05f);
if (!delay) {
delay = (unsigned int) (1000 / movie_fps) ; // milliseconds per frame
@@ -345,7 +348,7 @@
/*static private*/
void
-Player::fs_callback(gnash::movie_interface* movie, const char* command, const
char* args)
+Player::fs_callback(gnash::sprite_instance* movie, const char* command, const
char* args)
// For handling notification callbacks from ActionScript.
{
log_msg("fs_callback(%p): %s %s'", (void*)movie, command, args);
Index: gui/Player.h
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- gui/Player.h 29 Oct 2006 18:34:10 -0000 1.6
+++ gui/Player.h 21 Nov 2006 00:25:46 -0000 1.7
@@ -35,7 +35,7 @@
// Forward declarations
namespace gnash
{
- class movie_interface;
+ class sprite_instance;
}
@@ -126,9 +126,9 @@
void init_gui();
- static void setFlashVars(movie_interface& m, const std::string& varstr);
+ static void setFlashVars(sprite_instance& m, const std::string& varstr);
- static void fs_callback(movie_interface* movie,
+ static void fs_callback(sprite_instance* movie,
const char* command, const char* args);
// Movie parameters (for -P)
Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- gui/gui.cpp 20 Nov 2006 15:08:17 -0000 1.49
+++ gui/gui.cpp 21 Nov 2006 00:25:46 -0000 1.50
@@ -24,13 +24,11 @@
#include <cstdio>
#include <cstring>
-//#include "log.h"
-//#include "gnash.h"
-//#include "movie_definition.h"
#include "sprite_instance.h"
#include "gui.h"
#include "render.h" // debug
#include "render_handler.h"
+#include "movie_root.h"
/// Define this to have updated regions enclosed in a red rectangle
/// In the future, enabling this might actually use a runtime flag
@@ -93,8 +91,12 @@
Gui::resize_view(int width, int height)
{
// GNASH_REPORT_FUNCTION;
- movie_interface* m = get_current_root();
- if (m) {
+ sprite_instance* m_sp = get_current_root();
+ if (m_sp) {
+
+ movie_root* m = dynamic_cast<movie_root*>(m_sp);
+ assert(m);
+
movie_definition* md = m->get_movie_definition();
float swfwidth = md->get_width_pixels();
@@ -138,7 +140,7 @@
Gui::menu_play()
{
// GNASH_REPORT_FUNCTION;
- get_current_root()->set_play_state(gnash::movie_interface::PLAY);
+ get_current_root()->set_play_state(gnash::sprite_instance::PLAY);
}
void
@@ -146,11 +148,11 @@
{
// GNASH_REPORT_FUNCTION;
- movie_interface* m = get_current_root();
- if (m->get_play_state() == gnash::movie_interface::STOP) {
- m->set_play_state(gnash::movie_interface::PLAY);
+ sprite_instance* m = get_current_root();
+ if (m->get_play_state() == gnash::sprite_instance::STOP) {
+ m->set_play_state(gnash::sprite_instance::PLAY);
} else {
- m->set_play_state(gnash::movie_interface::STOP);
+ m->set_play_state(gnash::sprite_instance::STOP);
}
}
@@ -159,14 +161,14 @@
Gui::menu_stop()
{
// GNASH_REPORT_FUNCTION;
- get_current_root()->set_play_state(gnash::movie_interface::STOP);
+ get_current_root()->set_play_state(gnash::sprite_instance::STOP);
}
void
Gui::menu_step_forward()
{
// GNASH_REPORT_FUNCTION;
- movie_interface* m = get_current_root();
+ sprite_instance* m = get_current_root();
m->goto_frame(m->get_current_frame()+1);
}
@@ -174,7 +176,7 @@
Gui::menu_step_backward()
{
// GNASH_REPORT_FUNCTION;
- movie_interface* m = get_current_root();
+ sprite_instance* m = get_current_root();
m->goto_frame(m->get_current_frame()-1);
}
@@ -182,7 +184,7 @@
Gui::menu_jump_forward()
{
// GNASH_REPORT_FUNCTION;
- movie_interface* m = get_current_root();
+ sprite_instance* m = get_current_root();
m->goto_frame(m->get_current_frame()+10);
}
@@ -190,14 +192,15 @@
Gui::menu_jump_backward()
{
// GNASH_REPORT_FUNCTION;
- movie_interface* m = get_current_root();
+ sprite_instance* m = get_current_root();
m->goto_frame(m->get_current_frame()-10);
}
void
Gui::notify_mouse_moved(int x, int y)
{
- movie_interface* m = get_current_root();
+ movie_root* m = dynamic_cast<movie_root*>(get_current_root());
+ assert(m);
if ( m->notify_mouse_moved(x, y) )
{
@@ -217,7 +220,8 @@
void
Gui::notify_mouse_clicked(bool mouse_pressed, int mask)
{
- movie_interface* m = get_current_root();
+ movie_root* m = dynamic_cast<movie_root*>(get_current_root());
+ assert(m);
if ( m->notify_mouse_clicked(mouse_pressed, mask) )
{
@@ -228,7 +232,7 @@
}
bool
-Gui::display(gnash::movie_interface* m)
+Gui::display(gnash::sprite_instance* m)
{
rect changed_bounds; // area of the stage that must be updated
bool redraw_flag;
@@ -306,7 +310,7 @@
// GNASH_REPORT_FUNCTION;
- gnash::movie_interface* m = gnash::get_current_root();
+ gnash::sprite_instance* m = gnash::get_current_root();
// Advance movie by one frame
m->advance(1.0);
Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- gui/gui.h 7 Nov 2006 13:09:38 -0000 1.37
+++ gui/gui.h 21 Nov 2006 00:25:46 -0000 1.38
@@ -33,7 +33,7 @@
namespace gnash
{
class render_handler;
- class movie_interface;
+ class sprite_instance;
}
namespace gnash
@@ -215,7 +215,7 @@
private:
- bool display(gnash::movie_interface* m);
+ bool display(gnash::sprite_instance* m);
};
Index: server/action.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/action.cpp,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -b -r1.108 -r1.109
--- server/action.cpp 11 Nov 2006 22:44:54 -0000 1.108
+++ server/action.cpp 21 Nov 2006 00:25:46 -0000 1.109
@@ -141,8 +141,8 @@
void
attach_extern_movie(const char* c_url,
- const movie* target,
- const movie* root_movie)
+ const sprite_instance* target,
+ const sprite_instance* root_movie)
{
URL url(c_url);
@@ -153,18 +153,18 @@
return;
}
- gnash::movie_interface* extern_movie;
+ gnash::sprite_instance* extern_movie;
if (target == root_movie)
{
extern_movie = create_library_movie_inst(md);
if (extern_movie == NULL)
{
- log_error("can't create extern root movie_interface for
%s\n", url.str().c_str());
+ log_error("can't create extern root sprite for %s\n",
url.str().c_str());
return;
}
set_current_root(extern_movie);
- movie* m = extern_movie->get_root_movie();
+ sprite_instance* m = extern_movie->get_root_movie();
m->on_event(event_id::LOAD);
}
@@ -173,7 +173,7 @@
extern_movie = md->create_instance();
if (extern_movie == NULL)
{
- log_error("can't create extern movie_interface for
%s\n", url.str().c_str());
+ log_error("can't create extern sprite for %s\n",
url.str().c_str());
return;
}
@@ -192,14 +192,15 @@
character* parent = tar->get_parent();
sprite_instance* newsprite = extern_movie->get_root_movie();
- assert(parent != NULL);
+ assert(parent);
assert(newsprite);
- //assert(dynamic_cast<sprite_instance*>(new_movie));
- //sprite_instance* newsprite =
static_cast<sprite_instance*>(new_movie);
newsprite->set_parent(parent);
- parent->replace_display_object(
+ sprite_instance* parent_sprite = parent->to_movie();
+ assert(parent_sprite);
+
+ parent_sprite->replace_display_object(
newsprite,
name,
depth,
Index: server/action.h
===================================================================
RCS file: /sources/gnash/gnash/server/action.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- server/action.h 11 Nov 2006 22:44:54 -0000 1.49
+++ server/action.h 21 Nov 2006 00:25:46 -0000 1.50
@@ -33,16 +33,14 @@
#include "gnash.h"
#include "as_object.h"
#include "types.h"
-#include <cwchar>
-
#include "container.h"
#include "smart_ptr.h"
-//#include "Function.h"
-//#include "log.h"
-//#include "as_environment.h" // for fn_call inlines
+
+#include <cwchar>
+
namespace gnash {
- class movie;
+ class sprite_instance;
class as_environment;
class as_object;
class as_value;
@@ -150,7 +148,7 @@
/// Returns M_INVALID_MEMBER if there's no match.
as_standard_member get_standard_member(const tu_stringi& name);
- void attach_extern_movie(const char* c_url, const movie* target,
const movie* root_movie);
+ void attach_extern_movie(const char* c_url, const sprite_instance*
target, const sprite_instance* root_movie);
} // end namespace gnash
Index: server/as_object.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/as_object.h 29 Oct 2006 18:34:11 -0000 1.18
+++ server/as_object.h 21 Nov 2006 00:25:46 -0000 1.19
@@ -35,7 +35,7 @@
// Forward declarations
class as_function;
-class movie;
+class sprite_instance;
class as_value;
class as_environment;
@@ -178,8 +178,8 @@
bool set_member_flags(const tu_stringi& name,
int setTrue, int setFalse=0);
- /// This object is not a movie; no conversion.
- virtual movie* to_movie() { return NULL; }
+ /// Cast to a sprite, or return NULL
+ virtual sprite_instance* to_movie() { return NULL; }
void clear();
Index: server/button_character_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/button_character_instance.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/button_character_instance.cpp 11 Nov 2006 22:44:54 -0000
1.15
+++ server/button_character_instance.cpp 21 Nov 2006 00:25:46 -0000
1.16
@@ -227,16 +227,20 @@
// Add appropriate actions to the movie's execute list...
- for (unsigned int i = 0; i < m_def->m_button_actions.size(); i++)
+ for (size_t i = 0, ie=m_def->m_button_actions.size(); i<ie; ++i)
{
- int keycode = (m_def->m_button_actions[i].m_conditions &
0xFE00) >> 9;
+ button_action& ba = m_def->m_button_actions[i];
+
+ int keycode = (ba.m_conditions & 0xFE00) >> 9;
event_id key_event = keycode < 32 ? s_key[keycode] :
event_id(event_id::KEY_PRESS, (key::code) keycode);
if (key_event == id)
{
// Matching action.
- for (unsigned int j = 0; j <
m_def->m_button_actions[i].m_actions.size(); j++)
+ for (size_t j=0, je=ba.m_actions.size(); j<je; ++j)
{
-
get_parent()->add_action_buffer(m_def->m_button_actions[i].m_actions[j]);
+ sprite_instance* si = get_parent()->to_movie();
+ assert ( si );
+ si->add_action_buffer(ba.m_actions[j]);
}
called = true;
}
@@ -327,7 +331,7 @@
}
-movie*
+character*
button_character_instance::get_topmost_mouse_entity(float x, float y)
// Return the topmost entity that the given point covers. NULL if none.
// I.e. check against ourself.
Index: server/button_character_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/button_character_instance.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/button_character_instance.h 11 Nov 2006 22:44:54 -0000 1.5
+++ server/button_character_instance.h 21 Nov 2006 00:25:46 -0000 1.6
@@ -5,7 +5,7 @@
// SWF buttons. Mouse-sensitive update/display, actions, etc.
-/* $Id: button_character_instance.h,v 1.5 2006/11/11 22:44:54 strk Exp $ */
+/* $Id: button_character_instance.h,v 1.6 2006/11/21 00:25:46 strk Exp $ */
#ifndef GNASH_BUTTON_CHARACTER_INSTANCE_H
#define GNASH_BUTTON_CHARACTER_INSTANCE_H
@@ -73,8 +73,6 @@
// called from keypress listener only
bool on_event(const event_id& id);
- movie_root* get_root() { return get_parent()->get_root(); }
-
void restart();
virtual void advance(float delta_time);
@@ -95,7 +93,7 @@
//
/// I.e. check against ourself.
///
- virtual movie* get_topmost_mouse_entity(float x, float y);
+ virtual character* get_topmost_mouse_entity(float x, float y);
virtual void on_button_event(const event_id& event);
Index: server/character.h
===================================================================
RCS file: /sources/gnash/gnash/server/character.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- server/character.h 11 Nov 2006 22:44:54 -0000 1.27
+++ server/character.h 21 Nov 2006 00:25:46 -0000 1.28
@@ -18,7 +18,7 @@
//
//
-/* $Id: character.h,v 1.27 2006/11/11 22:44:54 strk Exp $ */
+/* $Id: character.h,v 1.28 2006/11/21 00:25:46 strk Exp $ */
#ifndef GNASH_CHARACTER_H
#define GNASH_CHARACTER_H
@@ -32,8 +32,11 @@
#include "types.h"
#include "container.h" // still needed ?
#include "utility.h"
-#include "movie.h" // for inheritance (must drop)
#include "event_id.h" // for inlines
+#include "as_object.h" // for inheritance
+#include "rect.h" // for composition (invalidated bounds)
+#include "matrix.h" // for composition
+#include "log.h"
#include <map>
#include <cstdarg>
@@ -45,19 +48,41 @@
// Forward declarations
class sprite_instance;
+class movie_root;
/// Character is a live, stateful instance of a character_def.
//
/// It represents a single active element in a movie.
/// Inheritance from movie is an horrible truth!
///
-class character : public movie
+class character : public as_object
{
public:
typedef std::map<event_id, as_value> Events;
+ class drag_state
+ {
+ public:
+ character* m_character;
+ bool m_lock_center;
+ bool m_bound;
+ float m_bound_x0;
+ float m_bound_y0;
+ float m_bound_x1;
+ float m_bound_y1;
+
+ drag_state()
+ :
+ m_character(0), m_lock_center(0), m_bound(0),
+ m_bound_x0(0), m_bound_y0(0), m_bound_x1(1),
+ m_bound_y1(1)
+ {
+ }
+ };
+
+
private:
int m_id;
@@ -88,6 +113,16 @@
/// look for '.', '..', '_level0' and '_root'
character* get_relative_target_common(const std::string& name);
+ /// \brief
+ /// Set when the visual aspect this particular character or movie
+ /// has been changed and redrawing is necessary.
+ bool m_invalidated;
+
+
+ /// Bounds of character instance before invalidating it
+ rect m_old_invalidated_bounds;
+
+
public:
character(character* parent, int id)
@@ -100,8 +135,9 @@
m_display_callback(NULL),
m_display_callback_user_ptr(NULL),
m_visible(true),
- m_parent(parent)
-
+ m_parent(parent),
+ m_invalidated(true),
+ m_old_invalidated_bounds()
{
assert((parent == NULL && m_id == -1)
|| (parent != NULL && m_id >= 0));
@@ -226,6 +262,10 @@
virtual sprite_instance* get_root_movie();
+ virtual movie_root* get_root() {
+ return get_parent()->get_root();
+ }
+
/// Find the character which is one degree removed from us,
/// given the relative pathname.
///
@@ -288,17 +328,82 @@
virtual void get_mouse_state(int* x, int* y, int* buttons);
- void get_invalidated_bounds(rect*, bool) {
- log_msg("character::get_invalidated_bounds() called!\n"); // should
never happen
- // nop
- }
-
// TODO : make protected
const std::map<event_id, as_value>& get_event_handlers() const
{
return _event_handlers;
}
+ /// These have been moved down from movie.h to remove that file
+ /// from the inheritance chain. It is probably still a misdesign
+ /// to require these functions for all characters.
+ /// @{
+
+ virtual float get_pixel_scale() const
+ {
+ return 1.0f;
+ }
+
+ virtual movie_definition *get_movie_definition()
+ {
+ return NULL;
+ }
+
+ /// ActionScript event handler. Returns true if a handler was called.
+ //
+ /// Must be overridden or will always return false.
+ ///
+ virtual bool on_event(const event_id& /* id */)
+ {
+ return false;
+ }
+
+ virtual void on_button_event(const event_id& id)
+ {
+ on_event(id);
+ }
+
+ virtual character* get_topmost_mouse_entity(float /* x */, float /* y
*/)
+ {
+ return NULL;
+ }
+
+ /// @}
+
+ void set_invalidated()
+ {
+
+ // flag already set, don't do anything
+ if (m_invalidated) return;
+
+ m_invalidated = true;
+
+ // Ok, at this point the instance will change it's
+ // visual aspect after the
+ // call to set_invalidated(). We save the *current*
+ // position of the instance because this region must
+ // be updated even (or first of all) if the character
+ // moves away from here.
+ m_old_invalidated_bounds.set_null();
+ get_invalidated_bounds(&m_old_invalidated_bounds, true);
+
+ }
+
+ // Should be called by display()
+ void clear_invalidated() {
+ m_invalidated = false;
+ m_old_invalidated_bounds.set_null();
+ }
+
+
+ /// Checks if the character instance is still enclosed in
+ /// the given bounds. Otherwise it will expand them to surround
+ /// the character. It is used to determine what area needs
+ /// to be re-rendered. The coordinates are world coordinates.
+ /// Only instances with m_invalidated flag set are checked unless
+ /// force is set.
+ virtual void get_invalidated_bounds(rect* bounds, bool force) = 0;
+
};
Index: server/dlist.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- server/dlist.cpp 11 Nov 2006 22:44:54 -0000 1.38
+++ server/dlist.cpp 21 Nov 2006 00:25:46 -0000 1.39
@@ -22,6 +22,7 @@
#include "render.h"
#include "gnash.h"
#include "StringPredicates.h"
+#include "sprite_instance.h"
#include <typeinfo>
#include <iostream>
@@ -210,7 +211,9 @@
}
ch->on_event(event_id::CONSTRUCT);
- ch->execute_frame_tags(0, false);
+
+ sprite_instance* sprite_ch = ch->to_movie();
+ if ( sprite_ch ) sprite_ch->execute_frame_tags(0, false);
}
void
@@ -253,7 +256,8 @@
_characters.insert(it, di);
ch->on_event(event_id::CONSTRUCT);
- ch->execute_frame_tags(0, false);
+ sprite_instance* sprite_ch = ch->to_movie();
+ if ( sprite_ch ) sprite_ch->execute_frame_tags(0, false);
}
else
{
Index: server/dlist.h
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/dlist.h 11 Nov 2006 22:44:54 -0000 1.18
+++ server/dlist.h 21 Nov 2006 00:25:46 -0000 1.19
@@ -257,13 +257,20 @@
if ( ! visitor(di.get()) )
{
+ break;
+
+// The following logic must be implemented in the VISITOR,
+// not in the visiting function !!
+// (Vitaly, did you mean to do this in the MouseEntityFinder?)
+#if 0
// Can so happens that the uppermost depth contains
shape
// and under it the button lays
// therefore we skip empty(no events) depth
- if (di.get()->can_handle_mouse_event())
+ if (di->can_handle_mouse_event())
{
break;
}
+#endif
}
}
}
Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- server/edit_text_character.cpp 15 Nov 2006 12:57:07 -0000 1.30
+++ server/edit_text_character.cpp 21 Nov 2006 00:25:46 -0000 1.31
@@ -3,7 +3,7 @@
// This source code has been donated to the Public Domain. Do
// whatever you want with it.
-/* $Id: edit_text_character.cpp,v 1.30 2006/11/15 12:57:07 strk Exp $ */
+/* $Id: edit_text_character.cpp,v 1.31 2006/11/21 00:25:46 strk Exp $ */
#include "utf8.h"
#include "log.h"
@@ -56,8 +56,6 @@
on_event(event_id::KILLFOCUS);
}
-movie_root* edit_text_character::get_root() { return
get_parent()->get_root(); }
-
void edit_text_character::show_cursor()
{
uint16_t x = static_cast<uint16_t>(m_xcursor);
@@ -264,7 +262,8 @@
return true;
}
-movie* edit_text_character::get_topmost_mouse_entity(float x, float y)
+character*
+edit_text_character::get_topmost_mouse_entity(float x, float y)
{
if (get_visible() == false)
{
Index: server/edit_text_character.h
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/edit_text_character.h 13 Nov 2006 14:11:30 -0000 1.17
+++ server/edit_text_character.h 21 Nov 2006 00:25:46 -0000 1.18
@@ -51,9 +51,8 @@
~edit_text_character();
virtual bool can_handle_mouse_event() { return true; }
- virtual movie* get_topmost_mouse_entity(float x, float y);
+ virtual character* get_topmost_mouse_entity(float x, float y);
virtual bool on_event(const event_id& id);
- virtual movie_root *get_root();
virtual const char* get_variable_name() const
{
Index: server/execute_tag.h
===================================================================
RCS file: /sources/gnash/gnash/server/execute_tag.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/execute_tag.h 29 Oct 2006 18:34:11 -0000 1.5
+++ server/execute_tag.h 21 Nov 2006 00:25:46 -0000 1.6
@@ -31,7 +31,7 @@
namespace gnash {
// Forward declarations
-class movie;
+class sprite_instance;
/// Execute tags include things that control the operation of the movie.
//
@@ -44,16 +44,16 @@
{
}
- virtual void execute(movie* /*m*/)
+ virtual void execute(sprite_instance* /*m*/)
{
}
- virtual void execute_state(movie* /*m*/)
+ virtual void execute_state(sprite_instance* /*m*/)
{
}
// Is the 'frame' arg is really needed ?
- virtual void execute_state_reverse(movie* m, int /*frame*/)
+ virtual void execute_state_reverse(sprite_instance* m, int /*frame*/)
{
execute_state(m);
}
Index: server/generic_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/generic_character.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/generic_character.cpp 29 Oct 2006 18:34:11 -0000 1.2
+++ server/generic_character.cpp 21 Nov 2006 00:25:46 -0000 1.3
@@ -18,7 +18,7 @@
//
//
-/* $Id: generic_character.cpp,v 1.2 2006/10/29 18:34:11 rsavoye Exp $ */
+/* $Id: generic_character.cpp,v 1.3 2006/11/21 00:25:46 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -47,7 +47,7 @@
assert(0); // TO BE IMPLEMENTED!!!!!
}
-movie*
+character*
generic_character::get_topmost_mouse_entity(float x, float y)
{
assert(get_visible()); // caller should check this.
Index: server/generic_character.h
===================================================================
RCS file: /sources/gnash/gnash/server/generic_character.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/generic_character.h 7 Nov 2006 17:16:18 -0000 1.15
+++ server/generic_character.h 21 Nov 2006 00:25:46 -0000 1.16
@@ -86,7 +86,7 @@
return m_def->get_width_local();
}
- virtual movie* get_topmost_mouse_entity(float x, float y);
+ virtual character* get_topmost_mouse_entity(float x, float y);
/// \brief
/// Return the character definition from which this
Index: server/gnash.h
===================================================================
RCS file: /sources/gnash/gnash/server/gnash.h,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -b -r1.74 -r1.75
--- server/gnash.h 11 Nov 2006 22:44:54 -0000 1.74
+++ server/gnash.h 21 Nov 2006 00:25:46 -0000 1.75
@@ -17,7 +17,7 @@
//
//
-/* $Id: gnash.h,v 1.74 2006/11/11 22:44:54 strk Exp $ */
+/* $Id: gnash.h,v 1.75 2006/11/21 00:25:46 strk Exp $ */
/// \mainpage
///
@@ -34,7 +34,7 @@
#include "tu_config.h"
#include <cctype> // for poxy wchar_t
-#include <cstdarg> // for va_list arg to
movie_interface::call_method_args()
+#include <cstdarg> // for va_list arg to
sprite_instance::call_method_args()
#include <string> // for movie_definition* create_movie(tu_file* in,
const std::string& url);
#include "ref_counted.h" // for bitmap_info inheritance
@@ -71,7 +71,7 @@
class font;
class matrix;
class movie;
-class movie_interface;
+class sprite_instance;
class movie_definition;
class render_handler;
class resource;
@@ -126,7 +126,7 @@
void register_progress_callback(progress_callback progress_handle);
/// Signature of fscommand callback function
-typedef void (*fscommand_callback)(movie_interface* movie, const char*
command, const char* arg);
+typedef void (*fscommand_callback)(sprite_instance* movie, const char*
command, const char* arg);
/// ActionScripts embedded in a movie can use the built-in
/// fscommand() function to send data back to the host
@@ -134,7 +134,7 @@
/// a handler, which will be called when the embedded scripts
/// call fscommand().
///
-/// The handler gets the movie_interface* that the script is
+/// The handler gets the sprite_instance* that the script is
/// embedded in, and the two string arguments passed by the
/// script to fscommand().
DSOEXPORT void register_fscommand_callback(fscommand_callback handler);
@@ -727,7 +727,7 @@
} // end namespace key
/// Key events are global throughout gnash.
-/// @@ Maybe someday make these local to the movie_interface?
+/// @@ Maybe someday make these local to the movie_root ?
/// See \ref events_handling for more info
DSOEXPORT void notify_key_event(key::code k, bool down);
Index: server/impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/impl.cpp,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -b -r1.74 -r1.75
--- server/impl.cpp 17 Nov 2006 13:40:33 -0000 1.74
+++ server/impl.cpp 21 Nov 2006 00:25:46 -0000 1.75
@@ -18,7 +18,7 @@
//
//
-/* $Id: impl.cpp,v 1.74 2006/11/17 13:40:33 strk Exp $ */
+/* $Id: impl.cpp,v 1.75 2006/11/21 00:25:46 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -596,13 +596,15 @@
static MovieLibrary s_movie_library;
-static hash< movie_definition*, boost::intrusive_ptr<movie_interface> >
s_movie_library_inst;
-static std::vector<movie_interface*> s_extern_sprites;
-static movie_interface* s_current_root;
+static hash< movie_definition*, boost::intrusive_ptr<sprite_instance> >
s_movie_library_inst;
+static std::vector<sprite_instance*> s_extern_sprites;
+
+// FIXME: use a smart pointer here
+static sprite_instance* s_current_root;
static std::string s_workdir;
-void save_extern_movie(movie_interface* m)
+void save_extern_movie(sprite_instance* m)
{
s_extern_sprites.push_back(m);
}
@@ -612,7 +614,7 @@
{
for (unsigned int i = 0; i < s_extern_sprites.size(); i++)
{
- movie_interface* root_m = s_extern_sprites[i];
+ sprite_instance* root_m = s_extern_sprites[i];
sprite_instance* m = root_m->get_root_movie();
if (m->get_ref_count() < 2)
@@ -626,13 +628,13 @@
}
//#endif // 0
-movie_interface* get_current_root()
+sprite_instance* get_current_root()
{
// assert(s_current_root != NULL);
return s_current_root;
}
-void set_current_root(movie_interface* m)
+void set_current_root(sprite_instance* m)
{
assert(m != NULL);
s_current_root = m;
@@ -711,11 +713,11 @@
return mov;
}
-movie_interface* create_library_movie_inst(movie_definition* md)
+sprite_instance* create_library_movie_inst(movie_definition* md)
{
// Is the movie instance already in the library?
{
- boost::intrusive_ptr<movie_interface> m;
+ boost::intrusive_ptr<sprite_instance> m;
s_movie_library_inst.get(md, &m);
if (m != NULL)
{
@@ -726,7 +728,7 @@
}
// Try to create movie interface
- movie_interface* mov = md->create_instance();
+ sprite_instance* mov = md->create_instance();
if (mov == NULL)
{
@@ -779,7 +781,7 @@
} save_stuff_instance;
// Need an instance.
- gnash::movie_interface* m = movie_def->create_instance();
+ gnash::sprite_instance* m = movie_def->create_instance();
if (m == NULL)
{
log_error("precompute_cached_data can't create instance of
movie\n");
@@ -814,12 +816,12 @@
break;
}
- if (m->get_play_state() == gnash::movie_interface::STOP)
+ if (m->get_play_state() == gnash::sprite_instance::STOP)
{
// Kick the movie.
//printf("kicking movie, kick ct = %d\n", kick_count);
m->goto_frame(last_frame + 1);
- m->set_play_state(gnash::movie_interface::PLAY);
+ m->set_play_state(gnash::sprite_instance::PLAY);
kick_count++;
if (kick_count > 10)
Index: server/impl.h
===================================================================
RCS file: /sources/gnash/gnash/server/impl.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- server/impl.h 29 Oct 2006 18:34:11 -0000 1.38
+++ server/impl.h 21 Nov 2006 00:25:46 -0000 1.39
@@ -18,7 +18,7 @@
//
//
-/* $Id: impl.h,v 1.38 2006/10/29 18:34:11 rsavoye Exp $ */
+/* $Id: impl.h,v 1.39 2006/11/21 00:25:46 strk Exp $ */
#ifndef GNASH_IMPL_H
#define GNASH_IMPL_H
@@ -30,15 +30,13 @@
#include "tu_config.h"
#include "gnash.h"
-//#include "action_buffer.h"
#include "types.h"
#include "container.h"
#include "utility.h"
#include "smart_ptr.h"
-#include "movie_interface.h"
-#include "character.h"
#include "resource.h" // for sound_sample inheritance
#include "swf/TagLoadersTable.h"
+#include "matrix.h" // for display_info composition
#include <cstdarg>
#include <cassert>
@@ -55,6 +53,7 @@
class font;
class movie_root;
class stream;
+class sprite_instance;
class sound_sample : public resource //virtual public ref_counted
{
@@ -62,15 +61,15 @@
virtual sound_sample* cast_to_sound_sample() { return this; }
};
-DSOEXPORT void save_extern_movie(movie_interface* m);
+DSOEXPORT void save_extern_movie(sprite_instance* m);
// for extern movies
-DSOEXPORT movie_interface *create_library_movie_inst(movie_definition* md);
+DSOEXPORT sprite_instance *create_library_movie_inst(movie_definition* md);
-DSOEXPORT movie_interface *get_current_root();
-DSOEXPORT void set_current_root(movie_interface* m);
+DSOEXPORT sprite_instance *get_current_root();
+DSOEXPORT void set_current_root(sprite_instance* m);
DSOEXPORT const char* get_workdir();
DSOEXPORT void set_workdir(const char* dir);
DSOEXPORT void delete_unused_root();
Index: server/mouse_button_state.h
===================================================================
RCS file: /sources/gnash/gnash/server/mouse_button_state.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/mouse_button_state.h 11 Nov 2006 22:44:54 -0000 1.4
+++ server/mouse_button_state.h 21 Nov 2006 00:25:46 -0000 1.5
@@ -27,10 +27,10 @@
public:
/// entity that currently owns the mouse pointer
- boost::intrusive_ptr<movie> m_active_entity;
+ boost::intrusive_ptr<character> m_active_entity;
/// what's underneath the mouse right now
- boost::intrusive_ptr<movie> m_topmost_entity;
+ boost::intrusive_ptr<character> m_topmost_entity;
/// previous state of mouse button
bool m_mouse_button_state_last;
Index: server/movie.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- server/movie.h 18 Nov 2006 11:12:22 -0000 1.26
+++ server/movie.h 21 Nov 2006 00:25:46 -0000 1.27
@@ -43,6 +43,8 @@
class swf_event;
class event_id;
+#if 0
+
/// \brief
/// @@@ To be obsoleted. This class is only confusing.
class movie : public movie_interface
@@ -243,26 +245,6 @@
assert(0);
}
- class drag_state
- {
- public:
- movie* m_character;
- bool m_lock_center;
- bool m_bound;
- float m_bound_x0;
- float m_bound_y0;
- float m_bound_x1;
- float m_bound_y1;
-
- drag_state()
- :
- m_character(0), m_lock_center(0), m_bound(0),
- m_bound_x0(0), m_bound_y0(0), m_bound_x1(1),
- m_bound_y1(1)
- {
- }
- };
-
virtual void get_drag_state(drag_state* /* st */)
{
assert(0);
@@ -488,6 +470,8 @@
};
+#endif
+
} // end namespace gnash
Index: server/movie_interface.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_interface.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/movie_interface.h 2 Nov 2006 21:39:16 -0000 1.18
+++ server/movie_interface.h 21 Nov 2006 00:25:46 -0000 1.19
@@ -17,56 +17,9 @@
//
//
-/* $Id: movie_interface.h,v 1.18 2006/11/02 21:39:16 strk Exp $ */
+/* $Id: movie_interface.h,v 1.19 2006/11/21 00:25:46 strk Exp $ */
-/// \page events_handling Handling of user events
-///
-/// There are two kinds of events:
-/// - system generated
-/// - user generated
-///
-/// System generated events are those like load, data recive, unload,
-/// enter frame, etc.
-/// User generated events are mouse movements and clicks, keyboard activity.
-///
-/// Events can trigger actions execution, if "handlers" are specified for
-/// a specific event with ActionScript code.
-/// The actions triggered by user events are executed *immediately*, not
-/// at the next frame iteration. Nonetheless, since rendering of the stage
-/// usually happens at fixed rate (frame rate) you won't see the effects
-/// of actions execution until next iteration... unless...
-///
-/// Well, *some* events actions always trigger immediate redisplay, while
-/// some others require a call to a special function to do so.
-///
-/// The events actions that trigger immediate redisplay are Button actions.
-/// Colin Mook, in his "ActionScript - The Definitive Guide" sais:
-/// << Buttons naturally update between frames >>
-///
-/// Other events, in particular MovieClip events such as mouseDown, mouseUp,
-/// mouseMove, keyDown and keyUp don't by default trigger redisplay, unless
-/// the attached action code makes a call to the special function named
-/// 'updateAfterEvent()'.
-///
-/// For this purpose, user events notification functions in gnash core
-/// library return a boolean value, which tells wheter any action triggered
-/// by the event requires immediate redisplay.
-///
-/// At the time of writing (2006-10-19) this is not implemented yet and
-/// the return code is always TRUE. We shall work on it :)
-///
-/// The events notification functions that currently support this interface
-/// are:
-///
-/// - bool movie_interface::notify_mouse_moved(int x, int y);
-/// - bool movie_interface::notify_mouse_clicked(bool mouse_pressed, int mask);
-///
-/// Note that the notify_key_event() method is a global function, which should
-/// likely be moved somewhere else, and that has not been fixed yet to support
-/// the new interface.
-///
-
#ifndef GNASH_MOVIE_INTERFACE_H
#define GNASH_MOVIE_INTERFACE_H
@@ -88,6 +41,8 @@
namespace gnash {
+#if 0
+
/// An independent stateful live movie. (should be movie_instance?)
//
/// This is the client program's interface to an instance of a
@@ -100,9 +55,7 @@
movie_interface()
:
- as_object(),
- m_invalidated(true),
- m_old_invalidated_bounds()
+ as_object()
{}
virtual movie_definition* get_movie_definition() = 0;
@@ -118,12 +71,6 @@
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;
@@ -259,59 +206,15 @@
/// VERY IMPORTANT!! This function *must* be called *before* the changes are
/// applied!
/// TODO: move to character class
- void set_invalidated() {
-
- if (m_invalidated) return; // flag already set, don't do anything
-
- m_invalidated = true;
-
- // Ok, at this point the instance will change it's visual aspect
after the
- // call to set_invalidated(). We save the *current* position of the
- // instance because this region must be updated even (or first of all) if
- // the character moves away from here.
- m_old_invalidated_bounds.set_null();
- get_invalidated_bounds(&m_old_invalidated_bounds, true);
-
- }
-
- // Should be called by display()
- /// TODO: move to character class
- void clear_invalidated() {
- m_invalidated = false;
- m_old_invalidated_bounds.set_null();
- }
-
-
- /// Checks if the character instance is still enclosed in the given bounds.
- /// Otherwise it will expand them to surround the character. It is used to
- /// determine what area needs to be re-rendered. The coordinates are world
- /// coordinates.
- /// Only instances with m_invalidated flag set are checked unless force
- /// is set.
- /// TODO: move to character class
- virtual void get_invalidated_bounds(rect* bounds, bool force) = 0;
-
/// Return true if the mouse pointer is over an active entity
//
/// @@ shouldn't these be globals instead ? (togheter with
notify_mouse_moved and notify_mouse_clicked)
virtual bool isMouseOverActiveEntity() const { return false; }
-protected:
-
- /// Set when the visual aspect this particular character or movie
- /// has been changed and redrawing is necessary.
- //
- /// TODO: move to character class
- ///
- bool m_invalidated;
-
-
- /// Bounds of character instance before invalidating it
- /// TODO: move to character class
- rect m_old_invalidated_bounds;
-
};
+#endif
+
} // namespace gnash
#endif // GNASH_MOVIE_INTERFACE_H
Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- server/movie_root.cpp 15 Nov 2006 12:37:32 -0000 1.27
+++ server/movie_root.cpp 21 Nov 2006 00:25:46 -0000 1.28
@@ -41,7 +41,8 @@
movie_root::movie_root(movie_def_impl* def)
:
- m_def(def),
+ sprite_instance(def, this, NULL, -1),
+ //m_def(def),
m_viewport_x0(0),
m_viewport_y0(0),
m_viewport_width(1),
@@ -136,8 +137,8 @@
bool
generate_mouse_button_events(mouse_button_state* ms)
{
- boost::intrusive_ptr<movie> active_entity = ms->m_active_entity;
- boost::intrusive_ptr<movie> topmost_entity = ms->m_topmost_entity;
+ boost::intrusive_ptr<character> active_entity = ms->m_active_entity;
+ boost::intrusive_ptr<character> topmost_entity = ms->m_topmost_entity;
// Did this event trigger any action that needs redisplay ?
bool need_redisplay = false;
@@ -146,25 +147,7 @@
{
// Mouse button was down.
- // Handle trackAsMenu dragOver
- if (active_entity == NULL
- || active_entity->get_track_as_menu())
- {
- if (topmost_entity != NULL
- && topmost_entity != active_entity
- && topmost_entity->get_track_as_menu() == true)
- {
- // Transfer to topmost entity, dragOver
- active_entity = topmost_entity;
-
active_entity->on_button_event(event_id::DRAG_OVER);
- ms->m_mouse_inside_entity_last = true;
-
- // TODO: have on_button_event return
- // wheter the action must trigger
- // a redraw.
- need_redisplay=true;
- }
- }
+ // TODO: Handle trackAsMenu dragOver
// Handle onDragOut, onDragOver
if (ms->m_mouse_inside_entity_last == false)
@@ -221,9 +204,9 @@
}
else
{
+ // TODO: Handle trackAsMenu
+
// onReleaseOutside
- if (active_entity->get_track_as_menu()
== false)
- {
active_entity->on_button_event(event_id::RELEASE_OUTSIDE);
// TODO: have on_button_event return
// wheter the action must trigger
@@ -233,7 +216,6 @@
}
}
}
- }
if (ms->m_mouse_button_state_last == 0)
{
@@ -275,7 +257,7 @@
// set/kill focus for current root
movie_root* mroot = static_cast<movie_root*>(
get_current_root() );
assert(mroot);
- movie* current_active_entity =
mroot->get_active_entity();
+ character* current_active_entity =
mroot->get_active_entity();
// It's another entity ?
if (current_active_entity != active_entity.get())
@@ -581,12 +563,14 @@
}
}
-movie* movie_root::get_active_entity()
+character*
+movie_root::get_active_entity()
{
return m_active_input_text;
}
-void movie_root::set_active_entity(movie* ch)
+void
+movie_root::set_active_entity(character* ch)
{
m_active_input_text = ch;
}
@@ -594,7 +578,7 @@
bool
movie_root::isMouseOverActiveEntity() const
{
- boost::intrusive_ptr<movie> entity (
m_mouse_button_state.m_active_entity );
+ boost::intrusive_ptr<character> entity (
m_mouse_button_state.m_active_entity );
if ( ! entity.get() ) return false;
#if 0 // debugging...
Index: server/movie_root.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- server/movie_root.h 13 Nov 2006 17:10:57 -0000 1.25
+++ server/movie_root.h 21 Nov 2006 00:25:46 -0000 1.26
@@ -14,10 +14,55 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-//
-//
+/* $Id: movie_root.h,v 1.26 2006/11/21 00:25:46 strk Exp $ */
+
+/// \page events_handling Handling of user events
+///
+/// There are two kinds of events:
+/// - system generated
+/// - user generated
+///
+/// System generated events are those like load, data recive, unload,
+/// enter frame, etc.
+/// User generated events are mouse movements and clicks, keyboard activity.
+///
+/// Events can trigger actions execution, if "handlers" are specified for
+/// a specific event with ActionScript code.
+/// The actions triggered by user events are executed *immediately*, not
+/// at the next frame iteration. Nonetheless, since rendering of the stage
+/// usually happens at fixed rate (frame rate) you won't see the effects
+/// of actions execution until next iteration... unless...
+///
+/// Well, *some* events actions always trigger immediate redisplay, while
+/// some others require a call to a special function to do so.
+///
+/// The events actions that trigger immediate redisplay are Button actions.
+/// Colin Mook, in his "ActionScript - The Definitive Guide" sais:
+/// << Buttons naturally update between frames >>
+///
+/// Other events, in particular MovieClip events such as mouseDown, mouseUp,
+/// mouseMove, keyDown and keyUp don't by default trigger redisplay, unless
+/// the attached action code makes a call to the special function named
+/// 'updateAfterEvent()'.
+///
+/// For this purpose, user events notification functions in gnash core
+/// library return a boolean value, which tells wheter any action triggered
+/// by the event requires immediate redisplay.
+///
+/// At the time of writing (2006-10-19) this is not implemented yet and
+/// the return code is always TRUE. We shall work on it :)
+///
+/// The events notification functions that currently support this interface
+/// are:
+///
+/// - bool movie_root::notify_mouse_moved(int x, int y);
+/// - bool movie_root::notify_mouse_clicked(bool mouse_pressed, int mask);
+///
+/// Note that the notify_key_event() method is a global function, which should
+/// likely be moved somewhere else, and that has not been fixed yet to support
+/// the new interface.
+///
-/* $Id: movie_root.h,v 1.25 2006/11/13 17:10:57 strk Exp $ */
#ifndef GNASH_MOVIE_ROOT_H
#define GNASH_MOVIE_ROOT_H
@@ -27,11 +72,11 @@
#include "timers.h" // for Timer
#include "fontlib.h"
#include "font.h"
-//#include "jpeg.h"
#include "tu_file.h"
#include "movie_def_impl.h"
#include "tu_config.h"
#include "sprite_instance.h" // for inlines
+#include "movie_instance.h" // for inheritance
namespace gnash
{
@@ -44,9 +89,8 @@
/// Global, shared root state for a movie and all its characters.
-class movie_root : public movie_interface // inheritance should be dropped
+class movie_root : public sprite_instance
{
- boost::intrusive_ptr<movie_def_impl> m_def;
int m_viewport_x0, m_viewport_y0;
int m_viewport_width, m_viewport_height;
float m_pixel_scale;
@@ -65,14 +109,15 @@
bool m_on_event_load_progress_called;
std::vector<Timer *> m_interval_timers;
std::vector< as_object* > m_keypress_listeners;
- movie* m_active_input_text;
+ character* m_active_input_text;
float m_time_remainder;
public:
// XXXbastiaan: make these two variables private
boost::intrusive_ptr<sprite_instance> m_movie;
+
/// @@ fold this into m_mouse_button_state?
- movie::drag_state m_drag_state;
+ sprite_instance::drag_state m_drag_state;
movie_root(movie_def_impl* def);
@@ -91,17 +136,36 @@
return false;
}
- /// @@ should this return m_movie.get()?
- virtual movie* to_movie() { assert(0); return 0; }
-
void set_root_movie(sprite_instance* root_movie);
void set_display_viewport(int x0, int y0, int w, int h);
- // derived from movie_interface, see dox in movie_interface.h
+ /// \brief
+ /// The host app can use this to tell the movie when
+ /// user's mouse pointer has moved.
+ //
+ /// Coordinates are in pixels.
+ ///
+ /// This function should return TRUE iff any action triggered
+ /// by the event requires redraw, see \ref events_handling for
+ /// more info.
+ ///
bool notify_mouse_moved(int x, int y);
- // derived from movie_interface, see dox in movie_interface.h
+ /// \brief
+ /// The host app can use this to tell the movie when the
+ /// user clicked or released the mouse button.
+ //
+ /// @param mouse_pressed
+ /// true if the mouse has been pressed, false if released
+ ///
+ /// @param mask
+ /// ???
+ ///
+ /// This function should return TRUE iff any action triggered
+ /// by the event requires redraw, see \ref events_handling for
+ /// more info.
+ ///
bool notify_mouse_clicked(bool mouse_pressed, int mask);
/// The host app can use this to tell the movie where the
@@ -120,31 +184,6 @@
return m_movie->get_movie_definition();
}
-#if 0 // renamed to get_bytes_total
- uint32 get_file_bytes() const {
- return m_def->get_file_bytes();
- }
-#endif
-
- /// Get number of bytes loaded from input stream
- uint32 get_bytes_loaded() const {
- return m_def->get_bytes_loaded();
- }
-
- /// Get total number of bytes in input stream
- uint32 get_bytes_total() const {
- return m_def->get_bytes_total();
- }
-
- virtual void get_url(const char *url) {
- // SWFHandlers::ActionGetUrl calls get_url
- // on target, which is always a sprite_instance
- // (well, a character, at least)
- assert(0);
- // @@ delegate to actual sprite instance
- m_movie->get_url(url);
- }
-
virtual int add_interval_timer(void *timer);
virtual void clear_interval_timer(int x);
virtual void do_something(void *timer);
@@ -154,6 +193,7 @@
return m_movie->get_current_frame();
}
+ // @@ should this be in movie_instance ?
float get_frame_rate() const {
return m_def->get_frame_rate();
}
@@ -260,8 +300,8 @@
void add_keypress_listener(as_object* listener);
void remove_keypress_listener(as_object* listener);
- movie* get_active_entity();
- void set_active_entity(movie* ch);
+ character* get_active_entity();
+ void set_active_entity(character* ch);
void get_invalidated_bounds(rect* bounds, bool force)
{
Index: server/sound.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sound.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- server/sound.cpp 18 Nov 2006 11:12:22 -0000 1.20
+++ server/sound.cpp 21 Nov 2006 00:25:46 -0000 1.21
@@ -11,6 +11,7 @@
#include "impl.h"
#include "execute_tag.h" // for start_sound_tag inheritance
#include "movie_definition.h"
+#include "sprite_instance.h"
namespace gnash {
@@ -96,7 +97,7 @@
void
-start_sound_tag::execute(movie* /* m */)
+start_sound_tag::execute(sprite_instance* /* m */)
{
using globals::s_sound_handler;
@@ -129,7 +130,7 @@
void
-start_stream_sound_tag::execute(movie* m)
+start_stream_sound_tag::execute(sprite_instance* m)
{
using globals::s_sound_handler;
if (s_sound_handler)
Index: server/sound.h
===================================================================
RCS file: /sources/gnash/gnash/server/sound.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/sound.h 16 Oct 2006 14:33:38 -0000 1.5
+++ server/sound.h 21 Nov 2006 00:25:46 -0000 1.6
@@ -59,7 +59,7 @@
void read(stream* in, int tag_type,
movie_definition* m, const sound_sample_impl* sam);
- void execute(movie* m);
+ void execute(sprite_instance* m);
};
/// SWF Tag SoundStreamBlock (19)
@@ -87,7 +87,7 @@
void read(movie_definition* m, int handler_id, long start);
- void execute(movie* m);
+ void execute(sprite_instance* m);
};
}
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -b -r1.82 -r1.83
--- server/sprite_instance.cpp 18 Nov 2006 11:12:22 -0000 1.82
+++ server/sprite_instance.cpp 21 Nov 2006 00:25:46 -0000 1.83
@@ -88,7 +88,7 @@
sprite = dynamic_cast<sprite_instance*>(fn.env->get_target());
}
assert(sprite);
- sprite->set_play_state(movie_interface::PLAY);
+ sprite->set_play_state(sprite_instance::PLAY);
}
static void sprite_stop(const fn_call& fn)
@@ -100,7 +100,7 @@
sprite = dynamic_cast<sprite_instance*>(fn.env->get_target());
}
assert(sprite);
- sprite->set_play_state(movie_interface::STOP);
+ sprite->set_play_state(sprite_instance::STOP);
// Stop sound stream as well, if such exist
int stream_id = sprite->get_sound_stream_id();
@@ -341,10 +341,11 @@
}
character* parent = sprite->get_parent();
+ sprite_instance* parent_sprite = parent ? parent->to_movie() : NULL;
character* ch = NULL;
- if (parent != NULL)
+ if (parent_sprite)
{
- ch = parent->add_display_object(
+ ch = parent_sprite->add_display_object(
sprite->get_id(),
fn.arg(0).to_string(),
event_handlers,
@@ -386,7 +387,7 @@
size_t target_frame = size_t(fn.arg(0).to_number() - 1);
sprite->goto_frame(target_frame);
- sprite->set_play_state(movie_interface::PLAY);
+ sprite->set_play_state(sprite_instance::PLAY);
}
static void sprite_goto_and_stop(const fn_call& fn)
@@ -409,7 +410,7 @@
size_t target_frame = size_t(fn.arg(0).to_number() - 1);
sprite->goto_frame(target_frame);
- sprite->set_play_state(movie_interface::STOP);
+ sprite->set_play_state(sprite_instance::STOP);
}
static void sprite_next_frame(const fn_call& fn)
@@ -428,7 +429,7 @@
{
sprite->goto_frame(current_frame + 1);
}
- sprite->set_play_state(movie_interface::STOP);
+ sprite->set_play_state(sprite_instance::STOP);
}
static void sprite_prev_frame(const fn_call& fn)
@@ -446,7 +447,7 @@
{
sprite->goto_frame(current_frame - 1);
}
- sprite->set_play_state(movie_interface::STOP);
+ sprite->set_play_state(sprite_instance::STOP);
}
static void sprite_get_bytes_loaded(const fn_call& fn)
@@ -2183,7 +2184,7 @@
/// Find a character hit by the given coordinates.
class MouseEntityFinder {
- movie* _m;
+ character* _m;
float _x;
@@ -2202,7 +2203,7 @@
{
if ( ! ch->get_visible() ) return true;
- movie* te = ch->get_topmost_mouse_entity(_x, _y);
+ character* te = ch->get_topmost_mouse_entity(_x, _y);
if ( te )
{
_m = te;
@@ -2212,11 +2213,11 @@
return true; // haven't found it yet
}
- movie* getEntity() { return _m; }
+ character* getEntity() { return _m; }
};
-movie*
+character*
sprite_instance::get_topmost_mouse_entity(float x, float y)
{
//GNASH_REPORT_FUNCTION;
@@ -2232,7 +2233,7 @@
MouseEntityFinder finder(p.m_x, p.m_y);
m_display_list.visitBackward(finder);
- movie* ch = finder.getEntity();
+ character* ch = finder.getEntity();
if ( ch && can_handle_mouse_event() )
{
@@ -2481,4 +2482,5 @@
m_display_list.get_invalidated_bounds(bounds, force||m_invalidated);
}
+
} // namespace gnash
Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- server/sprite_instance.h 18 Nov 2006 11:12:22 -0000 1.39
+++ server/sprite_instance.h 21 Nov 2006 00:25:46 -0000 1.40
@@ -17,7 +17,7 @@
//
//
-/* $Id: sprite_instance.h,v 1.39 2006/11/18 11:12:22 tgc Exp $ */
+/* $Id: sprite_instance.h,v 1.40 2006/11/21 00:25:46 strk Exp $ */
// Stateful live Sprite instance
@@ -35,7 +35,6 @@
#include "edit_text_character.h" // temp hack
#include "movie_definition.h" // for inlines
#include "dlist.h" // DisplayList
-//#include "stream.h"
#include "log.h"
#include "as_environment.h" // for composition
@@ -44,7 +43,7 @@
// Forward declarations
class movie_root;
-//class edit_text_character;
+class swf_event;
/// Stateful Sprite object. Also known as a MovieClip.
//
@@ -58,7 +57,7 @@
public:
typedef std::list<action_buffer*> ActionList;
- // must match movie_definition::PlayList
+ // definition must match movie_definition::PlayList
typedef std::vector<execute_tag*> PlayList;
sprite_instance(movie_definition* def,
@@ -74,6 +73,12 @@
OVER
};
+ enum play_state
+ {
+ PLAY,
+ STOP
+ };
+
virtual void has_keypress_event();
// sprite instance of add_interval_handler()
@@ -87,12 +92,6 @@
/// Interval timer timeout executor
virtual void do_something(void *timer);
-#if 0
- movie_interface* get_root_interface() {
- return m_root;
- }
-#endif
-
movie_root* get_root() {
return m_root;
}
@@ -145,6 +144,11 @@
return m_def->get_bytes_loaded();
}
+ const rect& get_frame_size() const
+ {
+ return m_def->get_frame_size();
+ }
+
/// Stop or play the sprite.
void set_play_state(play_state s)
{
@@ -197,7 +201,7 @@
/// Return the topmost entity that the given point
/// covers that can receive mouse events. NULL if
/// none. Coords are in parent's frame.
- virtual movie* get_topmost_mouse_entity(float x, float y);
+ virtual character* get_topmost_mouse_entity(float x, float y);
virtual void advance(float delta_time);
//virtual void advance_root(float delta_time);
@@ -340,6 +344,8 @@
/// Return -1 if nobody's home.
int get_id_at_depth(int depth);
+ sprite_instance* to_movie () { return this; }
+
//
// ActionScript support
@@ -461,13 +467,10 @@
as_value obj =
m_as_environment.get_variable(std::string(path_to_object));
as_object* as_obj = obj.to_object();
- if (as_obj)
- {
- movie* m = as_obj->to_movie();
- if (m)
+ character* ch = dynamic_cast<character*>(as_obj);
+ if (ch)
{
- m->set_display_callback(callback, user_ptr);
- }
+ ch->set_display_callback(callback, user_ptr);
}
}
@@ -520,11 +523,6 @@
mouse_state m_mouse_state;
- /// \brief
- /// This is either sprite_definition (for sprites defined by
- /// DefineSprite tag) or movie_def_impl (for the top-level movie).
- boost::intrusive_ptr<movie_definition> m_def;
-
movie_root* m_root;
DisplayList m_display_list;
@@ -596,6 +594,11 @@
protected:
+ /// \brief
+ /// This is either sprite_definition (for sprites defined by
+ /// DefineSprite tag) or movie_def_impl (for the top-level movie).
+ boost::intrusive_ptr<movie_definition> m_def;
+
bool m_on_event_load_called;
};
Index: server/timers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/timers.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/timers.cpp 3 Nov 2006 14:03:37 -0000 1.17
+++ server/timers.cpp 21 Nov 2006 00:25:46 -0000 1.18
@@ -18,7 +18,7 @@
//
//
-/* $Id: timers.cpp,v 1.17 2006/11/03 14:03:37 strk Exp $ */
+/* $Id: timers.cpp,v 1.18 2006/11/21 00:25:46 strk Exp $ */
//#include "action.h"
#include "as_function.h" // for class as_function
@@ -156,7 +156,7 @@
//timer_as_object* ptr = (timer_as_object*) (as_object*) this_ptr;
assert(ptr);
- movie* mov = fn.env->get_target()->get_root_movie();
+ sprite_instance* mov = fn.env->get_target()->get_root_movie();
as_function *as_func =
fn.env->bottom(fn.first_arg_bottom_index).to_as_function();
as_value val(as_func);
int ms =
static_cast<int>(fn.env->bottom(fn.first_arg_bottom_index-1).to_number());
@@ -220,7 +220,7 @@
double id = fn.env->bottom(fn.first_arg_bottom_index).to_number();
- movie* mov = fn.env->get_target()->get_root_movie();
+ sprite_instance* mov = fn.env->get_target()->get_root_movie();
mov->clear_interval_timer((int)id);
fn.result->set_bool(true);
}
Index: server/xmlsocket.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/xmlsocket.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- server/xmlsocket.cpp 29 Oct 2006 18:34:11 -0000 1.27
+++ server/xmlsocket.cpp 21 Nov 2006 00:25:46 -0000 1.28
@@ -533,7 +533,7 @@
}
#if 1
- movie* mov = fn.env->get_target()->get_root_movie();
+ sprite_instance* mov = fn.env->get_target()->get_root_movie();
Timer *timer = new Timer;
as_c_function_ptr ondata_handler =
(as_c_function_ptr)&xmlsocket_event_ondata;
Index: server/asobj/MovieClipLoader.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/MovieClipLoader.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/asobj/MovieClipLoader.cpp 11 Nov 2006 22:44:54 -0000 1.10
+++ server/asobj/MovieClipLoader.cpp 21 Nov 2006 00:25:46 -0000 1.11
@@ -198,7 +198,7 @@
return false;
}
- gnash::movie_interface* extern_movie;
+ gnash::sprite_instance* extern_movie;
extern_movie = md->create_instance();
if (extern_movie == NULL)
{
@@ -237,7 +237,9 @@
assert(parent);
new_movie->set_parent(parent);
- parent->replace_display_object(
+ sprite_instance* parent_sp = dynamic_cast<sprite_instance*>(parent);
+ assert(parent_sp);
+ parent_sp->replace_display_object(
new_movie,
name,
depth,
Index: server/parser/movie_def_impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- server/parser/movie_def_impl.cpp 20 Nov 2006 15:07:39 -0000 1.43
+++ server/parser/movie_def_impl.cpp 21 Nov 2006 00:25:47 -0000 1.44
@@ -20,7 +20,7 @@
#include "movie_def_impl.h"
#include "movie_definition.h" // for inheritance
-#include "movie_instance.h" // for create_instance()
+#include "sprite_instance.h" // for create_instance()
#include "tu_file.h"
#include "zlib_adapter.h"
#include "stream.h"
@@ -816,7 +816,7 @@
}
}
-movie_interface*
+sprite_instance*
movie_def_impl::create_instance()
{
Index: server/parser/movie_def_impl.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- server/parser/movie_def_impl.h 17 Nov 2006 15:17:38 -0000 1.20
+++ server/parser/movie_def_impl.h 21 Nov 2006 00:25:47 -0000 1.21
@@ -185,7 +185,7 @@
//
/// It cannot be played directly, and does not hold
/// current state; for that you need to call create_instance()
-/// to get a movie instance (gnash::movie_interface).
+/// to get a movie instance
///
class movie_def_impl : public movie_definition
{
@@ -524,7 +524,7 @@
/// movie will be executed by this function.
///
///
- movie_interface* create_instance();
+ sprite_instance* create_instance();
virtual const std::string& get_url() const { return _url; }
Index: server/parser/movie_definition.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_definition.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/parser/movie_definition.h 15 Nov 2006 10:29:00 -0000 1.8
+++ server/parser/movie_definition.h 21 Nov 2006 00:25:47 -0000 1.9
@@ -47,7 +47,6 @@
#include "character_def.h" // for inheritance
#include "container.h"
-//#include "button.h" // for mouse_button_state
#include "timers.h" // for Timer
#include "fontlib.h"
#include "font.h"
@@ -74,6 +73,7 @@
virtual float get_height_pixels() const = 0;
virtual size_t get_frame_count() const = 0;
virtual float get_frame_rate() const = 0;
+ virtual const rect& get_frame_size() const = 0;
virtual size_t get_bytes_loaded() const = 0;
virtual size_t get_bytes_total() const = 0;
@@ -84,7 +84,7 @@
/// Call drop_ref() on the movie_interface when you're done with it.
/// Or use boost::intrusive_ptr<T> from base/smart_ptr.h if you want.
///
- virtual movie_interface* create_instance() = 0;
+ virtual sprite_instance* 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;
Index: server/parser/sprite_definition.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/sprite_definition.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/parser/sprite_definition.h 15 Nov 2006 10:29:00 -0000 1.10
+++ server/parser/sprite_definition.h 21 Nov 2006 00:25:47 -0000 1.11
@@ -29,6 +29,7 @@
#include "movie_definition.h"
#include "stream.h"
#include "log.h"
+#include "rect.h"
namespace gnash
{
@@ -118,6 +119,13 @@
return m_movie_def ? m_movie_def->get_frame_rate() : 0.0;
}
+ const rect& get_frame_size() const
+ {
+ assert(0);
+ static const rect unused;
+ return unused;
+ }
+
// Return number of frames loaded (of current sprite)
virtual size_t get_loading_frame() const { return m_loading_frame; }
@@ -290,7 +298,7 @@
return;
}
- virtual movie_interface* create_instance()
+ virtual sprite_instance* create_instance()
{
return NULL;
}
Index: server/swf/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/ASHandlers.cpp,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -b -r1.97 -r1.98
--- server/swf/ASHandlers.cpp 18 Nov 2006 11:12:22 -0000 1.97
+++ server/swf/ASHandlers.cpp 21 Nov 2006 00:25:47 -0000 1.98
@@ -16,7 +16,7 @@
//
-/* $Id: ASHandlers.cpp,v 1.97 2006/11/18 11:12:22 tgc Exp $ */
+/* $Id: ASHandlers.cpp,v 1.98 2006/11/21 00:25:47 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -535,7 +535,10 @@
const action_buffer& code = thread.code;
assert( code[thread.pc] == SWF::ACTION_NEXTFRAME );
- env.get_target()->goto_frame(env.get_target()->get_current_frame() + 1);
+
+ sprite_instance* tgt = env.get_target()->to_movie();
+ assert(tgt);
+ tgt->goto_frame(tgt->get_current_frame() + 1);
}
void
@@ -547,7 +550,10 @@
const action_buffer& code = thread.code;
assert( code[thread.pc] == SWF::ACTION_PREVFRAME );
- env.get_target()->goto_frame(env.get_target()->get_current_frame() - 1);
+
+ sprite_instance* tgt = env.get_target()->to_movie();
+ assert(tgt);
+ tgt->goto_frame(tgt->get_current_frame() - 1);
}
void
@@ -559,7 +565,9 @@
const action_buffer& code = thread.code;
assert( code[thread.pc] == SWF::ACTION_PLAY );
- env.get_target()->set_play_state(movie::PLAY);
+ sprite_instance* tgt = env.get_target()->to_movie();
+ assert(tgt);
+ tgt->set_play_state(sprite_instance::PLAY);
}
void
@@ -570,15 +578,20 @@
as_environment& env = thread.env;
const action_buffer& code = thread.code;
+ assert( code[thread.pc] == SWF::ACTION_STOP );
+
sound_handler* s = get_sound_handler();
- int stream_id = env.get_target()->get_sound_stream_id();
+
+ sprite_instance* tgt = env.get_target()->to_movie();
+ assert(tgt);
+ int stream_id = tgt->get_sound_stream_id();
+
if (s != NULL && stream_id != -1)
{
s->stop_sound(stream_id);
}
- assert( code[thread.pc] == SWF::ACTION_STOP );
- env.get_target()->set_play_state(movie::STOP);
+ tgt->set_play_state(sprite_instance::STOP);
}
void
@@ -622,10 +635,13 @@
size_t frame = code.read_int16(thread.pc+3);
+ sprite_instance* tgt = env.get_target()->to_movie();
+ assert(tgt);
+
// 0-based already?
//// Convert from 1-based to 0-based
//frame--;
- env.get_target()->goto_frame(frame);
+ tgt->goto_frame(frame);
}
void
@@ -683,7 +699,7 @@
uint8 skip = code[thread.pc+5];
character* target = env.get_target();
- sprite_instance* target_sprite = dynamic_cast<sprite_instance*>(target);
+ sprite_instance* target_sprite = target->to_movie();
if ( ! target_sprite )
{
log_error("environment target is not a sprite_instance while
executing ActionWaitForFrame");
@@ -754,14 +770,14 @@
const char* frame_label = code.read_string(thread.pc+3);
character *target = env.get_target();
- sprite_instance *target_sprite = dynamic_cast<sprite_instance*>(target);
+ sprite_instance *target_sprite = target->to_movie();
if ( ! target_sprite )
{
log_error("environment target is not a sprite_instance while
executing ActionGotoLabel");
}
else
{
- target->goto_labeled_frame(frame_label);
+ target_sprite->goto_labeled_frame(frame_label);
}
}
@@ -1166,7 +1182,7 @@
ensure_stack(env, 3);
- sprite_instance* si = dynamic_cast<sprite_instance*>(env.get_target());
+ sprite_instance* si = env.get_target()->to_movie();
if ( ! si )
{
log_error("environment target is not a sprite_instance while
executing ActionDuplicateClip");
@@ -1189,8 +1205,11 @@
ensure_stack(env, 1);
+ sprite_instance* tgt = env.get_target()->to_movie();
+ assert(tgt);
+
// strk: why not using pop() ?
- env.get_target()->remove_display_object(env.top(0).to_tu_string());
+ tgt->remove_display_object(env.top(0).to_tu_string());
env.drop(1);
}
@@ -1216,7 +1235,7 @@
ensure_stack(env, 3);
- movie::drag_state st;
+ sprite_instance::drag_state st;
st.m_character = env.find_target(env.top(0));
if (st.m_character == NULL) {
@@ -1375,7 +1394,10 @@
{
// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
- env.push(floorf(env.get_target()->get_timer() * 1000.0f));
+
+ sprite_instance* tgt = env.get_target()->to_movie();
+ assert(tgt);
+ env.push(floorf(tgt->get_timer() * 1000.0f));
}
void
@@ -1420,7 +1442,7 @@
as_value& framespec = env.top(0);
character* target = env.get_target();
- sprite_instance* target_sprite = dynamic_cast<sprite_instance*>(target);
+ sprite_instance* target_sprite = target->to_movie();
if ( ! target_sprite )
{
log_error("environment target is not a sprite_instance "
@@ -1682,7 +1704,7 @@
if (s_fscommand_handler)
{
// Call into the app.
-
(*s_fscommand_handler)(env.get_target()->get_root_interface(), url_c + 10,
target_string);
+
(*s_fscommand_handler)(env.get_target()->get_root_movie(), url_c + 10,
target_string);
}
return;
@@ -1714,14 +1736,7 @@
string url_s(url_c);
-#if 0 // changed to resolve relative to the base url
- sprite_instance* tgt_sprt = \
- dynamic_cast<sprite_instance*>(env.get_target());
- assert(tgt_sprt);
- URL baseurl(tgt_sprt->get_movie_definition()->get_url());
-#else
const URL& baseurl = get_base_url();
-#endif
URL url(url_s, baseurl);
log_msg("get url: target=%s, url=%s (%s)", target_string,
@@ -1738,14 +1753,22 @@
{
log_msg("getURL2 target load");
- character* target_movie = env.find_target(target);
- if (target_movie == NULL)
+ character* target_ch = env.find_target(target);
+ if ( ! target_ch )
{
log_error("get url: target %s not found",
target_string);
return;
}
+ sprite_instance* target_movie = target_ch->to_movie();
+ if ( ! target_movie )
+ {
+ log_error("get url: target %s is not a sprite",
+ target_string);
+ return;
+ }
+
sprite_instance* root_movie =
env.get_target()->get_root_movie();
attach_extern_movie(url.str().c_str(), target_movie,
root_movie);
}
@@ -1834,8 +1857,9 @@
ensure_stack(env, 1); // frame spec
// Note: no extra data in this instruction!
- assert(env.get_target());
- env.get_target()->call_frame_actions(env.top(0));
+ sprite_instance* tgt = env.get_target()->to_movie();
+ assert(tgt);
+ tgt->call_frame_actions(env.top(0));
env.drop(1);
}
@@ -1866,9 +1890,9 @@
// frame is shown in stop mode.
unsigned char play_flag = code[pc + 3];
- movie::play_state state = play_flag ? movie::PLAY : movie::STOP;
+ sprite_instance::play_state state = play_flag ? sprite_instance::PLAY :
sprite_instance::STOP;
- sprite_instance* target =
dynamic_cast<sprite_instance*>(env.get_target());
+ sprite_instance* target = env.get_target()->to_movie();
if ( ! target )
{
log_error("environment target is not a sprite_instance while
executing ActionGotoExpression");
Index: server/swf/tag_loaders.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/tag_loaders.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- server/swf/tag_loaders.cpp 17 Nov 2006 15:17:38 -0000 1.59
+++ server/swf/tag_loaders.cpp 21 Nov 2006 00:25:47 -0000 1.60
@@ -18,7 +18,7 @@
//
//
-/* $Id: tag_loaders.cpp,v 1.59 2006/11/17 15:17:38 strk Exp $ */
+/* $Id: tag_loaders.cpp,v 1.60 2006/11/21 00:25:47 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -43,6 +43,7 @@
#include "image.h"
#include "zlib_adapter.h"
#include "sprite_definition.h"
+#include "sprite_instance.h"
#include "swf_function.h"
#include "swf_event.h"
#include "as_function.h"
@@ -87,7 +88,7 @@
m_buf.read(in);
}
- virtual void execute(movie* m)
+ virtual void execute(sprite_instance* m)
{
m->add_action_buffer(&m_buf);
}
@@ -160,14 +161,14 @@
rgba m_color;
public:
- void execute(movie* m)
+ void execute(sprite_instance* m)
{
float current_alpha = m->get_background_alpha();
m_color.m_a = frnd(current_alpha * 255.0f);
m->set_background_color(m_color);
}
- void execute_state(movie* m)
+ void execute_state(sprite_instance* m)
{
execute(m);
}
@@ -1034,7 +1035,7 @@
}
- void execute(movie* m)
+ void execute(sprite_instance* m)
// Place/move/whatever our object in the given movie.
{
switch (m_place_type) {
@@ -1077,12 +1078,12 @@
}
}
- void execute_state(movie* m)
+ void execute_state(sprite_instance* m)
{
execute(m);
}
- void execute_state_reverse(movie* m, int frame)
+ void execute_state_reverse(sprite_instance* m, int frame)
{
switch (m_place_type) {
case PLACE:
@@ -1220,17 +1221,17 @@
m_depth = in->read_u16();
}
- virtual void execute(movie* m)
+ virtual void execute(sprite_instance* m)
{
m->remove_display_object(m_depth, m_id);
}
- virtual void execute_state(movie* m)
+ virtual void execute_state(sprite_instance* m)
{
execute(m);
}
- virtual void execute_state_reverse(movie* m, int frame)
+ virtual void execute_state_reverse(sprite_instance* m, int frame)
{
// reverse of remove is to re-add the previous object.
execute_tag* last_add =
m->find_previous_replace_or_add_tag(frame, m_depth, m_id);
Index: testsuite/MovieTester.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/MovieTester.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- testsuite/MovieTester.cpp 3 Nov 2006 14:03:37 -0000 1.8
+++ testsuite/MovieTester.cpp 21 Nov 2006 00:25:47 -0000 1.9
@@ -23,7 +23,6 @@
#include "noseek_fd_adapter.h"
#include "movie_definition.h"
#include "movie_instance.h"
-#include "movie_interface.h"
#include "movie_root.h"
#include "sprite_instance.h"
#include "as_environment.h"
@@ -59,7 +58,7 @@
// Make sure to load the whole movie
_movie_def->ensure_frame_loaded(_movie_def->get_frame_count());
- movie_interface* root = _movie_def->create_instance();
+ sprite_instance* root = _movie_def->create_instance();
assert(root);
_movie_root = dynamic_cast<movie_root*>(root);
assert(_movie_root);
Index: testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp
===================================================================
RCS file:
/sources/gnash/gnash/testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp 14 Nov
2006 09:38:57 -0000 1.6
+++ testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp 21 Nov
2006 00:25:47 -0000 1.7
@@ -46,7 +46,7 @@
assert(root);
check_equals(root->get_frame_count(), 3);
- check_equals(root->get_play_state(), movie_interface::PLAY);
+ check_equals(root->get_play_state(), sprite_instance::PLAY);
check_equals(root->get_current_frame(), 0);
const character* mc1 = tester.findDisplayItemByName(*root, "mc1");
@@ -58,18 +58,18 @@
tester.advance();
- check_equals(root->get_play_state(), movie_interface::PLAY);
+ check_equals(root->get_play_state(), sprite_instance::PLAY);
check_equals(root->get_current_frame(), 0);
tester.advance();
- check_equals(root->get_play_state(), movie_interface::PLAY);
+ check_equals(root->get_play_state(), sprite_instance::PLAY);
check_equals(root->get_current_frame(), 1);
tester.advance();
// does stop() on last frame
- check_equals(root->get_play_state(), movie_interface::STOP);
+ check_equals(root->get_play_state(), sprite_instance::STOP);
check_equals(root->get_current_frame(), 2);
}
Index: testsuite/misc-ming.all/RollOverOutTest-Runner.cpp
===================================================================
RCS file:
/sources/gnash/gnash/testsuite/misc-ming.all/RollOverOutTest-Runner.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- testsuite/misc-ming.all/RollOverOutTest-Runner.cpp 11 Nov 2006 14:36:33
-0000 1.3
+++ testsuite/misc-ming.all/RollOverOutTest-Runner.cpp 21 Nov 2006 00:25:47
-0000 1.4
@@ -50,7 +50,7 @@
assert(root);
check_equals(root->get_frame_count(), 3);
- check_equals(root->get_play_state(), movie_interface::PLAY);
+ check_equals(root->get_play_state(), sprite_instance::PLAY);
check_equals(root->get_current_frame(), 0);
const character* mc1 = tester.findDisplayItemByName(*root, "square1");
@@ -67,7 +67,7 @@
//check_equals(mc1->get_height(), 40*20);
//check_equals(mc1->get_width(), 40*20);
- check_equals(root->get_play_state(), movie_interface::STOP);
+ check_equals(root->get_play_state(), sprite_instance::STOP);
check_equals(root->get_current_frame(), 1);
// we're in stop mode, so advance should not advance anything
@@ -84,7 +84,7 @@
tester.movePointerTo(60, 60);
tester.advance();
check_equals(root->get_current_frame(), 2);
- check_equals(root->get_play_state(), movie_interface::STOP);
+ check_equals(root->get_play_state(), sprite_instance::STOP);
tester.advance();
check_equals(root->get_current_frame(), 2);
Index: utilities/processor.cpp
===================================================================
RCS file: /sources/gnash/gnash/utilities/processor.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- utilities/processor.cpp 11 Nov 2006 15:25:27 -0000 1.37
+++ utilities/processor.cpp 21 Nov 2006 00:25:47 -0000 1.38
@@ -17,7 +17,7 @@
//
//
-/* $Id: processor.cpp,v 1.37 2006/11/11 15:25:27 strk Exp $ */
+/* $Id: processor.cpp,v 1.38 2006/11/21 00:25:47 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -26,9 +26,8 @@
#include "tu_file.h"
#include "container.h"
#include "gnash.h"
-//#include "Movie.h"
#include "movie_definition.h"
-#include "movie_interface.h"
+#include "sprite_instance.h"
#include "log.h"
#include "rc.h"
#include "URL.h"
@@ -253,7 +252,7 @@
fprintf(stderr, "error: can't play movie '%s'\n", filename);
exit(1);
}
- gnash::movie_interface* m = md->create_instance();
+ gnash::sprite_instance* m = md->create_instance();
if (m == NULL) {
fprintf(stderr, "error: can't create instance of movie '%s'\n",
filename);
exit(1);
@@ -282,11 +281,11 @@
break;
}
- if (m->get_play_state() == gnash::movie_interface::STOP) {
+ if (m->get_play_state() == gnash::sprite_instance::STOP) {
// Kick the movie.
printf("kicking movie, kick ct = %d\n", kick_count);
m->goto_frame(last_frame + 1);
- m->set_play_state(gnash::movie_interface::PLAY);
+ m->set_play_state(gnash::sprite_instance::PLAY);
kick_count++;
if (kick_count > 10) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog gui/Player.cpp gui/Player.h gui...,
Sandro Santilli <=