[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11054: revert changes to Stage_as.*
From: |
rob |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11054: revert changes to Stage_as.*, build the old version till the new one is fixed so less test cases hang. |
Date: |
Tue, 09 Jun 2009 15:07:10 -0600 |
User-agent: |
Bazaar (1.13.1) |
------------------------------------------------------------
revno: 11054
committer: address@hidden
branch nick: trunk
timestamp: Tue 2009-06-09 15:07:10 -0600
message:
revert changes to Stage_as.*, build the old version till the new one is fixed
so less test cases hang.
added:
libcore/asobj/Stage_as.cpp
libcore/asobj/Stage_as.h
modified:
libcore/asobj/flash.am
libcore/asobj/flash/display/display.am
testsuite/actionscript.all/Makefile.am
=== added file 'libcore/asobj/Stage_as.cpp'
--- a/libcore/asobj/Stage_as.cpp 1970-01-01 00:00:00 +0000
+++ b/libcore/asobj/Stage_as.cpp 2009-06-09 21:07:10 +0000
@@ -0,0 +1,301 @@
+// Stage_as.cpp: All the world is one, for Gnash.
+//
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include "Stage_as.h"
+#include "movie_root.h"
+#include "as_object.h" // for inheritance
+#include "log.h"
+#include "fn_call.h"
+#include "smart_ptr.h" // for boost intrusive_ptr
+#include "builtin_function.h" // need builtin_function
+#include "VM.h"
+#include "Object.h" // for getObjectInterface()
+#include "AsBroadcaster.h" // for initializing self as a broadcaster
+#include "namedStrings.h"
+#include "StringPredicates.h"
+
+#include <string>
+
+namespace gnash {
+
+static as_value stage_scalemode_getset(const fn_call& fn);
+static as_value stage_align_getset(const fn_call& fn);
+static as_value stage_showMenu_getset(const fn_call& fn);
+static as_value stage_width_getset(const fn_call& fn);
+static as_value stage_height_getset(const fn_call& fn);
+static as_value stage_displaystate_getset(const fn_call& fn);
+static const char* getScaleModeString(movie_root::ScaleMode sm);
+static const char* getDisplayStateString(movie_root::DisplayState ds);
+
+void registerStageNative(as_object& o)
+{
+ VM& vm = o.getVM();
+
+ vm.registerNative(stage_scalemode_getset, 666, 1);
+ vm.registerNative(stage_scalemode_getset, 666, 2);
+ vm.registerNative(stage_align_getset, 666, 3);
+ vm.registerNative(stage_align_getset, 666, 4);
+ vm.registerNative(stage_width_getset, 666, 5);
+ vm.registerNative(stage_width_getset, 666, 6);
+ vm.registerNative(stage_height_getset, 666, 7);
+ vm.registerNative(stage_height_getset, 666, 8);
+ vm.registerNative(stage_showMenu_getset, 666, 9);
+ vm.registerNative(stage_showMenu_getset, 666, 10);
+}
+
+static void
+attachStageInterface(as_object& o)
+{
+ const int version = o.getVM().getSWFVersion();
+
+ if ( version < 5 ) return;
+
+ o.init_property("scaleMode", &stage_scalemode_getset,
&stage_scalemode_getset);
+ o.init_property("align", &stage_align_getset, &stage_align_getset);
+ o.init_property("width", &stage_width_getset, &stage_width_getset);
+ o.init_property("height", &stage_height_getset, &stage_height_getset);
+ o.init_property("showMenu", &stage_showMenu_getset,
&stage_showMenu_getset);
+ o.init_property("displayState", &stage_displaystate_getset,
&stage_displaystate_getset);
+
+}
+
+
+Stage_as::Stage_as()
+ :
+ as_object(getObjectInterface())
+{
+ attachStageInterface(*this);
+
+ const int swfversion = _vm.getSWFVersion();
+ if ( swfversion > 5 )
+ {
+ AsBroadcaster::initialize(*this);
+ }
+}
+
+
+void
+Stage_as::notifyFullScreen(bool fs)
+{
+ // Should we notify resize here, or does movie_root do it anyway
+ // when the gui changes size?
+ log_debug("notifying Stage listeners about fullscreen state");
+ callMethod(NSV::PROP_BROADCAST_MESSAGE, "onFullScreen", fs);
+}
+
+
+void
+Stage_as::notifyResize()
+{
+ log_debug("notifying Stage listeners about a resize");
+ callMethod(NSV::PROP_BROADCAST_MESSAGE, "onResize");
+}
+
+
+const char*
+getDisplayStateString(movie_root::DisplayState ds)
+{
+ static const char* displayStateName[] = {
+ "normal",
+ "fullScreen" };
+
+ return displayStateName[ds];
+}
+
+
+const char*
+getScaleModeString(movie_root::ScaleMode sm)
+{
+ static const char* modeName[] = {
+ "showAll",
+ "noScale",
+ "exactFit",
+ "noBorder" };
+
+ return modeName[sm];
+}
+
+
+as_value
+stage_scalemode_getset(const fn_call& fn)
+{
+
+ boost::intrusive_ptr<as_object> obj=ensureType<as_object>(fn.this_ptr);
+
+ movie_root& m = obj->getVM().getRoot();
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ return as_value(getScaleModeString(m.getStageScaleMode()));
+ }
+ else // setter
+ {
+ // Defaults to showAll if the string is invalid.
+ movie_root::ScaleMode mode = movie_root::showAll;
+
+ const std::string& str = fn.arg(0).to_string();
+
+ StringNoCaseEqual noCaseCompare;
+
+ if ( noCaseCompare(str, "noScale") ) mode = movie_root::noScale;
+ else if ( noCaseCompare(str, "exactFit") ) mode =
movie_root::exactFit;
+ else if ( noCaseCompare(str, "noBorder") ) mode =
movie_root::noBorder;
+
+ if ( m.getStageScaleMode() == mode ) return as_value(); // nothing to
do
+
+ m.setStageScaleMode(mode);
+ return as_value();
+ }
+}
+
+as_value
+stage_width_getset(const fn_call& fn)
+{
+ boost::intrusive_ptr<as_object> obj=ensureType<as_object>(fn.this_ptr);
+
+ if ( fn.nargs > 0 ) // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Stage.width is a read-only property!"));
+ );
+ return as_value();
+ }
+
+ // getter
+ movie_root& m = obj->getVM().getRoot();
+ return as_value(m.getStageWidth());
+}
+
+as_value
+stage_height_getset(const fn_call& fn)
+{
+ boost::intrusive_ptr<as_object> obj=ensureType<as_object>(fn.this_ptr);
+
+ if ( fn.nargs > 0 ) // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Stage.height is a read-only property!"));
+ );
+ return as_value();
+ }
+
+ // getter
+ movie_root& m = obj->getVM().getRoot();
+ return as_value(m.getStageHeight());
+}
+
+
+as_value
+stage_align_getset(const fn_call& fn)
+{
+ boost::intrusive_ptr<as_object> obj=ensureType<as_object>(fn.this_ptr);
+
+ movie_root& m = obj->getVM().getRoot();
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ return as_value (m.getStageAlignMode());
+ }
+ else // setter
+ {
+ const std::string& str = fn.arg(0).to_string();
+ short am = 0;
+
+ // Easy enough to do bitwise - std::bitset is not
+ // really necessary!
+ if (str.find_first_of("lL") != std::string::npos)
+ {
+ am |= 1 << movie_root::STAGE_ALIGN_L;
+ }
+
+ if (str.find_first_of("tT") != std::string::npos)
+ {
+ am |= 1 << movie_root::STAGE_ALIGN_T;
+ }
+
+ if (str.find_first_of("rR") != std::string::npos)
+ {
+ am |= 1 << movie_root::STAGE_ALIGN_R;
+ }
+
+ if (str.find_first_of("bB") != std::string::npos)
+ {
+ am |= 1 << movie_root::STAGE_ALIGN_B;
+ }
+
+ m.setStageAlignment(am);
+
+ return as_value();
+ }
+}
+
+as_value
+stage_showMenu_getset(const fn_call& fn)
+{
+ boost::intrusive_ptr<Stage_as> stage =
ensureType<Stage_as>(fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ LOG_ONCE(log_unimpl("Stage.showMenu getter"));
+ return as_value();
+ }
+ else // setter
+ {
+ LOG_ONCE(log_unimpl("Stage.showMenu setter"));
+ return as_value();
+ }
+}
+
+as_value
+stage_displaystate_getset(const fn_call& fn)
+{
+ boost::intrusive_ptr<as_object> obj=ensureType<as_object>(fn.this_ptr);
+
+ movie_root& m = obj->getVM().getRoot();
+
+ if (!fn.nargs) {
+ return getDisplayStateString(m.getStageDisplayState());
+ }
+
+ StringNoCaseEqual noCaseCompare;
+
+ const std::string& str = fn.arg(0).to_string();
+ if (noCaseCompare(str, "normal")) {
+ m.setStageDisplayState(movie_root::DISPLAYSTATE_NORMAL);
+ }
+ else if (noCaseCompare(str, "fullScreen")) {
+ m.setStageDisplayState(movie_root::DISPLAYSTATE_FULLSCREEN);
+ }
+
+ // If invalid, do nothing.
+ return as_value();
+}
+
+// extern (used by Global.cpp)
+void stage_class_init(as_object& global)
+{
+ static boost::intrusive_ptr<as_object> obj = new Stage_as();
+ global.init_member("Stage", obj.get());
+}
+
+} // end of gnash namespace
=== added file 'libcore/asobj/Stage_as.h'
--- a/libcore/asobj/Stage_as.h 1970-01-01 00:00:00 +0000
+++ b/libcore/asobj/Stage_as.h 2009-06-09 21:07:10 +0000
@@ -0,0 +1,69 @@
+//
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef GNASH_ASOBJ_STAGE_H
+#define GNASH_ASOBJ_STAGE_H
+
+#include "as_object.h" // for inheritance
+#include "movie_root.h" // for access to scaleMode
+
+#include <list>
+
+namespace gnash {
+
+/// This is the Stage ActionScript object.
+//
+/// Some Stage methods are implemented in movie_root, because
+/// it provides the interface to the Gui and/or all the values
+/// required are necessarily in movie_root:
+///
+/// - scaleMode
+/// - width
+/// - height
+/// - displayState
+/// - alignMode
+//
+/// Most functions are ASnative, which means they cannot rely on
+/// the existence of a load-on-demand Stage object. Only resize events
+/// appear to need this (not ASnative). The ASnative functions
+/// are available from SWF5
+
+class Stage_as: public as_object
+{
+
+public:
+
+ Stage_as();
+
+ /// Notify all listeners about a resize event
+ void notifyResize();
+
+ void notifyFullScreen(bool fs);
+
+};
+
+/// Register native functions with the VM.
+void registerStageNative(as_object& o);
+
+/// Initialize the global Stage class
+void stage_class_init(as_object& global);
+
+} // end of gnash namespace
+
+#endif
+
=== modified file 'libcore/asobj/flash.am'
--- a/libcore/asobj/flash.am 2009-06-09 19:00:20 +0000
+++ b/libcore/asobj/flash.am 2009-06-09 21:07:10 +0000
@@ -38,7 +38,6 @@
asobj/Global.cpp \
asobj/int_as.cpp \
asobj/LoadVars_as.cpp \
- asobj/LocalConnection_as.cpp\
asobj/Math_as.cpp \
asobj/Microphone.cpp \
asobj/NetConnection_as.cpp \
@@ -47,10 +46,10 @@
asobj/PlayHead.cpp \
asobj/Selection_as.cpp \
asobj/Namespace_as.cpp \
- asobj/System_as.cpp \
asobj/TextFormat_as.cpp \
asobj/MovieClipLoader.cpp\
asobj/String_as.cpp \
+ asobj/Stage_as.cpp \
asobj/XMLSocket_as.cpp \
asobj/LoadableObject.cpp \
asobj/Object.cpp
@@ -68,7 +67,6 @@
asobj/Global.h\
asobj/int_as.h \
asobj/LoadVars_as.h \
- asobj/LocalConnection_as.h\
asobj/Microphone.h \
asobj/MovieClipLoader.h \
asobj/NetConnection_as.h \
@@ -76,7 +74,7 @@
asobj/Number_as.h \
asobj/PlayHead.h \
asobj/Selection_as.h \
- asobj/System_as.h \
+ asobj/Stage_as.h \
asobj/TextFormat_as.h \
asobj/String_as.h \
asobj/XMLSocket_as.h \
=== modified file 'libcore/asobj/flash/display/display.am'
--- a/libcore/asobj/flash/display/display.am 2009-06-08 21:22:11 +0000
+++ b/libcore/asobj/flash/display/display.am 2009-06-09 21:07:10 +0000
@@ -185,8 +185,8 @@
# FIXME: already exists
if BUILD_STAGE_AS3
-DISPLAY_SOURCES += asobj/flash/display/Stage_as.cpp
-DISPLAY_HEADERS += asobj/flash/display/Stage_as.h
+# DISPLAY_SOURCES += asobj/flash/display/Stage_as.cpp
+# DISPLAY_HEADERS += asobj/flash/display/Stage_as.h
endif
libgnashasobjs_la_SOURCES += $(DISPLAY_SOURCES) $(DISPLAY_SOURCES_AS2)
=== modified file 'testsuite/actionscript.all/Makefile.am'
--- a/testsuite/actionscript.all/Makefile.am 2009-05-26 07:01:03 +0000
+++ b/testsuite/actionscript.all/Makefile.am 2009-06-09 21:07:10 +0000
@@ -52,7 +52,7 @@
TEST_CASES = \
$(base_RUNNERS)
-dist_noinst_SCRIPTS = gen-test.sh gen-index.sh
+dist_noinst_SCRIPTS = gen-test.sh
AM_CPPFLAGS = \
-I$(top_srcdir)/libbase \
@@ -214,7 +214,6 @@
$(MAKE) $(ASTESTS_V8_OUT) alltests-v8.swf
DEF_MAKESWF_FLAGS="-DMING_VERSION_CODE=$(MING_VERSION_CODE)
-DMEDIADIR='\\\"../media\\\"'" DEJAGNU_SO_URL=../Dejagnu.swf
mkdir -p online-tests/v8
mv $(ASTESTS_V8_OUT) alltests-v8.swf online-tests/v8
- sh $(srcdir)/gen-index.sh alltests-v8.swf $(ASTESTS_V8_OUT)
mv index.html embed.html online-tests/v8
v7-online-tests:
@@ -222,7 +221,6 @@
$(MAKE) $(ASTESTS_V7_OUT) alltests-v7.swf
DEF_MAKESWF_FLAGS="-DMING_VERSION_CODE=$(MING_VERSION_CODE)
-DMEDIADIR='\\\"../media\\\"'" DEJAGNU_SO_URL=../Dejagnu.swf
mkdir -p online-tests/v7
mv $(ASTESTS_V7_OUT) alltests-v7.swf online-tests/v7
- sh $(srcdir)/gen-index.sh alltests-v7.swf $(ASTESTS_V7_OUT)
mv index.html embed.html online-tests/v7
v6-online-tests:
@@ -230,7 +228,6 @@
$(MAKE) $(ASTESTS_V6_OUT) alltests-v6.swf
DEF_MAKESWF_FLAGS="-DMING_VERSION_CODE=$(MING_VERSION_CODE)
-DMEDIADIR='\\\"../media\\\"'" DEJAGNU_SO_URL=../Dejagnu.swf
mkdir -p online-tests/v6
mv $(ASTESTS_V6_OUT) alltests-v6.swf online-tests/v6
- sh $(srcdir)/gen-index.sh alltests-v6.swf $(ASTESTS_V6_OUT)
mv index.html embed.html online-tests/v6
v5-online-tests:
@@ -238,7 +235,6 @@
$(MAKE) $(ASTESTS_V5_OUT) alltests-v5.swf
DEF_MAKESWF_FLAGS="-DMING_VERSION_CODE=$(MING_VERSION_CODE)
-DMEDIADIR='\\\"../media\\\"'" DEJAGNU_SO_URL=../Dejagnu.swf
mkdir -p online-tests/v5
mv $(ASTESTS_V5_OUT) alltests-v5.swf online-tests/v5
- sh $(srcdir)/gen-index.sh alltests-v5.swf $(ASTESTS_V5_OUT)
mv index.html embed.html online-tests/v5
index.wiki: gen-index-wiki.sh
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11054: revert changes to Stage_as.*, build the old version till the new one is fixed so less test cases hang.,
rob <=