64 #ifndef GNASH_MOVIE_ROOT_H
65 #define GNASH_MOVIE_ROOT_H
77 #include <boost/array.hpp>
78 #include <boost/ptr_container/ptr_deque.hpp>
79 #include <boost/noncopyable.hpp>
80 #include <boost/any.hpp>
81 #include <boost/optional.hpp>
106 #ifndef GNASH_PARANOIA_LEVEL
107 # define GNASH_PARANOIA_LEVEL 1
112 class ExecutableCode;
129 bool operator()(
const LevelMovie& d1,
const LevelMovie& d2)
const {
162 void setReachable()
const;
164 boost::shared_ptr<IOChannel> _stream;
170 typedef std::bitset<key::KEYCOUNT>
Keys;
197 MovieClip* getLevel(
unsigned int num)
const;
205 void setLevel(
unsigned int num,
Movie* movie);
216 void replaceLevel(
unsigned int num,
Movie* external_movie);
232 void swapLevels(
MovieClip* sp,
int depth);
243 void dropLevel(
int depth);
252 void setDimensions(
size_t w,
size_t h);
255 size_t getStageWidth()
const;
258 size_t getStageHeight()
const;
270 DSOEXPORT bool mouseMoved(boost::int32_t
x, boost::int32_t
y);
296 std::pair<boost::int32_t, boost::int32_t> mousePosition()
const;
322 boost::uint32_t addIntervalTimer(std::auto_ptr<Timer> timer);
340 void addLoadableObject(
as_object* obj, std::auto_ptr<IOChannel> str);
349 bool clearIntervalTimer(boost::uint32_t
x);
351 void set_background_color(
const rgba&
color);
353 void set_background_alpha(
float alpha);
372 int timeToNextFrame()
const;
391 return ++_unnamedInstance;
395 void registerButton(
Button* listener);
398 void removeButton(
Button* listener);
441 bool testInvariant()
const;
446 DISPLAYSTATE_FULLSCREEN
494 void setStageAlignment(
short s);
498 void setAllowScriptAccess(AllowScriptAccessMode mode);
501 AllowScriptAccessMode getAllowScriptAccess();
503 typedef std::pair<StageHorizontalAlign, StageVerticalAlign>
StageAlign;
507 StageAlign getStageAlignment()
const;
511 bool getShowMenuState()
const;
515 void setShowMenuState(
bool state);
524 std::string getStageAlignMode()
const;
530 void setStageDisplayState(
const DisplayState ds);
549 typedef boost::array<boost::ptr_deque<ExecutableCode>, PRIORITY_SIZE>
553 void pushAction(std::auto_ptr<ExecutableCode>
code,
size_t lvl);
568 void markReachableResources()
const;
581 #if GNASH_PARANOIA_LEVEL > 1
582 assert(std::find(_liveChars.begin(), _liveChars.end(), ch) ==
585 _liveChars.push_front(ch);
602 void disableScripts();
615 void flushHigherPriorityActionQueues();
617 DisplayObject* findCharacterByTarget(
const std::string& tgtstr)
const;
640 _movieLoader.loadMovie(url, target, data, method, handler);
656 void getURL(
const std::string& urlstr,
const std::string& target,
661 return _lastKeyEvent;
665 return _unreleasedKeys;
717 _fsCommandHandler = handler;
721 DSOEXPORT void handleFsCommand(
const std::string& cmd,
722 const std::string& arg)
const;
731 _interfaceHandler = handler;
765 void setScriptLimits(boost::uint16_t recursion, boost::uint16_t timeout);
770 return _recursionLimit;
777 return _timeoutLimit;
781 typedef tree<std::pair<std::string, std::string> > InfoTree;
782 void getMovieInfo(InfoTree& tr, InfoTree::iterator it);
783 void getCharacterTree(InfoTree& tr, InfoTree::iterator it);
789 void addExternalCallback(
const std::string&
name,
as_object* callback);
793 std::string callExternalCallback(
const std::string &
name,
794 const std::vector<as_value>& args);
796 std::string callExternalJavascript(
const std::string &
name,
797 const std::vector<as_value>& args);
805 void removeQueuedConstructor(
MovieClip* target);
815 bool queryInterface(
const std::string& what)
const;
828 void setStreamBlock(
int id,
int block);
836 void stopStream(
int id);
863 void setRootMovie(
Movie* movie);
866 bool notify_mouse_listeners(
const event_id& event);
871 bool fire_mouse_event();
877 void executeAdvanceCallbacks();
880 void executeTimers();
883 void cleanupAndCollect();
901 boost::int32_t
y)
const;
905 void cleanupDisplayList();
908 void advanceLiveChars();
913 void setInvalidated() { _invalidated =
true; }
919 void clearInvalidated() { _invalidated =
false; }
929 bool isInvalidated() {
return _invalidated; }
935 size_t minPopulatedPriorityQueue()
const;
940 size_t processActionQueue(
size_t lvl);
942 bool processingActions()
const {
943 return (_processingActionLevel < PRIORITY_SIZE);
946 const DisplayObject* findDropTarget(boost::int32_t
x, boost::int32_t
y,
947 DisplayObject* dragging)
const;
949 void handleActionLimitHit(
const std::string& ref);
951 typedef std::list<Button*> ButtonListeners;
952 ButtonListeners _buttonListeners;
956 const RunResources& _runResources;
963 HostInterface* _interfaceHandler;
966 FsCallback* _fsCommandHandler;
974 typedef std::list<MovieClip*> LiveChars;
977 LiveChars _liveChars;
979 ActionQueue _actionQueue;
982 void processActionQueue();
988 rgba m_background_color;
989 bool m_background_color_set;
991 boost::int32_t _mouseX;
992 boost::int32_t _mouseY;
994 MouseButtonState _mouseButtonState;
997 typedef std::set<ActiveRelay*> ObjectCallbacks;
998 ObjectCallbacks _objectCallbacks;
1000 LoadCallbacks _loadCallbacks;
1002 typedef std::map<boost::uint32_t, boost::shared_ptr<Timer> > TimerMap;
1004 TimerMap _intervalTimers;
1006 size_t _lastTimerId;
1009 Keys _unreleasedKeys;
1014 DisplayObject* _currentFocus;
1017 boost::optional<DragState> _dragState;
1019 typedef std::map<int, MovieClip*> Levels;
1028 typedef std::map<const SWF::DefinitionTag*, as_function*> RegisteredClasses;
1029 RegisteredClasses _registeredClasses;
1041 bool _disableScripts;
1042 int _processingActionLevel;
1057 std::bitset<4u> _alignMode;
1059 AllowScriptAccessMode _allowScriptAccess;
1065 ScaleMode _scaleMode;
1068 DisplayState _displayState;
1071 boost::uint16_t _recursionLimit;
1074 boost::uint16_t _timeoutLimit;
1077 size_t _movieAdvancementDelay;
1080 size_t _lastMovieAdvancement;
1083 size_t _unnamedInstance;
1085 MovieLoader _movieLoader;
1087 struct SoundStream {
1088 SoundStream(
int i,
int b) : id(i), block(b) {}
1093 boost::optional<SoundStream> _timelineSound;
1105 bool isLevelTarget(
int version,
const std::string&
name,
unsigned int& levelno);
1109 template<
typename T>
1113 if (!_interfaceHandler) {
1114 log_error(
"Hosting application registered no callback for "
1115 "messages, can't call %s(%s)");
1120 return boost::any_cast<
T>(_interfaceHandler->
call(e));
1122 catch (
const boost::bad_any_cast&) {
1123 log_error(
_(
"Unexpected type from host interface when requesting "
1131 #endif // GNASH_MOVIE_ROOT_H
int getControlFD() const
Definition: movie_root.h:703
VariablesMethod
The various methods for sending data in requests.
Definition: MovieClip.h:418
Definition: movie_root.h:473
int getHostFD() const
Definition: movie_root.h:699
bool operator()(const LevelMovie &d1, const LevelMovie &d2) const
Definition: movie_root.h:129
Client program's interface to the definition of a movie or sprite.
Definition: movie_definition.h:95
bool scriptsDisabled() const
Return true if scripts execution is disabled.
Definition: movie_root.h:605
std::list< LoadCallback > LoadCallbacks
Definition: movie_root.h:168
A class used to virtualize time flow.
Definition: VirtualClock.h:33
A MovieClip is a container for DisplayObjects.
Definition: MovieClip.h:83
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:168
Definition: ExternalInterface.h:44
SWFStream & s
Definition: DefineBitsTag.cpp:73
void setControlFD(int fd)
Definition: movie_root.h:691
VM & getVM()
Return the VM used by this movie_root.
Definition: movie_root.h:356
What is being dragged and how.
Definition: DragState.h:35
AllowScriptAccessMode
The possibile values of AllowScriptAccess.
Definition: movie_root.h:480
VM & _vm
Definition: Array_as.cpp:857
Definition: movie_root.h:482
Definition: movie_root.h:481
Definition: GnashKey.h:163
Definition: GnashKey.h:157
Construct event handlers.
Definition: movie_root.h:537
A top-level, standalone Movie that can be loaded and played.
Definition: Movie.h:46
Abstract base class for FS handlers.
Definition: HostInterface.h:199
Definition: movie_root.h:475
boost::uint16_t getRecursionLimit() const
Definition: movie_root.h:769
const Keys & unreleasedKeys() const
Definition: movie_root.h:664
SimpleBuffer data
Definition: LocalConnection_as.cpp:153
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
boost::variant< HostMessage, CustomMessage > Message
Definition: HostInterface.h:213
Immutable data representing the definition of a movie display element.
Definition: DefinitionTag.h:48
AlignMode
The possible elements of a Stage.alignMode.
Definition: movie_root.h:472
Quality
Definition: GnashEnums.h:34
GC & gc()
Definition: movie_root.h:807
std::map< std::string, std::string > MovieVariables
Definition: MovieClip.h:93
Definition: movie_root.h:126
void addLiveChar(MovieClip *ch)
Register a newly born advanceable DisplayObject to the list of DisplayObjects to be advanced on next ...
Definition: movie_root.h:578
LoadCallback(boost::shared_ptr< IOChannel > s, as_object *o)
Definition: movie_root.h:156
short stringToStageAlign(const std::string &str)
Definition: movie_root.cpp:2363
key::code lastKeyEvent() const
Definition: movie_root.h:660
The base class for all ActionScript objects.
Definition: as_object.h:161
Definition: GnashKey.h:161
DSOEXPORT void registerEventCallback(HostInterface *handler)
Definition: movie_root.h:730
Frame actions, load handlers, unload handlers.
Definition: movie_root.h:539
Definition: movie_root.h:466
const VGfloat color[4]
Definition: testr_gtk.cpp:82
void loadMovie(const std::string &url, const std::string &target, const std::string &data, MovieClip::VariablesMethod method, as_object *handler=0)
Queue a request for loading a movie.
Definition: movie_root.h:636
code
Definition: GnashKey.h:43
Abstract class to allow the GC to store "roots" into a container.
Definition: GC.h:55
Definition: movie_root.h:460
Definition: movie_root.h:467
as_object & _obj
Definition: Array_as.cpp:135
#define _(String)
Definition: log.h:44
size_t nextUnnamedInstance()
Get a unique number for unnamed instances.
Definition: movie_root.h:390
agg::rendering_buffer _buf
Definition: Renderer_agg.cpp:647
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:43
bool isLevelTarget(int version, const std::string &name, unsigned int &levelno)
Return true if the given string can be interpreted as a _level name.
Definition: movie_root.cpp:2344
StageVerticalAlign
The possible vertical position of the Stage.
Definition: movie_root.h:465
ScaleMode getStageScaleMode() const
Returns the Stage object's align mode.
Definition: movie_root.h:521
DisplayState
The possible values of Stage.displayState.
Definition: movie_root.h:444
Definition: movie_root.h:474
boost::int32_t x
Definition: BitmapData_as.cpp:434
Definition: movie_root.h:154
const RunResources & runResources() const
Definition: movie_root.h:786
Definition: GnashKey.h:148
boost::array< boost::ptr_deque< ExecutableCode >, PRIORITY_SIZE > ActionQueue
A number of queues of code to execute.
Definition: movie_root.h:550
ActionPriorityLevel
Action priority levels.
Definition: movie_root.h:533
#define DSOEXPORT
Definition: dsodefs.h:55
boost::uint16_t getTimeoutLimit() const
Definition: movie_root.h:775
void setHostFD(int fd)
Definition: movie_root.h:684
virtual boost::any call(const Message &e)=0
Pass a message to the hosting application with an optional return.
Definition: movie_root.h:452
The base class for interactive objects.
Definition: InteractiveObject.h:44
Quality getQuality() const
Get the current display quality.
Definition: movie_root.h:490
The AVM1 virtual machine.
Definition: VM.h:71
Definition: movie_root.h:459
void stop_drag()
Definition: movie_root.h:307
Definition: GnashKey.h:132
ScaleMode
The possibile values of Stage.scaleMode.
Definition: movie_root.h:450
boost::int32_t y
Definition: BitmapData_as.cpp:435
Definition: GnashKey.h:154
Definition: movie_root.h:445
Definition: GnashKey.h:155
std::string url
Definition: gnash.cpp:59
Movie & getRootMovie()
Access the originating root movie (not necessarily _level0)
Definition: movie_root.h:303
Garbage collector singleton.
Definition: GC.h:164
Definition: GnashKey.h:151
Definition: movie_root.h:451
A simple buffer of bytes.
Definition: SimpleBuffer.h:38
Init actions, Init event handlers.
Definition: movie_root.h:535
Abstract base class for hosting app handler.
Definition: HostInterface.h:207
tuple w
Definition: test.py:8
void callInterface(const HostInterface::Message &e) const
Call the hosting application without expecting a reply.
Definition: movie_root.cpp:2473
A native type that requires periodic updates from the core (movie_root).
Definition: Relay.h:79
int get_depth() const
Definition: DisplayObject.h:268
A class to identify 'static' SWF events (system events).
Definition: event_id.h:52
const Quality _quality
Quality of renderering.
Definition: Renderer_agg.cpp:660
StageHorizontalAlign
The possible horizonal positions of the Stage.
Definition: movie_root.h:458
MovieClip * LevelMovie
Definition: movie_root.h:128
std::bitset< key::KEYCOUNT > Keys
Definition: movie_root.h:170
A code segment.
Definition: action_buffer.h:49
DisplayState getStageDisplayState() const
Returns the Stage object's align mode.
Definition: movie_root.h:527
std::pair< StageHorizontalAlign, StageVerticalAlign > StageAlign
Definition: movie_root.h:503
DSOEXPORT void registerFSCommandCallback(FsCallback *handler)
Definition: movie_root.h:716
std::string name
Definition: LocalConnection_as.cpp:151
Definition: movie_root.h:453
ActionScript Function, either builtin or SWF-defined.
Definition: as_function.h:62
This class represents the 'Stage' and top-level movie.
Definition: movie_root.h:150
A basic RGBA type.
Definition: RGBA.h:35