64 #ifndef GNASH_MOVIE_ROOT_H 65 #define GNASH_MOVIE_ROOT_H 74 #include <forward_list> 78 #include <boost/ptr_container/ptr_deque.hpp> 79 #include <boost/noncopyable.hpp> 80 #include <boost/any.hpp> 81 #include <boost/optional.hpp> 107 #ifndef GNASH_PARANOIA_LEVEL 108 # define GNASH_PARANOIA_LEVEL 1 113 class ExecutableCode;
129 bool operator()(
const LevelMovie& d1,
const LevelMovie& d2)
const {
158 _stream(
std::move(s)),
162 void setReachable()
const;
164 std::unique_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(std::int32_t
x, std::int32_t
y);
296 std::pair<std::int32_t, std::int32_t> mousePosition()
const;
322 std::uint32_t addIntervalTimer(std::unique_ptr<Timer> timer);
340 void addLoadableObject(
as_object* obj, std::unique_ptr<IOChannel> str);
349 bool clearIntervalTimer(std::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);
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;
549 typedef std::array<boost::ptr_deque<ExecutableCode>, PRIORITY_SIZE>
553 void pushAction(std::unique_ptr<ExecutableCode>
code,
size_t lvl);
570 void markReachableResources()
const;
583 #if GNASH_PARANOIA_LEVEL > 1 584 assert(std::find(_liveChars.begin(), _liveChars.end(), ch) ==
587 _liveChars.push_front(ch);
604 void disableScripts();
617 void flushHigherPriorityActionQueues();
619 DisplayObject* findCharacterByTarget(
const std::string& tgtstr)
const;
642 _movieLoader.loadMovie(url, target, data, method, handler);
658 void getURL(
const std::string& urlstr,
const std::string& target,
663 return _lastKeyEvent;
667 return _unreleasedKeys;
719 _fsCommandHandler = handler;
723 DSOEXPORT void handleFsCommand(
const std::string& cmd,
724 const std::string& arg)
const;
733 _interfaceHandler = handler;
767 void setScriptLimits(std::uint16_t recursion, std::uint16_t timeout);
772 return _recursionLimit;
779 return _timeoutLimit;
783 typedef tree<std::pair<std::string, std::string> > InfoTree;
784 void getMovieInfo(InfoTree& tr, InfoTree::iterator it);
785 void getCharacterTree(InfoTree& tr, InfoTree::iterator it);
803 void addExternalCallback(
const std::string&
name,
as_object* callback,
808 std::string callExternalCallback(
const std::string &
name,
809 const std::vector<as_value>& args);
811 std::string callExternalJavascript(
const std::string &
name,
812 const std::vector<as_value>& args);
820 void removeQueuedConstructor(
MovieClip* target);
830 bool queryInterface(
const std::string& what)
const;
843 void setStreamBlock(
int id,
int block);
851 void stopStream(
int id);
878 void setRootMovie(
Movie* movie);
881 bool notify_mouse_listeners(
const event_id& event);
886 bool fire_mouse_event();
892 void executeAdvanceCallbacks();
895 void executeTimers();
898 void cleanupAndCollect();
916 std::int32_t
y)
const;
920 void cleanupDisplayList();
923 void advanceLiveChars();
928 void setInvalidated() { _invalidated =
true; }
934 void clearInvalidated() { _invalidated =
false; }
944 bool isInvalidated() {
return _invalidated; }
950 size_t minPopulatedPriorityQueue()
const;
955 size_t processActionQueue(
size_t lvl);
957 bool processingActions()
const {
958 return (_processingActionLevel < PRIORITY_SIZE);
961 const DisplayObject* findDropTarget(std::int32_t x, std::int32_t y,
964 void handleActionLimitHit(
const std::string& ref);
966 typedef std::forward_list<Button*> ButtonListeners;
967 ButtonListeners _buttonListeners;
989 typedef std::forward_list<MovieClip*> LiveChars;
992 LiveChars _liveChars;
997 void processActionQueue();
1001 size_t _stageHeight;
1003 rgba m_background_color;
1004 bool m_background_color_set;
1006 std::int32_t _mouseX;
1007 std::int32_t _mouseY;
1012 typedef std::set<ActiveRelay*> ObjectCallbacks;
1013 ObjectCallbacks _objectCallbacks;
1015 LoadCallbacks _loadCallbacks;
1017 typedef std::map<std::uint32_t, std::unique_ptr<Timer>> TimerMap;
1019 TimerMap _intervalTimers;
1021 size_t _lastTimerId;
1024 Keys _unreleasedKeys;
1032 boost::optional<DragState> _dragState;
1034 typedef std::map<int, MovieClip*> Levels;
1043 typedef std::map<const SWF::DefinitionTag*, as_function*> RegisteredClasses;
1044 RegisteredClasses _registeredClasses;
1056 bool _disableScripts;
1057 int _processingActionLevel;
1072 std::bitset<4u> _alignMode;
1086 std::uint16_t _recursionLimit;
1089 std::uint16_t _timeoutLimit;
1092 size_t _movieAdvancementDelay;
1095 size_t _lastMovieAdvancement;
1098 size_t _unnamedInstance;
1102 struct SoundStream {
1103 SoundStream(
int i,
int b) : id(i), block(b) {}
1108 boost::optional<SoundStream> _timelineSound;
1120 bool isLevelTarget(
int version,
const std::string&
name,
unsigned int& levelno);
1124 template<
typename T>
1128 if (!_interfaceHandler) {
1129 log_error(
"Hosting application registered no callback for " 1130 "messages, can't call %s(%s)");
1135 return boost::any_cast<
T>(_interfaceHandler->call(e));
1137 catch (
const boost::bad_any_cast&) {
1138 log_error(
_(
"Unexpected type from host interface when requesting " 1146 #endif // GNASH_MOVIE_ROOT_H
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:701
const RunResources & runResources() const
Definition: movie_root.h:788
key::code lastKeyEvent() const
Definition: movie_root.h:662
std::map< std::string, as_object * > ExternalCallbackMethods
Definition: movie_root.h:790
bool scriptsDisabled() const
Return true if scripts execution is disabled.
Definition: movie_root.h:607
Client program's interface to the definition of a movie or sprite.
Definition: movie_definition.h:95
std::list< LoadCallback > LoadCallbacks
Definition: movie_root.h:168
ScaleMode getStageScaleMode() const
Returns the Stage object's align mode.
Definition: movie_root.h:521
A class used to virtualize time flow.
Definition: VirtualClock.h:33
DisplayState getStageDisplayState() const
Returns the Stage object's align mode.
Definition: movie_root.h:527
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
void setControlFD(int fd)
Definition: movie_root.h:693
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
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
void callInterface(const HostInterface::Message &e) const
Call the hosting application without expecting a reply.
Definition: movie_root.cpp:2516
ExternalCallbackInstances _externalCallbackInstances
Definition: movie_root.h:793
SimpleBuffer data
Definition: LocalConnection_as.cpp:151
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:47
AlignMode
The possible elements of a Stage.alignMode.
Definition: movie_root.h:472
Quality
Definition: GnashEnums.h:34
GC & gc()
Definition: movie_root.h:822
std::map< std::string, std::string > MovieVariables
Definition: MovieClip.h:93
Definition: movie_root.h:126
bool operator()(const LevelMovie &d1, const LevelMovie &d2) const
Definition: movie_root.h:129
void addLiveChar(MovieClip *ch)
Register a newly born advanceable DisplayObject to the list of DisplayObjects to be advanced on next ...
Definition: movie_root.h:580
short stringToStageAlign(const std::string &str)
Definition: movie_root.cpp:2406
The base class for all ActionScript objects.
Definition: as_object.h:161
std::uint16_t getTimeoutLimit() const
Definition: movie_root.h:777
Definition: GnashKey.h:161
DSOEXPORT void registerEventCallback(HostInterface *handler)
Definition: movie_root.h:732
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
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
int getControlFD() const
Definition: movie_root.h:705
#define _(String)
Definition: log.h:44
size_t nextUnnamedInstance()
Get a unique number for unnamed instances.
Definition: movie_root.h:390
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:53
void log_error(StringType msg, Args... args)
Definition: log.h:283
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:2387
StageVerticalAlign
The possible vertical position of the Stage.
Definition: movie_root.h:465
DisplayState
The possible values of Stage.displayState.
Definition: movie_root.h:444
void loadMovie(const std::string &url, const std::string &target, const std::string &data, MovieClip::VariablesMethod method, as_object *handler=nullptr)
Queue a request for loading a movie.
Definition: movie_root.h:638
Definition: movie_root.h:474
std::int32_t x
Definition: BitmapData_as.cpp:434
Definition: movie_root.h:154
Definition: GnashKey.h:148
ActionPriorityLevel
Action priority levels.
Definition: movie_root.h:533
#define DSOEXPORT
Definition: dsodefs.h:55
std::uint16_t getRecursionLimit() const
Definition: movie_root.h:771
void setHostFD(int fd)
Definition: movie_root.h:686
Definition: movie_root.h:452
The base class for interactive objects.
Definition: InteractiveObject.h:44
std::map< std::string, as_object * > ExternalCallbackInstances
Definition: movie_root.h:791
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
std::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
LoadCallback(std::unique_ptr< IOChannel > s, as_object *o)
Definition: movie_root.h:156
Init actions, Init event handlers.
Definition: movie_root.h:535
Quality getQuality() const
Get the current display quality.
Definition: movie_root.h:490
Abstract base class for hosting app handler.
Definition: HostInterface.h:207
Movie loader.
Definition: MovieLoader.h:50
A native type that requires periodic updates from the core (movie_root).
Definition: Relay.h:79
std::array< boost::ptr_deque< ExecutableCode >, PRIORITY_SIZE > ActionQueue
A number of queues of code to execute.
Definition: movie_root.h:550
A class to identify 'static' SWF events (system events).
Definition: event_id.h:52
ExternalCallbackMethods _externalCallbackMethods
Definition: movie_root.h:792
const Keys & unreleasedKeys() const
Definition: movie_root.h:666
Definition: GnashKey.h:165
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
std::pair< StageHorizontalAlign, StageVerticalAlign > StageAlign
Definition: movie_root.h:503
DSOEXPORT void registerFSCommandCallback(FsCallback *handler)
Definition: movie_root.h:718
std::string name
Definition: LocalConnection_as.cpp:149
Definition: movie_root.h:453
ActionScript Function, either builtin or SWF-defined.
Definition: as_function.h:62
int get_depth() const
Definition: DisplayObject.h:268
This class represents the 'Stage' and top-level movie.
Definition: movie_root.h:150
A basic RGBA type.
Definition: RGBA.h:35