Classes | Public Types | Public Member Functions

gnash::movie_root Class Reference

This class represents the 'Stage' and top-level movie. More...

#include <movie_root.h>

Collaboration diagram for gnash::movie_root:
Collaboration graph
[legend]

List of all members.

Classes

class  AbstractFsCallback
 Abstract base class for FS handlers. More...
class  AbstractIfaceCallback
 Abstract base class for hosting app handler. More...
class  LoadCallback

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< Button * > Listeners
 Listeners container.
typedef std::list< LoadCallbackLoadCallbacks
typedef std::bitset
< key::KEYCOUNT > 
Keys
typedef std::pair
< StageHorizontalAlign,
StageVerticalAlign
StageAlign

Public Member Functions

 movie_root (const movie_definition &def, VirtualClock &clock, const RunResources &runResources)
 Default constructor.
 ~movie_root ()
Movieinit (movie_definition *def, const MovieClip::MovieVariables &variables, const MovieClip::MovieVariables &scriptables)
 Initialize movie_root with a parsed movie definition.
MovieClipgetLevel (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.
void get_mouse_state (boost::int32_t &x, boost::int32_t &y)
 Use this to retrieve the last state of the mouse.
void get_drag_state (drag_state &st)
void set_drag_state (const drag_state &st)
const MoviegetRootMovie () const
MovietopLevelMovie () const
 Creating new MovieClips needs this for now.
float frameRate () const
 Return the current nominal frame rate for the Stage.
void stop_drag ()
unsigned int add_interval_timer (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 clear_interval_timer (unsigned int x)
 Remove timer identified by given integer.
size_t get_current_frame () const
 Return 0-based frame index of originating root movie.
void set_background_color (const rgba &color)
void set_background_alpha (float alpha)
VMgetVM ()
 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 goto_frame (size_t target_frame_number)
 0-based!! delegates to originating root movie
void display ()
void set_play_state (MovieClip::PlayState s)
 Delegate to originating root movie.
size_t nextUnnamedInstance ()
 Get a unique number for unnamed instances.
void add_key_listener (Button *listener)
 Push a new DisplayObject listener for key events.
void remove_key_listener (Button *listener)
 Remove a DisplayObject listener for key events.
DisplayObjectgetFocus ()
 Get the DisplayObject having focus.
bool setFocus (DisplayObject *to)
 Set the DisplayObject having focus.
DSOEXPORT void add_invalidated_bounds (InvalidatedRanges &ranges, bool force)
DisplayObjectgetActiveEntityUnderPointer () const
 Return the topmost active entity under the pointer.
const DisplayObjectgetEntityUnderPointer () const
 Return the topmost non-dragging entity under the pointer.
DisplayObjectgetDraggingCharacter () 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 setMarshallExceptions (bool x)
bool getMarshallExceptions ()
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 clear ()
 Cleanup all resources and run the GC collector.
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 ()
DisplayObjectfindCharacterByTarget (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 KeysunreleasedKeys () const
void setHostFD (int fd)
void setControlFD (int fd)
int getHostFD () const
int getControlFD () const
DSOEXPORT void registerFSCommandCallback (AbstractFsCallback *handler)
DSOEXPORT void handleFsCommand (const std::string &cmd, const std::string &arg) const
 Call this to notify FS commands.
DSOEXPORT void registerEventCallback (AbstractIfaceCallback *handler)
DSOEXPORT std::string callInterface (const std::string &cmd, const std::string &arg=std::string()) const
DSOEXPORT void errorInterface (const std::string &msg) const
 Send an error message to the hosting application.
void setScriptLimits (boost::uint16_t recursion, boost::uint16_t timeout)
boost::uint16_t getRecursionLimit () const
boost::uint16_t getTimeoutLimit () const
const std::string & getOriginalURL () const
 Get URL of the SWF movie used to initialize this VM.
const RunResourcesrunResources () const
void addExternalCallback (as_object *obj, const std::string &name, as_object *callback)
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 (DisplayObject *target)
 Removes a queued constructor from the execution queue.

Detailed Description

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().


Member Typedef Documentation

typedef std::bitset<key::KEYCOUNT> gnash::movie_root::Keys
typedef std::list<Button*> gnash::movie_root::Listeners

Listeners container.


Member Enumeration Documentation

Action priority levels.

Enumerator:
PRIORITY_INIT 

Init actions, Init event handlers.

PRIORITY_CONSTRUCT 

Construct event handlers.

PRIORITY_DOACTION 

Frame actions, load handlers, unload handlers.

PRIORITY_SIZE 

Last element used to easy computation of size...

The possible elements of a Stage.alignMode.

Enumerator:
STAGE_ALIGN_L 
STAGE_ALIGN_T 
STAGE_ALIGN_R 
STAGE_ALIGN_B 

The possibile values of AllowScriptAccess.

Enumerator:
SCRIPT_ACCESS_NEVER 
SCRIPT_ACCESS_SAME_DOMAIN 
SCRIPT_ACCESS_ALWAYS 

The possible values of Stage.displayState.

Enumerator:
DISPLAYSTATE_NORMAL 
DISPLAYSTATE_FULLSCREEN 

The possibile values of Stage.scaleMode.

Enumerator:
SCALEMODE_SHOWALL 
SCALEMODE_NOSCALE 
SCALEMODE_EXACTFIT 
SCALEMODE_NOBORDER 

The possible horizonal positions of the Stage.

Enumerator:
STAGE_H_ALIGN_C 
STAGE_H_ALIGN_L 
STAGE_H_ALIGN_R 

The possible vertical position of the Stage.

Enumerator:
STAGE_V_ALIGN_C 
STAGE_V_ALIGN_T 
STAGE_V_ALIGN_B 

Constructor & Destructor Documentation

gnash::movie_root::movie_root ( const movie_definition def,
VirtualClock clock,
const RunResources runResources 
)

Default constructor.

Make sure to call setRootMovie() before using any of this class methods !

References _target, s2x::c, gnash::key::o, and gnash::ExecutableCode::target().

gnash::movie_root::~movie_root (  ) 

References gnash::QUALITY_HIGH.


Member Function Documentation

unsigned int gnash::movie_root::add_interval_timer ( std::auto_ptr< Timer timer  ) 

Add an interval timer.

Parameters:
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.
Returns:
An integer indentifying the timer for subsequent call to clear_interval_timer. It will NEVER be zero.

References gnash::drag_state::reset().

void gnash::movie_root::add_invalidated_bounds ( InvalidatedRanges ranges,
bool  force 
)
void gnash::movie_root::add_key_listener ( Button listener  ) 

Push a new DisplayObject listener for key events.

Referenced by gnash::Button::Button().

void gnash::movie_root::addAdvanceCallback ( ActiveRelay obj  ) 
void gnash::movie_root::addExternalCallback ( as_object obj,
const std::string &  name,
as_object callback 
)
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)

void gnash::movie_root::addLoadableObject ( as_object obj,
std::auto_ptr< IOChannel str 
)

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.

Parameters:
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.

Returns:
true if the heart-beat resulted in actual SWF playhead advancement (frame advancement)

Referenced by gnash::MovieTester::advance(), and gnash::Gui::advanceMovie().

void gnash::movie_root::advanceMovie (  ) 

Entry point for movie advancement.

This function does:

  • Execute all timers
  • Reset the next Random number
  • Advance all advanceable DisplayObjects in reverse-placement order
  • Cleanup key listeners
  • Process all queued actions
  • Remove unloaded DisplayObjects from the advanceable DisplayObjects list.
  • Run the GC collector
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 
)
std::string gnash::movie_root::callInterface ( const std::string &  cmd,
const std::string &  arg = std::string() 
) const

Call into the hosting application

Will use callback set with registerEventCallback

Referenced by getShowMenuState().

void gnash::movie_root::clear (  ) 

Cleanup all resources and run the GC collector.

This method should be invoked before calling setRootMovie again for a clean restart.

Referenced by gnash::MovieTester::restart().

bool gnash::movie_root::clear_interval_timer ( unsigned int  x  ) 

Remove timer identified by given integer.

Returns:
true on success, false on error (no such timer)
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:

  • Actions in callFrame target frame but only executed by execution of the callFrame opcode
  • on{,Clip}{Initialize,Construct} event handlers
  • User event handlers (mouse,keyboard)
void gnash::movie_root::display (  ) 
void gnash::movie_root::dropLevel ( int  depth  ) 

Drop level at given depth.

Parameters:
depth Depth of the level to drop. Note that this is -DisplayObjectstaticDepthOffset 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.
void gnash::movie_root::errorInterface ( const std::string &  msg  )  const

Send an error message to the hosting application.

Parameters:
msg A message to send describing the error. The hosting app decides what to do with the message, or whether it wants to do anything at all. It may show a popup box.
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..

float gnash::movie_root::frameRate (  )  const [inline]

Return the current nominal frame rate for the Stage.

This is dependent on the Movie set as root movie.

Referenced by gnash::Gui::notify_key_event().

size_t gnash::movie_root::get_current_frame (  )  const [inline]

Return 0-based frame index of originating root movie.

TODO: drop this function (currently used by gprocessor) or change it to to delegate to _level0 ?

Referenced by gnash::Gui::advanceMovie().

void gnash::movie_root::get_drag_state ( drag_state st  ) 
void gnash::movie_root::get_mouse_state ( boost::int32_t &  x,
boost::int32_t &  y 
)

Use this to retrieve the last state of the mouse.

Coordinates are in PIXELS, NOT TWIPS.

Referenced by gnash::TextField::notifyEvent().

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).

Returns:
the topmost active entity under pointer or NULL if none.

Referenced by gnash::MovieTester::isMouseOverMouseEntity(), and 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 getStageWidth().

const DisplayObject * gnash::movie_root::getEntityUnderPointer (  )  const

Return the topmost non-dragging entity under the pointer.

This method triggers a displaylist scan

Returns:
the topmost non-dragging entity under pointer or NULL if none

References gnash::getObject(), gnash::DisplayObject::killFocus(), and gnash::NSV::PROP_ON_KILL_FOCUS.

DisplayObject * gnash::movie_root::getFocus (  ) 

Get the DisplayObject having focus.

The DisplayObject having focus will receive mouse button and key presses/releases.

Returns:
the DisplayObject having focus or NULL of none.

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)

Returns:
-1 if no filedescriptor is provided by host app.
MovieClip * gnash::movie_root::getLevel ( unsigned int  num  )  const

Return the movie at the given level (0 if unloaded level).

POST CONDITIONS:

bool gnash::movie_root::getMarshallExceptions (  )  [inline]
const std::string& gnash::movie_root::getOriginalURL (  )  const [inline]

Get URL of the SWF movie used to initialize this VM.

This information will be used for security checks

Referenced by gnash::SharedObjectLibrary::getLocal(), and gnash::SharedObjectLibrary::SharedObjectLibrary().

Quality gnash::movie_root::getQuality (  )  const [inline]

Get the current display quality.

References _quality.

Referenced by gnash::Gui::getQuality().

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().

const Movie& gnash::movie_root::getRootMovie (  )  const [inline]
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

References callInterface().

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.

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_R, STAGE_H_ALIGN_L, and STAGE_H_ALIGN_R.

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.

Referenced by gnash::TouchDevice::apply_ts_calibration(), gnash::TouchDevice::check(), and gnash::MouseDevice::check().

ScaleMode gnash::movie_root::getStageScaleMode (  )  const [inline]

Returns the Stage object's align mode.

Referenced by gnash::MovieTester::resizeStage(), and 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 getDraggingCharacter(), and gnash::pixelsToTwips().

Referenced by gnash::TouchDevice::apply_ts_calibration(), gnash::TouchDevice::check(), and gnash::MouseDevice::check().

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.

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

Parameters:
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 gnash::rgba::m_a.

Referenced by gnash::TextField::notifyEvent().

VM& gnash::movie_root::getVM (  )  [inline]

Return the VM used by this movie_root.

References _vm.

Referenced by gnash::DisplayObject::getTarget(), main(), and gnash::DisplayObject::pathElement().

void gnash::movie_root::goto_frame ( size_t  target_frame_number  )  [inline]

0-based!! delegates to originating root movie

TODO: drop this method. currently used by gprocessor.

Referenced by gnash::Gui::advanceMovie().

void gnash::movie_root::handleFsCommand ( const std::string &  cmd,
const std::string &  arg 
) const

Call this to notify FS commands.

Movie * gnash::movie_root::init ( movie_definition def,
const MovieClip::MovieVariables variables,
const MovieClip::MovieVariables scriptables 
)

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.

Referenced by main(), gnash::MovieTester::MovieTester(), gnash::MovieTester::restart(), and 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.

Referenced by gnash::Gui::notify_key_event(), gnash::MovieTester::pressKey(), and gnash::MovieTester::releaseKey().

key::code gnash::movie_root::lastKeyEvent (  )  const [inline]
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

Parameters:
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

Mark all reachable resources (for GC).

Resources reachable from movie_root are:

  • All _level# movies (_movies)
  • The original root movie (_rootMovie)
  • Mouse entities (m_mouse_button_state)
  • Timer targets (_intervalTimers)
  • Resources reachable by ActionQueue code (_actionQueue)
  • Key listeners (_keyListeners)
  • Any DisplayObject being dragged

References gnash::Timer::cleared(), gnash::Timer::expired(), gnash::foreachSecond(), and gnash::VM::getTime().

Referenced by gnash::VM::markReachableResources().

bool gnash::movie_root::mouseClick ( bool  press  ) 

Inform the Stage that a mouse click has occurred.

Parameters:
press true for a mouse click, false for a release
Returns:
true if any action triggered requires a redraw.

References gnash::key::INVALID, gnash::event_id::KEY_DOWN, gnash::event_id::KEY_PRESS, and gnash::Button::notifyEvent().

Referenced by gnash::MovieTester::click(), gnash::MovieTester::depressMouseButton(), gnash::Gui::notifyMouseClick(), and gnash::MovieTester::pressMouseButton().

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).

Parameters:
x The x co-ordinate in pixels.
y The y co-ordinate in pixels.
Returns:
true if any action triggered requires a redraw.

TODO: take twips (or float pixels), or we won't be able to support sub-pixel accuracy in collision detection.

Referenced by gnash::MovieTester::movePointerTo(), and gnash::Gui::notifyMouseMove().

bool gnash::movie_root::mouseWheel ( int  delta  ) 

Inform the Stage that a mouse wheel has moved.

Parameters:
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.
Returns:
true if any action triggered requires a redraw.

Referenced by gnash::Gui::notifyMouseWheel(), and gnash::MovieTester::scrollMouse().

size_t gnash::movie_root::nextUnnamedInstance (  ) 

Get a unique number for unnamed instances.

Referenced by gnash::DisplayObject::getNextUnnamedInstanceName().

bool gnash::movie_root::processInvoke ( ExternalInterface::invoke_t invoke  ) 
void gnash::movie_root::pushAction ( std::auto_ptr< ExecutableCode code,
size_t  lvl 
)

Push an executable code to the ActionQueue.

Referenced by gnash::Button::mouseEvent(), gnash::DisplayObject::queueEvent(), and gnash::MovieClip::unloadChildren().

void gnash::movie_root::pushAction ( const action_buffer buf,
DisplayObject target 
)

Push an executable code to the ActionQueue.

DSOEXPORT void gnash::movie_root::registerEventCallback ( AbstractIfaceCallback 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 ( AbstractFsCallback 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().

void gnash::movie_root::remove_key_listener ( Button listener  ) 

Remove a DisplayObject listener for key events.

Referenced by gnash::Button::~Button().

void gnash::movie_root::removeAdvanceCallback ( ActiveRelay obj  ) 
void gnash::movie_root::removeQueuedConstructor ( DisplayObject 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.

Referenced by gnash::DisplayObject::unload().

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.

void gnash::movie_root::reset (  ) 

Reset stage to its initial state.

References _, and IF_VERBOSE_ASCODING_ERRORS.

Referenced by gnash::Gui::restart().

const RunResources& gnash::movie_root::runResources (  )  const [inline]
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  ) 

Referenced by gnash::Gui::start().

void gnash::movie_root::set_background_color ( const rgba color  ) 
void gnash::movie_root::set_drag_state ( const drag_state st  ) 
void gnash::movie_root::set_play_state ( MovieClip::PlayState  s  )  [inline]

Delegate to originating root movie.

TODO: drop ?

Referenced by gnash::Gui::advanceMovie().

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.

Parameters:
w The width of the stage
h The height of the stage.

Referenced by gnash::Gui::resize_view(), and gnash::MovieTester::resizeStage().

bool gnash::movie_root::setFocus ( DisplayObject to  ) 

Set the DisplayObject having focus.

Parameters:
to The DisplayObject to receive focus. NULL to kill focus.
Returns:
true if the focus operation succeeded, false if the passed DisplayObject cannot receive focus. setFocus(0) is a valid operation, so returns true (always succeeds).

A valid focus must have an associated object.

References gnash::InteractiveObject::mouseEvent(), and gnash::DisplayObject::unloaded().

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)

void gnash::movie_root::setLevel ( unsigned int  num,
Movie movie 
)

Put the given movie at the given level.

Parameters:
movie The Movie to store at the given level. Its depth will be set to <num>+DisplayObjectstaticDepthOffset and its name to _level<num>

Notify placement

void gnash::movie_root::setMarshallExceptions ( bool  x  )  [inline]
void gnash::movie_root::setQuality ( Quality  q  ) 

Set the current display quality of the entire SWF.

Overridden quality if not negative.

References gnash::getObject(), and gnash::NSV::PROP_ON_SET_FOCUS.

Referenced by gnash::Gui::setQuality().

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.

Parameters:
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::MovieClip::METHOD_GET, gnash::MovieClip::METHOD_NONE, and gnash::MovieClip::METHOD_POST.

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

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

void gnash::movie_root::setStageDisplayState ( const DisplayState  ds  ) 
void gnash::movie_root::setStageScaleMode ( ScaleMode  sm  ) 

Sets the Stage object's align mode.

Referenced by gnash::Gui::allowScale().

void gnash::movie_root::stop_drag (  )  [inline]
void gnash::movie_root::swapLevels ( MovieClip sp,
int  depth 
)

Swap depth of a level (or two).

Character's depths are updated.

Parameters:
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.
bool gnash::movie_root::testInvariant (  )  const [inline]
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...

Referenced by gnash::Gui::advanceMovie().

Movie* gnash::movie_root::topLevelMovie (  )  const [inline]

Creating new MovieClips needs this for now.

TODO: create MovieClips without this and drop. It's deliberately different from getRootMovie() so it doesn't end up getting used in the same way.

const Keys& gnash::movie_root::unreleasedKeys (  )  const [inline]

Referenced by gnash::key_is_down().


The documentation for this class was generated from the following files: