Gnash
0.8.10
|
This class represents the 'Stage' and top-level movie. More...
#include <movie_root.h>
Classes | |
class | LoadCallback |
struct | SoundStream |
Public Types | |
enum | DisplayState { DISPLAYSTATE_NORMAL, DISPLAYSTATE_FULLSCREEN } |
The possible values of Stage.displayState. More... | |
enum | ScaleMode { SCALEMODE_SHOWALL, SCALEMODE_NOSCALE, SCALEMODE_EXACTFIT, SCALEMODE_NOBORDER } |
The possibile values of Stage.scaleMode. More... | |
enum | StageHorizontalAlign { STAGE_H_ALIGN_C, STAGE_H_ALIGN_L, STAGE_H_ALIGN_R } |
The possible horizonal positions of the Stage. More... | |
enum | StageVerticalAlign { STAGE_V_ALIGN_C, STAGE_V_ALIGN_T, STAGE_V_ALIGN_B } |
The possible vertical position of the Stage. More... | |
enum | AlignMode { STAGE_ALIGN_L, STAGE_ALIGN_T, STAGE_ALIGN_R, STAGE_ALIGN_B } |
The possible elements of a Stage.alignMode. More... | |
enum | AllowScriptAccessMode { SCRIPT_ACCESS_NEVER, SCRIPT_ACCESS_SAME_DOMAIN, SCRIPT_ACCESS_ALWAYS } |
The possibile values of AllowScriptAccess. More... | |
enum | ActionPriorityLevel { PRIORITY_INIT, PRIORITY_CONSTRUCT, PRIORITY_DOACTION, PRIORITY_SIZE } |
Action priority levels. More... | |
typedef std::list< LoadCallback > | LoadCallbacks |
typedef std::bitset < key::KEYCOUNT > | Keys |
typedef std::pair < StageHorizontalAlign, StageVerticalAlign > | StageAlign |
typedef boost::array < boost::ptr_deque < ExecutableCode > , PRIORITY_SIZE > | ActionQueue |
A number of queues of code to execute. | |
Public Member Functions | |
movie_root (VirtualClock &clock, const RunResources &runResources) | |
Default constructor. | |
~movie_root () | |
Movie * | init (movie_definition *def, const MovieClip::MovieVariables &variables) |
Initialize movie_root with a parsed movie definition. | |
MovieClip * | getLevel (unsigned int num) const |
Return the movie at the given level (0 if unloaded level). | |
void | setLevel (unsigned int num, Movie *movie) |
Put the given movie at the given level. | |
void | replaceLevel (unsigned int num, Movie *external_movie) |
Replace an existing level with a new movie. | |
void | swapLevels (MovieClip *sp, int depth) |
Swap depth of a level (or two) | |
void | dropLevel (int depth) |
Drop level at given depth. | |
void | setDimensions (size_t w, size_t h) |
Change stage size. | |
size_t | getStageWidth () const |
Notional width of the stage, actual value depending on scaleMode. | |
size_t | getStageHeight () const |
Notional height of the stage, actual value depending on scaleMode. | |
DSOEXPORT bool | mouseMoved (boost::int32_t x, boost::int32_t y) |
Inform the Stage that the mouse has moved. | |
DSOEXPORT bool | mouseClick (bool press) |
Inform the Stage that a mouse click has occurred. | |
DSOEXPORT bool | mouseWheel (int delta) |
Inform the Stage that a mouse wheel has moved. | |
DSOEXPORT bool | keyEvent (key::code k, bool down) |
Tell the movie when the user pressed or released a key. | |
std::pair< boost::int32_t, boost::int32_t > | mousePosition () const |
Use this to retrieve the last state of the mouse. | |
void | setDragState (const DragState &st) |
Movie & | getRootMovie () |
Access the originating root movie (not necessarily _level0) | |
void | stop_drag () |
boost::uint32_t | addIntervalTimer (std::auto_ptr< Timer > timer) |
Add an interval timer. | |
void | addLoadableObject (as_object *obj, std::auto_ptr< IOChannel > str) |
Register an object for loading data to. | |
void | addAdvanceCallback (ActiveRelay *obj) |
void | removeAdvanceCallback (ActiveRelay *obj) |
bool | clearIntervalTimer (boost::uint32_t x) |
Remove timer identified by given integer. | |
void | set_background_color (const rgba &color) |
void | set_background_alpha (float alpha) |
VM & | getVM () |
Return the VM used by this movie_root. | |
bool | advance () |
int | timeToNextFrame () const |
Return the number of milliseconds available before it's time to advance the timeline again. | |
void | advanceMovie () |
Entry point for movie advancement. | |
void | display () |
size_t | nextUnnamedInstance () |
Get a unique number for unnamed instances. | |
void | registerButton (Button *listener) |
Push a new DisplayObject listener for key events. | |
void | removeButton (Button *listener) |
Remove a DisplayObject listener for key events. | |
DisplayObject * | getFocus () |
Get the DisplayObject having focus. | |
bool | setFocus (DisplayObject *to) |
Set the DisplayObject having focus. | |
DSOEXPORT void | add_invalidated_bounds (InvalidatedRanges &ranges, bool force) |
DisplayObject * | getActiveEntityUnderPointer () const |
Return the topmost active entity under the pointer. | |
const DisplayObject * | getEntityUnderPointer () const |
Return the topmost non-dragging entity under the pointer. | |
DisplayObject * | getDraggingCharacter () const |
Return the DisplayObject currently being dragged, if any. | |
bool | testInvariant () const |
void | setQuality (Quality q) |
Set the current display quality of the entire SWF. | |
Quality | getQuality () const |
Get the current display quality. | |
void | setStageAlignment (short s) |
void | setAllowScriptAccess (AllowScriptAccessMode mode) |
The mode is one of never, always, with sameDomain the default. | |
AllowScriptAccessMode | getAllowScriptAccess () |
Gets the current Access Mode for ExternalInterface. | |
StageAlign | getStageAlignment () const |
bool | getShowMenuState () const |
void | setShowMenuState (bool state) |
void | setStageScaleMode (ScaleMode sm) |
Sets the Stage object's align mode. | |
ScaleMode | getStageScaleMode () const |
Returns the Stage object's align mode. | |
std::string | getStageAlignMode () const |
DisplayState | getStageDisplayState () const |
Returns the Stage object's align mode. | |
void | setStageDisplayState (const DisplayState ds) |
void | pushAction (std::auto_ptr< ExecutableCode > code, size_t lvl) |
Push an executable code to the ActionQueue. | |
void | pushAction (const action_buffer &buf, DisplayObject *target) |
Push an executable code to the ActionQueue. | |
void | markReachableResources () const |
Mark all reachable resources (for GC) | |
void | addLiveChar (MovieClip *ch) |
Register a newly born advanceable DisplayObject to the list of DisplayObjects to be advanced on next ::advance call. | |
void | reset () |
Reset stage to its initial state. | |
void | disableScripts () |
Call this method for disabling run of actions. | |
bool | scriptsDisabled () const |
Return true if scripts execution is disabled. | |
void | flushHigherPriorityActionQueues () |
DisplayObject * | findCharacterByTarget (const std::string &tgtstr) const |
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. | |
void | getURL (const std::string &urlstr, const std::string &target, const std::string &data, MovieClip::VariablesMethod method) |
Send a request to the hosting application (e.g. browser). | |
key::code | lastKeyEvent () const |
const Keys & | unreleasedKeys () const |
void | registerClass (const SWF::DefinitionTag *sprite, as_function *cls) |
Register an actionscript class for construction of a MovieClip. | |
as_function * | getRegisteredClass (const SWF::DefinitionTag *sprite) const |
Get the actionscript class for constructing a MovieClip. | |
void | setHostFD (int fd) |
void | setControlFD (int fd) |
int | getHostFD () const |
int | getControlFD () const |
DSOEXPORT void | registerFSCommandCallback (FsCallback *handler) |
DSOEXPORT void | handleFsCommand (const std::string &cmd, const std::string &arg) const |
Call this to notify FS commands. | |
DSOEXPORT void | registerEventCallback (HostInterface *handler) |
void | callInterface (const HostInterface::Message &e) const |
Call the hosting application without expecting a reply. | |
template<typename T > | |
T | callInterface (const HostInterface::Message &e) const |
Call the hosting application, ensuring a return of the requested type. | |
void | setScriptLimits (boost::uint16_t recursion, boost::uint16_t timeout) |
boost::uint16_t | getRecursionLimit () const |
boost::uint16_t | getTimeoutLimit () const |
const RunResources & | runResources () const |
void | addExternalCallback (const std::string &name, as_object *callback) |
Add an ExternalInterface callback object with an associated name. | |
bool | processInvoke (ExternalInterface::invoke_t *) |
std::string | callExternalCallback (const std::string &name, const std::vector< as_value > &args) |
std::string | callExternalJavascript (const std::string &name, const std::vector< as_value > &args) |
void | removeQueuedConstructor (MovieClip *target) |
Removes a queued constructor from the execution queue. | |
GC & | gc () |
bool | queryInterface (const std::string &what) const |
Ask the host interface a question. | |
void | setStreamBlock (int id, int block) |
Set the current stream block for the driving streaming sound. | |
void | stopStream (int id) |
Notify the stage that a sound stream has stopped. |
This class represents the 'Stage' and top-level movie.
It is a wrapper around the set of loaded levels being played. Each 'run' of a SWF movie, including all further movies loaded during the run, has exactly one movie_root, which is kept for the entire run. Loading a new top-level movie does not create a new movie_root. The 'Stage' part of movie_root is accessible through the ActionScript Stage object, implemented in Stage_as.cpp. The movie_root class is responsible for accepting and passing on user events (mouse or key events), for maintaining the heart-beat mechanism, and for advancing all MovieClips on request from the hosting application. The _root object is provided by getAsRoot().
typedef boost::array<boost::ptr_deque<ExecutableCode>, PRIORITY_SIZE> gnash::movie_root::ActionQueue |
A number of queues of code to execute.
This is a ptr_deque because it needs no insertion in the middle but frequent push_back and pop_front. We also have to traverse it, so a queue is not usable.
typedef std::bitset<key::KEYCOUNT> gnash::movie_root::Keys |
typedef std::list<LoadCallback> gnash::movie_root::LoadCallbacks |
typedef std::pair<StageHorizontalAlign, StageVerticalAlign> gnash::movie_root::StageAlign |
gnash::movie_root::movie_root | ( | VirtualClock & | clock, |
const RunResources & | runResources | ||
) |
Default constructor.
Make sure to call setRootMovie() before using any of this class methods !
References setQuality(), gnash::QUALITY_HIGH, gnash::RcInitFile::getDefaultInstance(), gnash::RcInitFile::getScriptsRecursionLimit(), and gnash::RcInitFile::getScriptsTimeout().
gnash::movie_root::~movie_root | ( | ) |
References gnash::fontlib::clear(), gnash::MovieLoader::clear(), assert, and testInvariant().
void gnash::movie_root::add_invalidated_bounds | ( | InvalidatedRanges & | ranges, |
bool | force | ||
) |
References gnash::geometry::SnappingRanges2d::setWorld(), gnash::key::i, and gnash::key::e.
Referenced by nsPluginInstance::threadMain().
void gnash::movie_root::addAdvanceCallback | ( | ActiveRelay * | obj | ) |
void gnash::movie_root::addExternalCallback | ( | const std::string & | name, |
as_object * | callback | ||
) |
Add an ExternalInterface callback object with an associated name.
This should store a callback object in movie_root.
TODO: currently it doesn't.
References UNUSED, gnash::ExternalInterface::makeInvoke(), gnash::ExternalInterface::writeBrowser(), and _.
boost::uint32_t gnash::movie_root::addIntervalTimer | ( | std::auto_ptr< Timer > | timer | ) |
Add an interval timer.
timer | A Timer, ownership will be transferred. Must not be NULL. |
internal | If true, this is an internal timer, so will get a negative id. |
References assert, testInvariant(), and gnash::key::t.
void gnash::movie_root::addLiveChar | ( | MovieClip * | ch | ) | [inline] |
Register a newly born advanceable DisplayObject to the list of DisplayObjects to be advanced on next ::advance call.
The DisplayObject will only be advanced if not unloaded when its turn comes. Characters are advanced in reverse-placement order (first registered is advanced last)
References assert.
Referenced by gnash::MovieClip::construct().
Register an object for loading data to.
When complete, the object's onData function is called. The callback is removed when the load is complete, including failed loads. There is no restriction on the type of as_object that can registered.
obj | The object to update when data is received. |
str | The stream to load from. TODO: this function could be improved, e.g. by handling the URL checking and stream construction as well. It may be possible for this function to handle all connections if it also takes a callback function to call on each advance. |
bool gnash::movie_root::advance | ( | ) |
Main and only callback from hosting application. Expected to be called at 10ms resolution.
References gnash::VM::getTime(), gnash::key::s, gnash::RunResources::soundHandler(), gnash::sound::sound_handler::streamingSound(), _, gnash::sound::sound_handler::getStreamBlock(), getTimeoutLimit(), advanceMovie(), gnash::SystemClock::elapsed(), queryInterface(), and gnash::fontlib::clear().
Referenced by gnash::Gui::advanceMovie(), and nsPluginInstance::threadMain().
void gnash::movie_root::advanceMovie | ( | ) |
Entry point for movie advancement.
This function does:
References gnash::MovieLoader::processCompletedRequests(), assert, and testInvariant().
Referenced by advance().
std::string gnash::movie_root::callExternalCallback | ( | const std::string & | name, |
const std::vector< as_value > & | args | ||
) |
std::string gnash::movie_root::callExternalJavascript | ( | const std::string & | name, |
const std::vector< as_value > & | args | ||
) |
T gnash::movie_root::callInterface | ( | const HostInterface::Message & | e | ) | const |
Call the hosting application without expecting a reply.
e | The message to send to the interface. |
References _, and gnash::HostInterface::call().
Referenced by setStageAlignment(), setShowMenuState(), setStageScaleMode(), setStageDisplayState(), and processInvoke().
T gnash::movie_root::callInterface | ( | const HostInterface::Message & | e | ) | const |
Call the hosting application, ensuring a return of the requested type.
If the return type is other than the requested type, this represents a bug in the hosting application. An error is logged and the default constructed type T is returned. This may cause unexpected ActionScript behaviour, but is otherwise safe.
T | The return type expected. |
e | The message to send to the interface. |
bool gnash::movie_root::clearIntervalTimer | ( | boost::uint32_t | x | ) |
Remove timer identified by given integer.
void gnash::movie_root::disableScripts | ( | ) |
Call this method for disabling run of actions.
NOTE: this will only work for queued actions, not for *every* action. Supposedly all actions should be queued, but this is not really always the case. Notable exceptions are:
void gnash::movie_root::display | ( | ) |
References assert, testInvariant(), gnash::MovieClip::get_frame_size(), gnash::SWFRect::is_null(), gnash::RunResources::renderer(), gnash::SWFRect::get_x_min(), gnash::SWFRect::get_x_max(), gnash::SWFRect::get_y_min(), gnash::SWFRect::get_y_max(), gnash::key::i, gnash::key::e, gnash::DisplayObject::clear_invalidated(), gnash::DisplayObject::visible(), and gnash::MovieClip::display().
Referenced by nsPluginInstance::threadMain().
void gnash::movie_root::dropLevel | ( | int | depth | ) |
Drop level at given depth.
depth | Depth of the level to drop. Note that this is -DisplayObject::staticDepthOffset for the root movie. Must be >=0 and <= 1048575 or an assertion will fail. Note that if the depth evaluates to the original root movie nothing happens (not allowed to remove that). It is not tested if it's allowed to remove _level0 after loading into it. |
References assert, _, IF_VERBOSE_ASCODING_ERRORS, gnash::DisplayObject::unload(), gnash::MovieClip::destroy(), and testInvariant().
Referenced by gnash::MovieClip::removeMovieClip().
DisplayObject * gnash::movie_root::findCharacterByTarget | ( | const std::string & | tgtstr | ) | const |
void gnash::movie_root::flushHigherPriorityActionQueues | ( | ) |
Process action queues with higher priority then the priority of the action queue currently being processed. This is intended to be called at the end of any function call and at the end of an action block.
TODO: be aware of infinite loops !
cleanup anything pushed later..
References gnash::fontlib::clear().
GC& gnash::movie_root::gc | ( | ) | [inline] |
DisplayObject * gnash::movie_root::getActiveEntityUnderPointer | ( | ) | const |
Return the topmost active entity under the pointer.
This method returns cached info, with cache updated by notify_mouse_moved (and should be updated also by movie advancement or actions execution maybe, not currently implmented).
References gnash::MouseButtonState::activeEntity.
Referenced by gnash::Gui::notifyMouseMove().
movie_root::AllowScriptAccessMode gnash::movie_root::getAllowScriptAccess | ( | ) |
Gets the current Access Mode for ExternalInterface.
int gnash::movie_root::getControlFD | ( | ) | const [inline] |
DisplayObject * gnash::movie_root::getDraggingCharacter | ( | ) | const |
Return the DisplayObject currently being dragged, if any.
Referenced by getEntityUnderPointer().
const DisplayObject * gnash::movie_root::getEntityUnderPointer | ( | ) | const |
Return the topmost non-dragging entity under the pointer.
This method triggers a displaylist scan
References gnash::pixelsToTwips(), and getDraggingCharacter().
DisplayObject * gnash::movie_root::getFocus | ( | ) |
Get the DisplayObject having focus.
The DisplayObject having focus will receive mouse button and key presses/releases.
Referenced by gnash::DisplayObject::set_visible().
int gnash::movie_root::getHostFD | ( | ) | const [inline] |
Get the filedescriptor to use for host application requests (for browser communication mostly)
MovieClip * gnash::movie_root::getLevel | ( | unsigned int | num | ) | const |
Return the movie at the given level (0 if unloaded level).
POST CONDITIONS:
References gnash::key::i, and gnash::DisplayObject::staticDepthOffset.
Referenced by gnash::getDisplayObjectProperty(), processInvoke(), and callExternalCallback().
Quality gnash::movie_root::getQuality | ( | ) | const [inline] |
boost::uint16_t gnash::movie_root::getRecursionLimit | ( | ) | const [inline] |
Get the current global recursion limit for this movie: it can be changed by loaded movies.
Referenced by gnash::VM::pushCallFrame().
as_function * gnash::movie_root::getRegisteredClass | ( | const SWF::DefinitionTag * | sprite | ) | const |
Get the actionscript class for constructing a MovieClip.
sprite | The definition tag for the MovieClip to be placed on stage |
Referenced by gnash::MovieClip::constructAsScriptObject().
Movie& gnash::movie_root::getRootMovie | ( | ) | [inline] |
Access the originating root movie (not necessarily _level0)
Referenced by gnash::DisplayObject::getTargetPath(), gnash::DumpGui::run(), gnash::GtkAggVaapiGlue::beforeRendering(), gnash::Gui::notify_key_event(), gnash::Gui::advanceMovie(), gnash::MovieClip::getAsRoot(), and nsPluginInstance::threadMain().
bool gnash::movie_root::getShowMenuState | ( | ) | const |
Returns the current value of _showMenu which instructs the gui about how much to display in the context menu
Returns a string that represents the boolean state of the _showMenu variable
movie_root::StageAlign gnash::movie_root::getStageAlignment | ( | ) | const |
Returns the current alignment of the stage (left/right/centre, top/ bottom/centre) as a std::pair
Returns a pair of enum values giving the actual alignment of the stage after align mode flags are evaluated.
L takes precedence over R. Default is centred.
T takes precedence over B. Default is centred.
References STAGE_H_ALIGN_C, STAGE_ALIGN_L, STAGE_H_ALIGN_L, STAGE_ALIGN_R, STAGE_H_ALIGN_R, STAGE_V_ALIGN_C, STAGE_ALIGN_T, STAGE_V_ALIGN_T, STAGE_ALIGN_B, and STAGE_V_ALIGN_B.
Referenced by gnash::Gui::updateStageMatrix().
std::string gnash::movie_root::getStageAlignMode | ( | ) | const |
Returns the string representation of the current align mode, which must always be in the order: LTRB
References STAGE_ALIGN_L, STAGE_ALIGN_T, STAGE_ALIGN_R, and STAGE_ALIGN_B.
DisplayState gnash::movie_root::getStageDisplayState | ( | ) | const [inline] |
Returns the Stage object's align mode.
size_t gnash::movie_root::getStageHeight | ( | ) | const |
Notional height of the stage, actual value depending on scaleMode.
Get actionscript height of stage, in pixels. The height returned depends on the scale mode.
References SCALEMODE_NOSCALE, and gnash::Movie::heightPixels().
ScaleMode gnash::movie_root::getStageScaleMode | ( | ) | const [inline] |
Returns the Stage object's align mode.
Referenced by gnash::Gui::updateStageMatrix().
size_t gnash::movie_root::getStageWidth | ( | ) | const |
Notional width of the stage, actual value depending on scaleMode.
Get actionscript width of stage, in pixels. The width returned depends on the scale mode.
References SCALEMODE_NOSCALE, and gnash::Movie::widthPixels().
boost::uint16_t gnash::movie_root::getTimeoutLimit | ( | ) | const [inline] |
Get the current global script timeout limit for this movie: it can be changed by loaded movies.
Referenced by gnash::ActionExec::operator()(), and advance().
void gnash::movie_root::getURL | ( | const std::string & | urlstr, |
const std::string & | target, | ||
const std::string & | data, | ||
MovieClip::VariablesMethod | method | ||
) |
Send a request to the hosting application (e.g. browser).
This function constructs the URL and, if required, the postdata from the arguments. The variables to send should *not* be appended to
urlstr | before calling this function. |
urlstr | The url exactly as requested. This may already contain a query string. |
target | Target for request. |
data | The variables data to send, URL encoded in key/value pairs |
method | The VariablesMethod to use for sending the data. If MovieClip::METHOD_NONE, no data will be sent. |
If there is no hosting application, call the URL launcher. For safety, we resolve the URL against the base URL for this run. The data is not sent at all.
Try to avoid letting flash movies execute arbitrary commands (sic)
Maybe we should exec here, but if we do we might have problems with complex urlOpenerFormats like: firefox -remote 'openurl(u)'
This is when there is a hosting application.
References __FUNCTION__, url, gnash::RunResources::streamProvider(), gnash::StreamProvider::baseURL(), gnash::RcInitFile::getDefaultInstance(), _, gnash::ExternalInterface::makeInvoke(), and gnash::ExternalInterface::writeBrowser().
Referenced by gnash::TextField::mouseEvent().
VM& gnash::movie_root::getVM | ( | ) | [inline] |
Return the VM used by this movie_root.
References _vm.
Referenced by gnash::DisplayObject::getNextUnnamedInstanceName(), gnash::DisplayObject::pathElement(), gnash::DisplayObject::getTarget(), gnash::DumpGui::run(), processInvoke(), and callExternalCallback().
void gnash::movie_root::handleFsCommand | ( | const std::string & | cmd, |
const std::string & | arg | ||
) | const |
Call this to notify FS commands.
References gnash::FsCallback::notify().
Movie * gnash::movie_root::init | ( | movie_definition * | def, |
const MovieClip::MovieVariables & | variables | ||
) |
Initialize movie_root with a parsed movie definition.
The definition may be a SWF or Bitmap movie definition. The created Movie is returned; it is non-const so may be stored, queried, and changed by the caller for debugging or manipulation. Direct use of the pointer may result in unexpected behaviour during SWF playback, so for normal playback this pointer should not be used.
References gnash::VM::setSWFVersion(), gnash::movie_definition::get_version(), gnash::movie_definition::createMovie(), gnash::VM::getGlobal(), and gnash::MovieClip::setVariables().
Referenced by gnash::Gui::start().
bool gnash::movie_root::keyEvent | ( | key::code | k, |
bool | down | ||
) |
Tell the movie when the user pressed or released a key.
This function should return TRUE if any action triggered by the event requires redraw, see Handling of user events for more info.
References gnash::key::k, gnash::key::codeMap, gnash::key::KEY, gnash::key::KEYCOUNT, gnash::DisplayObject::unloaded(), gnash::MovieClip::notifyEvent(), gnash::event_id::KEY_DOWN, gnash::key::INVALID, gnash::event_id::KEY_PRESS, gnash::event_id::KEY_UP, gnash::getURI(), gnash::NSV::CLASS_KEY, gnash::NSV::PROP_BROADCAST_MESSAGE, _, gnash::fontlib::clear(), gnash::key::e, and gnash::TextField::keyInput().
Referenced by gnash::Gui::notify_key_event().
key::code gnash::movie_root::lastKeyEvent | ( | ) | const [inline] |
Referenced by gnash::key_get_ascii(), and gnash::key_get_code().
void gnash::movie_root::loadMovie | ( | const std::string & | url, |
const std::string & | target, | ||
const std::string & | data, | ||
MovieClip::VariablesMethod | method, | ||
as_object * | handler = 0 |
||
) | [inline] |
Queue a request for loading a movie.
This function constructs the URL and, if required, the postdata from the arguments. The variables to send should *not* be appended to
urlstr | before calling this function. |
urlstr | The url exactly as requested. This may already contain a query string. |
target | Target for request. |
data | The variables data to send, URL encoded in key/value pairs |
method | The VariablesMethod to use for sending the data. If MovieClip::METHOD_NONE, no data will be sent. |
handler | An object which will be signalled of load events (onLoadStart, onLoadComplete, onLoadInit, onLoadError). Can be null if caller doesn't care. |
void gnash::movie_root::markReachableResources | ( | ) | const [virtual] |
Mark all reachable resources (for GC)
Resources reachable from movie_root are:
Implements gnash::GcRoot.
References gnash::VM::markReachableResources(), gnash::foreachSecond(), assert, gnash::GcResource::setReachable(), gnash::MouseButtonState::markReachableResources(), gnash::renderer::opengl::for_each(), gnash::ActiveRelay::setReachable(), gnash::movie_root::LoadCallback::setReachable(), gnash::MovieLoader::setReachable(), PRIORITY_SIZE, gnash::ExecutableCode::markReachableResources(), gnash::key::i, and gnash::key::e.
bool gnash::movie_root::mouseClick | ( | bool | press | ) |
Inform the Stage that a mouse click has occurred.
press | true for a mouse click, false for a release |
References assert, testInvariant(), gnash::MouseButtonState::isDown, gnash::event_id::MOUSE_DOWN, and gnash::event_id::MOUSE_UP.
Referenced by gnash::Gui::notifyMouseClick().
bool gnash::movie_root::mouseMoved | ( | boost::int32_t | x, |
boost::int32_t | y | ||
) |
Inform the Stage that the mouse has moved.
Coordinates are in Stage Coordinate Space (pseudo-pixels units).
x | The x co-ordinate in pixels. |
y | The y co-ordinate in pixels. |
TODO: take twips (or float pixels), or we won't be able to support sub-pixel accuracy in collision detection.
References assert, testInvariant(), x, y, and gnash::event_id::MOUSE_MOVE.
Referenced by gnash::Gui::notifyMouseMove().
std::pair< boost::int32_t, boost::int32_t > gnash::movie_root::mousePosition | ( | ) | const |
Use this to retrieve the last state of the mouse.
Coordinates are in PIXELS, NOT TWIPS.
References assert, and testInvariant().
Referenced by gnash::TextField::mouseEvent().
bool gnash::movie_root::mouseWheel | ( | int | delta | ) |
Inform the Stage that a mouse wheel has moved.
delta | The direction of the scroll: positive for up, negative for down. Although values from about -3 to 3 are documented, only -1 and 1 have been observed. |
References gnash::getURI(), gnash::NSV::CLASS_MOUSE, x, gnash::pixelsToTwips(), y, gnash::key::i, gnash::NSV::PROP_BROADCAST_MESSAGE, and gnash::getObject().
Referenced by gnash::Gui::notifyMouseWheel().
size_t gnash::movie_root::nextUnnamedInstance | ( | ) | [inline] |
Get a unique number for unnamed instances.
Referenced by gnash::DisplayObject::getNextUnnamedInstanceName().
bool gnash::movie_root::processInvoke | ( | ExternalInterface::invoke_t * | invoke | ) |
References GNASH_REPORT_FUNCTION, gnash::ExternalInterface::invoke_t::name, gnash::HostInterface::exit(), getLevel(), gnash::getObject(), getVM(), gnash::ExternalInterface::invoke_t::args, gnash::as_object::set_member(), gnash::getURI(), gnash::as_object::get_member(), gnash::ExternalInterface::toXML(), _, gnash::HostMessage::EXTERNALINTERFACE_ISPLAYING, callInterface(), gnash::HostMessage::EXTERNALINTERFACE_PAN, gnash::MovieClip::get_bytes_loaded(), gnash::MovieClip::get_bytes_total(), gnash::HostMessage::EXTERNALINTERFACE_PLAY, gnash::HostMessage::EXTERNALINTERFACE_REWIND, gnash::HostMessage::EXTERNALINTERFACE_SETZOOMRECT, gnash::HostMessage::EXTERNALINTERFACE_STOPPLAY, gnash::HostMessage::EXTERNALINTERFACE_ZOOM, gnash::MovieClip::get_loaded_frames(), callExternalCallback(), gnash::ExternalInterface::makeString(), and gnash::amf::write().
void gnash::movie_root::pushAction | ( | std::auto_ptr< ExecutableCode > | code, |
size_t | lvl | ||
) |
Push an executable code to the ActionQueue.
References assert.
Referenced by gnash::Button::mouseEvent(), gnash::MovieClip::queueEvent(), gnash::MovieClip::queueAction(), gnash::MovieClip::execute_init_action_buffer(), and gnash::MovieClip::construct().
void gnash::movie_root::pushAction | ( | const action_buffer & | buf, |
DisplayObject * | target | ||
) |
Push an executable code to the ActionQueue.
References gnash::DisplayObject::getTargetPath(), and PRIORITY_DOACTION.
bool gnash::movie_root::queryInterface | ( | const std::string & | what | ) | const |
Ask the host interface a question.
what | The question to pose. |
References gnash::HostMessage::QUERY, and _.
Referenced by gnash::ActionExec::operator()(), and advance().
void gnash::movie_root::registerButton | ( | Button * | listener | ) |
Push a new DisplayObject listener for key events.
Referenced by gnash::Button::construct().
void gnash::movie_root::registerClass | ( | const SWF::DefinitionTag * | sprite, |
as_function * | cls | ||
) |
DSOEXPORT void gnash::movie_root::registerEventCallback | ( | HostInterface * | handler | ) | [inline] |
A callback to the GUI (or whatever is listening) for sending events and receiving replies. Used for ActionScript interface with the gui (Mouse visibility, Stage alignment etc and System information, for instance).
See callInterface method
DSOEXPORT void gnash::movie_root::registerFSCommandCallback | ( | FsCallback * | handler | ) | [inline] |
ActionScript embedded in a movie can use the built-in fscommand() function to send data back to the host application. If you are interested in this data, register a handler, which will be called when the embedded scripts call fscommand().
The handler gets the MovieClip* that the script is embedded in, and the two string arguments passed by the script to fscommand().
Referenced by nsPluginInstance::threadMain().
void gnash::movie_root::removeAdvanceCallback | ( | ActiveRelay * | obj | ) |
Referenced by gnash::ActiveRelay::clean().
void gnash::movie_root::removeButton | ( | Button * | listener | ) |
Remove a DisplayObject listener for key events.
Referenced by gnash::Button::destroy().
void gnash::movie_root::removeQueuedConstructor | ( | MovieClip * | target | ) |
Removes a queued constructor from the execution queue.
This is used to prevent construction of targets that are placed and then removed in skipped frames. Callers are responsible for determining whether it should be removed, for instance by checking for an onUnload handler.
References PRIORITY_CONSTRUCT.
Referenced by gnash::MovieClip::unloadChildren().
void gnash::movie_root::replaceLevel | ( | unsigned int | num, |
Movie * | external_movie | ||
) |
Replace an existing level with a new movie.
Depth will be assigned to external_movie by this function. If the give level number doesn't exist an error is logged and nothing else happens.
This method is intended for use by xxx.loadMovie(yyy) when 'xxx' is a top-level movie.
References gnash::DisplayObject::set_depth(), gnash::DisplayObject::staticDepthOffset, gnash::DisplayObject::get_depth(), _, and setLevel().
Referenced by gnash::MovieClip::getLoadedMovie().
void gnash::movie_root::reset | ( | ) |
Reset stage to its initial state.
References gnash::RunResources::soundHandler(), gnash::sound::sound_handler::reset(), gnash::fontlib::clear(), gnash::MovieLoader::clear(), gnash::VM::getStack(), gnash::SafeStack::clear(), and gnash::GC::fuzzyCollect().
Referenced by gnash::Gui::restart().
const RunResources& gnash::movie_root::runResources | ( | ) | const [inline] |
Referenced by gnash::getRunResources(), gnash::Gui::toggleSound(), gnash::Gui::play(), gnash::Gui::stop(), gnash::Gui::pause(), gnash::Gui::start(), gnash::MovieClip::loadVariables(), gnash::MovieLoader::loadMovie(), gnash::SharedObjectLibrary::SharedObjectLibrary(), and gnash::SharedObjectLibrary::getLocal().
bool gnash::movie_root::scriptsDisabled | ( | ) | const [inline] |
Return true if scripts execution is disabled.
Referenced by gnash::ActionExec::operator()().
void gnash::movie_root::set_background_alpha | ( | float | alpha | ) |
References gnash::frnd(), gnash::key::f, and gnash::rgba::m_a.
Referenced by gnash::Gui::start(), and nsPluginInstance::threadMain().
void gnash::movie_root::set_background_color | ( | const rgba & | color | ) |
References color, and gnash::rgba::m_a.
Referenced by gnash::MovieClip::set_background_color().
void gnash::movie_root::setAllowScriptAccess | ( | AllowScriptAccessMode | mode | ) |
The mode is one of never, always, with sameDomain the default.
Sets the flag to allow interfacing with JavaScript in the browser. This is disabled by default, but enabled for ExternalInterface.
void gnash::movie_root::setControlFD | ( | int | fd | ) | [inline] |
Set a filedescriptor to use for host application requests (for browser communication mostly)
void gnash::movie_root::setDimensions | ( | size_t | w, |
size_t | h | ||
) |
Change stage size.
This may be smaller than the size of the root movie. It determines how much of the movie is visible.
w | The width of the stage |
h | The height of the stage. |
References assert, testInvariant(), test::w, gnash::key::h, SCALEMODE_NOSCALE, gnash::getURI(), gnash::NSV::CLASS_STAGE, and gnash::NSV::PROP_BROADCAST_MESSAGE.
Referenced by gnash::Gui::resize_view().
void gnash::movie_root::setDragState | ( | const DragState & | st | ) |
bool gnash::movie_root::setFocus | ( | DisplayObject * | to | ) |
Set the DisplayObject having focus.
to | The DisplayObject to receive focus. NULL to kill focus. |
A valid focus must have an associated object.
References gnash::DisplayObject::handleFocus(), gnash::DisplayObject::killFocus(), assert, gnash::getObject(), gnash::NSV::PROP_ON_KILL_FOCUS, gnash::NSV::PROP_ON_SET_FOCUS, gnash::NSV::CLASS_SELECTION, gnash::NSV::PROP_BROADCAST_MESSAGE, and testInvariant().
Referenced by gnash::DisplayObject::set_visible().
void gnash::movie_root::setHostFD | ( | int | fd | ) | [inline] |
Set a filedescriptor to use for host application requests (for browser communication mostly)
References assert.
void gnash::movie_root::setLevel | ( | unsigned int | num, |
Movie * | movie | ||
) |
Put the given movie at the given level.
movie | The Movie to store at the given level. Its depth will be set to <num>+DisplayObject::staticDepthOffset and its name to _level<num> |
Notify placement
References assert, gnash::DisplayObject::get_depth(), gnash::DisplayObject::staticDepthOffset, gnash::Movie::widthPixels(), gnash::Movie::heightPixels(), gnash::key::e, gnash::HostMessage::RESIZE_STAGE, gnash::HostInterface::call(), gnash::DisplayObject::set_invalidated(), gnash::MovieClip::construct(), and testInvariant().
Referenced by replaceLevel().
void gnash::movie_root::setQuality | ( | Quality | q | ) |
Set the current display quality of the entire SWF.
Overridden quality if not negative.
References gnash::RcInitFile::getDefaultInstance(), gnash::RcInitFile::qualityLevel(), gnash::QUALITY_BEST, gnash::key::q, gnash::RunResources::renderer(), and gnash::Renderer::setQuality().
Referenced by gnash::Gui::setQuality(), and movie_root().
void gnash::movie_root::setScriptLimits | ( | boost::uint16_t | recursion, |
boost::uint16_t | timeout | ||
) |
Called from the ScriptLimits tag parser to set the global script limits. It is expected behaviour that each new loaded movie should override this. Can be overridden from gnashrc.
recursion | the maximum number of recursions when finding 'super'. The default value for this (i.e. when no ScriptLimits tag is present) is documented to be 256, but this may change and appears not to be crucial for (backward) compatibility. |
timeout | the timeout in seconds for script execution. The default value for this (i.e. when no ScriptLimits tag is present) is documented to be 15 to 20 seconds, depending on platform. |
References gnash::RcInitFile::getDefaultInstance(), and LOG_ONCE.
Referenced by gnash::SWF::ScriptLimitsTag::executeState().
void gnash::movie_root::setShowMenuState | ( | bool | state | ) |
Sets the value of _showMenu and calls the fscommand handler for the current gui
Sets the value of _showMenu and calls the gui handler to process the fscommand to change the display of the context menu
References callInterface(), and gnash::HostMessage::SHOW_MENU.
void gnash::movie_root::setStageAlignment | ( | short | s | ) |
Sets movie_root's horizontal and vertical alignment to one of the three possible positions for each dimension.
Takes a short int bitfield: the four bits correspond to the AlignMode enum
References gnash::key::s, callInterface(), and gnash::HostMessage::UPDATE_STAGE.
void gnash::movie_root::setStageDisplayState | ( | const DisplayState | ds | ) |
void gnash::movie_root::setStageScaleMode | ( | ScaleMode | sm | ) |
Sets the Stage object's align mode.
References SCALEMODE_NOSCALE, gnash::Movie::definition(), gnash::movie_definition::get_width_pixels(), gnash::movie_definition::get_height_pixels(), callInterface(), gnash::HostMessage::UPDATE_STAGE, gnash::NSV::CLASS_STAGE, and gnash::NSV::PROP_BROADCAST_MESSAGE.
Referenced by gnash::Gui::allowScale().
void gnash::movie_root::setStreamBlock | ( | int | id, |
int | block | ||
) |
Set the current stream block for the driving streaming sound.
The frame rate will be changed so that it advances only when the block for a particular frame is reached. Only one sound can drive the frame: the first one to be registered.
id | The id of the stream; if another stream is already driving the frame rate, nothing happens. |
block | The block of sound currently being played. The current frame will be advanced or delayed until the frame corresponding to this block is reached. |
Referenced by gnash::SWF::StreamSoundBlockTag::executeActions().
void gnash::movie_root::stop_drag | ( | ) | [inline] |
void gnash::movie_root::stopStream | ( | int | id | ) |
Notify the stage that a sound stream has stopped.
If it's the one driving the frame rate, the frame rate will return to the nominal rate
id | The id of the streaming sound. |
void gnash::movie_root::swapLevels | ( | MovieClip * | sp, |
int | depth | ||
) |
Swap depth of a level (or two)
Character's depths are updated.
sp | The level to change depth/level of. A pointer to it is expected to be found in the _level# container, or an error will be printed and the call would result in a no-op. |
depth | New depth to assign to the DisplayObject. If another level exists at the target depth the latter is moved in place of the former, with its depth also updated. |
References assert, gnash::DisplayObject::get_depth(), gnash::key::i, gnash::key::e, gnash::DisplayObject::staticDepthOffset, IF_VERBOSE_ASCODING_ERRORS, _, gnash::DisplayObject::getTarget(), gnash::DisplayObject::set_depth(), gnash::DisplayObject::set_invalidated(), and testInvariant().
bool gnash::movie_root::testInvariant | ( | ) | const [inline] |
Referenced by ~movie_root(), setLevel(), swapLevels(), dropLevel(), setDimensions(), mouseMoved(), mouseClick(), mousePosition(), setDragState(), addIntervalTimer(), advanceMovie(), display(), and setFocus().
int gnash::movie_root::timeToNextFrame | ( | ) | const |
Return the number of milliseconds available before it's time to advance the timeline again.
Return value can be negative if we're late...
References gnash::VM::getTime().
const Keys& gnash::movie_root::unreleasedKeys | ( | ) | const [inline] |
Referenced by gnash::key_is_down().