Go to the documentation of this file.
26 #include <boost/intrusive_ptr.hpp>
62 #define ENABLE_KEYBOARD_MOUSE_MOVEMENTS 1
70 class movie_definition;
100 virtual bool init(
int argc,
char **argv[]) = 0;
128 int xPosition = 0,
int yPosition = 0) = 0;
190 return std::make_pair(0, 0);
372 #ifdef GNASH_FPS_DEBUG
377 void setFpsTimerInterval(
float interval)
379 assert(interval >= 0.0);
380 fps_timer_interval = interval;
382 #endif // def GNASH_FPS_DEBUG
386 std::unique_ptr<movie_root::InfoTree> getMovieInfo()
const;
413 virtual void error(
const std::string& ) {}
425 virtual bool yesno(
const std::string& question);
434 float getFPS()
const {
return (_movieDef) ? _movieDef->get_frame_rate() : 0;
465 std::exit(EXIT_SUCCESS);
477 log_unimpl(
"This GUI does not implement FD watching.");
540 std::map<
int , std::function<void ()> > _fd_callbacks;
549 std::int32_t _xoffset;
552 std::int32_t _yoffset;
556 #ifdef GNASH_FPS_DEBUG
557 unsigned int fps_counter;
559 float fps_rate_min, fps_rate_max;
563 unsigned int fps_counter_total;
565 std::uint64_t fps_timer, fps_start_timer;
571 float fps_timer_interval;
574 unsigned int frames_dropped;
582 void fpsCounterTick();
584 #endif // def GNASH_FPS_DEBUG
588 boost::intrusive_ptr<movie_definition> _movieDef;
600 bool _showUpdatedRegions;
606 std::unique_ptr<ScreenShotter> _screenShotter;
608 #ifdef ENABLE_KEYBOARD_MOUSE_MOVEMENTS
611 bool _keyboardMouseMovements;
612 int _keyboardMouseMovementsStep;
613 #endif // ENABLE_KEYBOARD_MOUSE_MOVEMENTS
618 std::unique_ptr<Gui>
createFBGui(
unsigned long xid,
float scale,
bool loop, RunResources&
r);
gnash_cursor_type
Enumerates mouse cursor types.
Definition: gui.h:81
@ GNASH_MOD_CONTROL
Definition: GnashKey.h:37
size_t get_frame_count() const
Definition: MovieClip.h:166
virtual std::string getScreenColor() const
Get the screen color type.
Definition: gui.h:200
virtual ~Gui()
Definition: gui.cpp:176
virtual double getPixelAspectRatio() const
Definition: gui.h:187
@ R
Definition: GnashKey.h:130
Quality getQuality() const
Get current rendering quality.
Definition: gui.cpp:1282
@ L
Definition: GnashKey.h:124
@ DOWN
Definition: GnashKey.h:207
@ l
Definition: GnashKey.h:158
std::shared_ptr< Renderer > _renderer
The handler which is called to update the client area of our window.
Definition: gui.h:506
virtual void hideMenu()
Definition: gui.cpp:227
virtual bool init(int argc, char **argv[])=0
/ Initialise the gui and the associated renderer.
@ CURSOR_INPUT
Definition: gui.h:84
bool _redraw_flag
Definition: gui.h:510
std::string name
Definition: LocalConnection_as.cpp:149
bool visible(const Property &prop, int version)
Is this member supposed to be visible by a VM of given version ?
Definition: Property.h:423
@ height
Definition: klash_part.cpp:329
virtual void setTimeout(unsigned int timeout)=0
Set the time in milliseconds after which the programme should exit.
std::map< std::string, std::string > VariableMap
Definition: gui.h:390
void combineRanges() const
Definition: snappingrange.h:497
virtual bool visible()
Determines whether the Gui is visible (not obscured).
Definition: gui.h:535
T getMaxY() const
Get max Y ordinate.
Definition: Range2d.h:633
Movie & getRootMovie()
Access the originating root movie (not necessarily _level0)
Definition: movie_root.h:303
A class used to virtualize time flow.
Definition: VirtualClock.h:34
void setDimensions(size_t w, size_t h)
Change stage size.
Definition: movie_root.cpp:561
ScaleMode getStageScaleMode() const
Returns the Stage object's align mode.
Definition: movie_root.h:521
void log_debug(StringType msg, Args... args)
Definition: log.h:301
std::int32_t y
Definition: BitmapData_as.cpp:435
void toggleSound()
Definition: gui.cpp:453
virtual bool showMouse(bool show)
Sets whether the gui should show the system mouse pointer.
Definition: gui.cpp:233
@ i
Definition: GnashKey.h:155
@ stop
Definition: klash_part.cpp:330
void setMovieDefinition(movie_definition *md)
Set the definition of top-level movie.
Definition: gui.cpp:1249
#define LOG_ONCE(x)
Definition: log.h:49
@ PLUS
Definition: GnashKey.h:88
std::string typeName(const T &inst)
Definition: utility.h:93
void setStage(movie_root *stage)
Set the stage to advance/display.
Definition: gui.cpp:1256
void notifyMouseWheel(int delta)
Send a mouse wheel event to the stage.
Definition: gui.cpp:515
#define _(String)
Definition: log.h:44
modifier
Definition: GnashKey.h:34
float getXScale() const
Width of a window pixel, in stage pseudopixel units.
Definition: gui.h:428
virtual bool want_redraw()
Asks the GUI handler if the next frame should be redrawn completely.
Definition: gui.cpp:1033
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
virtual void quitUI()
End main rendering loop calling GUI-specific exit functions.
Definition: gui.h:464
Parent class from which all GUI implementations will depend.
Definition: gui.h:88
virtual void setInvalidatedRegion(const SWFRect &bounds)
Gives the GUI a hint which region of the stage should be redrawn.
Definition: gui.cpp:1039
void setMaxAdvances(unsigned long ul)
Set the maximum number of frame advances before Gnash exits.
Definition: gui.h:352
T getMaxX() const
Get max X ordinate.
Definition: Range2d.h:613
@ g
Definition: GnashKey.h:153
@ STAGE_V_ALIGN_C
Definition: movie_root.h:466
#define GNASH_REPORT_FUNCTION
Definition: log.h:452
@ Q
Definition: GnashKey.h:129
virtual bool run()=0
Start main rendering loop.
virtual void allowScale(bool allow)
Sets whether scaling should be allowed (for fscommand)
Definition: gui.cpp:246
@ m
Definition: GnashKey.h:159
bool isPlugin() const
Whether gnash is is running as a plugin.
Definition: gui.h:346
@ s
Definition: GnashKey.h:165
@ STAGE_H_ALIGN_R
Definition: movie_root.h:461
bool isWorld() const
Returns true, when the ranges equal world range.
Definition: snappingrange.h:310
@ start
Definition: klash_part.cpp:330
T getMinX() const
Get min X ordinate.
Definition: Range2d.h:603
void showUpdatedRegions(bool x)
Definition: gui.h:354
std::unique_ptr< Gui > createFLTKGui(unsigned long, float, bool, RunResourcesfloat, bool, unsigned int)
Definition: gui_fltk.cpp:40
void pause()
Toggle between "stop" and "play" mode.
Definition: gui.cpp:875
std::unique_ptr< Gui > createKDEGui(unsigned long xid, float scale, bool loop, RunResources &r)
A MovieClip is a container for DisplayObjects.
Definition: MovieClip.h:84
void setScreenShotter(std::unique_ptr< ScreenShotter > ss)
Definition: gui.cpp:1004
bool isNull() const
Returns true, when there is no range.
Definition: snappingrange.h:315
@ STAGE_H_ALIGN_L
Definition: movie_root.h:460
void takeScreenShot()
Take a screenshot now!
Definition: gui.cpp:1010
Client program's interface to the definition of a movie or sprite.
Definition: movie_definition.h:96
void log_error(StringType msg, Args... args)
Definition: log.h:283
bool showUpdatedRegions() const
Definition: gui.h:355
StageAlign getStageAlignment() const
Definition: movie_root.cpp:1251
#define ENABLE_KEYBOARD_MOUSE_MOVEMENTS
Define this to support keyboard-based pointer movements.
Definition: gui.h:62
void setStageScaleMode(ScaleMode sm)
Sets the Stage object's align mode.
Definition: movie_root.cpp:1303
RunResources & _runResources
Per-run resources.
Definition: gui.h:500
@ LEFT
Definition: GnashKey.h:209
@ k
Definition: GnashKey.h:157
std::unique_ptr< Gui > createSDLGui(unsigned long xid, float scale, bool loop, RunResources &r)
virtual void setCursor(gnash_cursor_type newcursor)
Sets the current mouse cursor for the Gui window.
Definition: gui.cpp:1027
bool _fullscreen
Definition: gui.h:513
@ RIGHT
Definition: GnashKey.h:208
bool DSOEXPORT allowHandCursor() const
Return true if this DisplayObject allows turning the cursor into an hand shape when it happens to be ...
Definition: DisplayObject.cpp:713
void notifyMouseClick(bool mouse_pressed)
Mouse notification callback to be called when the mouse is clicked.
Definition: gui.cpp:531
virtual void resizeWindow(int width, int height)
Definition: gui.cpp:203
void refreshView()
Definition: gui.cpp:547
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:45
@ H
Definition: GnashKey.h:120
DSOEXPORT std::uint64_t getTicks()
Wall clock timer, returns current POSIX time in milliseconds.
Definition: ClockTime.cpp:61
@ O
Definition: GnashKey.h:127
bool isFinite() const
Returns true if this is a finite Range2d.
Definition: Range2d.h:210
virtual void renderBuffer()=0
@ r
Definition: GnashKey.h:164
bool isWorld() const
Returns true if this is the WORLD Range2d.
Definition: Range2d.h:200
virtual void setClipboard(const std::string ©)
Definition: gui.cpp:191
bool allow(const URL &url, const URL &baseurl)
Return true if access to given url is allowed, false otherwise.
Definition: URLAccessManager.cpp:273
virtual bool watchFD(int)
Watch a file descriptor.
Definition: gui.h:475
unsigned long _maxAdvances
Definition: gui.h:519
float getFPS() const
Height of a window pixel, in stage pseudopixel units.
Definition: gui.h:434
@ GNASH_MOD_SHIFT
Definition: GnashKey.h:36
geometry::SnappingRanges2d< std::int32_t > InvalidatedRanges
Standard snapping 2d ranges type for invalidated bounds calculation
Definition: snappingrange.h:655
void setStageDisplayState(const DisplayState ds)
Definition: movie_root.cpp:1341
virtual double getScreenDPI() const
Definition: gui.h:193
void setSnapFactor(const float factor)
Definition: snappingrange.h:125
virtual bool isSelectableTextField() const
Return true if this DisplayObject is a selectable TextField.
Definition: DisplayObject.h:845
@ F
Definition: GnashKey.h:118
void updateStageMatrix()
Definition: gui.cpp:277
virtual void playHook()
Called by Gui::play().
Definition: gui.h:532
StageVerticalAlign
The possible vertical position of the Stage.
Definition: movie_root.h:465
void setSingleMode(const bool mode)
if mode==true, then the snapping ranges will act like a normal Range2d
Definition: snappingrange.h:135
code
Definition: GnashKey.h:44
T getMinY() const
Get min Y ordinate.
Definition: Range2d.h:623
void setAudioDump(const std::string &fname)
Set the name of a file to dump audio to.
Definition: gui.h:402
@ h
Definition: GnashKey.h:154
void notifyMouseMove(int x, int y)
Mouse notification callback to be called when the mouse is moved.
Definition: gui.cpp:469
@ play
Definition: klash_part.cpp:330
virtual void setFullscreen()
Definition: gui.cpp:197
int _width
Desired window width.
Definition: gui.h:494
bool _loop
Determines if playback should restart after the movie ends.
Definition: gui.h:483
static bool advance_movie(Gui *gui)
Convenience static wrapper around advanceMovie for callbacks happiness.
Definition: gui.h:272
void reset()
Reset stage to its initial state.
Definition: movie_root.cpp:519
@ p
Definition: GnashKey.h:162
void toggleFullscreen()
Definition: gui.cpp:258
@ SCALEMODE_NOSCALE
Definition: movie_root.h:452
void start()
Start the movie.
Definition: gui.cpp:899
@ q
Definition: GnashKey.h:163
@ UP
Definition: GnashKey.h:206
Handles screen dumps.
Definition: ScreenShotter.h:37
@ w
Definition: GnashKey.h:169
bool loops() const
Definition: gui.h:205
void resize_view(int width, int height)
Resize the client area view and the window accordingly.
Definition: gui.cpp:429
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:54
@ DISPLAYSTATE_FULLSCREEN
Definition: movie_root.h:446
bool _mouseShown
Definition: gui.h:516
RangeType getFullArea() const
Definition: snappingrange.h:334
Gui(RunResources &r)
Default constructor. Initialises members to safe defaults.
Definition: gui.cpp:90
std::unique_ptr< Gui > createRISCOSGui(unsigned long xid, float scale, bool loop, RunResources &r)
void play()
Put the application in "play" mode.
Definition: gui.cpp:830
std::unique_ptr< Gui > createAOS4Gui(unsigned long, float, bool, RunResourcesfloat, bool, unsigned int)
Definition: gui_aos4.cpp:40
void quit()
Always called on exit.
Definition: gui.cpp:215
@ CURSOR_HAND
Definition: gui.h:82
virtual void unsetFullscreen()
Definition: gui.cpp:209
@ STAGE_V_ALIGN_T
Definition: movie_root.h:467
@ SCALEMODE_SHOWALL
Definition: movie_root.h:451
std::unique_ptr< Gui > createGTKGui(unsigned long, float, bool, RunResourcesfloat, bool, unsigned int)
Definition: gui_gtk.cpp:41
DSOEXPORT bool keyEvent(key::code k, bool down)
Tell the movie when the user pressed or released a key.
Definition: movie_root.cpp:593
virtual float frameRate() const =0
std::unique_ptr< Gui > createQt4Gui(unsigned long xid, float scale, bool loop, RunResources &r)
virtual std::pair< int, int > screenResolution() const
Definition: gui.h:189
virtual VirtualClock & getClock()
Return the clock provided by this Gui.
Definition: gui.h:112
void set_world()
set the rectangle to the WORLD value
Definition: SWFRect.h:96
unsigned long _advances
Counter to keep track of frame advances.
Definition: gui.h:522
std::unique_ptr< Gui > createAQUAGui(unsigned long, float, bool, RunResourcesfloat, bool, unsigned int)
Definition: gui_aqua.cpp:40
@ GNASH_FILETYPE_PNG
Definition: GnashEnums.h:27
@ QUALITY_HIGH
Definition: GnashEnums.h:38
@ PLAYSTATE_PLAY
Definition: MovieClip.h:99
void restart()
Definition: gui.cpp:269
virtual void setInterval(unsigned int interval)
Set main loop delay in milliseconds.
Definition: gui.h:103
@ CURSOR_NORMAL
Definition: gui.h:83
virtual bool want_multiple_regions()
Definition: gui.h:171
Sound mixer.
Definition: sound_handler.h:88
std::string url
Definition: gnash.cpp:59
@ ESCAPE
Definition: GnashKey.h:72
A VirtualClock wrapper adding pause/resume capabilities.
Definition: VirtualClock.h:55
@ f
Definition: GnashKey.h:152
bool isStopped() const
See stop(), play() and pause()
Definition: gui.h:343
virtual void setInvalidatedRegions(const InvalidatedRanges &ranges)
Definition: gui.cpp:1045
This class represents the 'Stage' and top-level movie.
Definition: movie_root.h:151
movie_root * getStage()
The root movie, or "Stage".
Definition: gui.h:407
void growBy(const T amount)
Grows all ranges by the specified amount.
Definition: snappingrange.h:280
virtual void showMenu(bool show)
Sets whether the menus should be shown (for fscommand)
Definition: gui.cpp:240
unsigned long _xid
The X Window ID to attach to. If zero, we create a new window.
Definition: gui.h:486
@ MINUS
Definition: GnashKey.h:90
@ STAGE_V_ALIGN_B
Definition: movie_root.h:468
@ EQUALS
Definition: GnashKey.h:108
void setQuality(Quality q)
Set rendering quality, if not locked by RC file..
Definition: gui.cpp:1272
@ SCALEMODE_EXACTFIT
Definition: movie_root.h:453
Range2d< T > & setTo(T x, T y)
Set ourself to bound the given point.
Definition: Range2d.h:339
unsigned int _interval
Main loop interval: the time between successive advance_movie calls.
Definition: gui.h:503
geometry::Range2d< int > _validbounds
Definition: gui.h:491
virtual void stopHook()
Definition: gui.h:529
std::pair< StageHorizontalAlign, StageVerticalAlign > StageAlign
Definition: movie_root.h:503
Quality
Definition: GnashEnums.h:35
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:169
sound::sound_handler * soundHandler() const
Get a pointer to a sound::sound_handler set by a hosting application.
Definition: RunResources.h:96
#define IF_DEBUG_REGION_UPDATES(...)
Definition: gui.cpp:63
A system-clock based virtual clock.
Definition: SystemClock.h:37
Uniform Resource Locator.
Definition: URL.h:35
std::unique_ptr< Gui > createDumpGui(unsigned long, float, bool, RunResourcesfloat, bool, unsigned int)
Definition: gui_dump.cpp:40
void notify_key_event(gnash::key::code k, int modifier, bool pressed)
Key event notification to be called when a key is pressed or depressed.
Definition: gui.cpp:560
@ o
Definition: GnashKey.h:161
@ P
Definition: GnashKey.h:128
@ width
Definition: klash_part.cpp:329
virtual void error(const std::string &)
Handle error message from the core.
Definition: gui.h:413
ScaleMode
The possibile values of Stage.scaleMode.
Definition: movie_root.h:450
virtual bool createWindow(const char *title, int width, int height, int xPosition=0, int yPosition=0)=0
Create and display our window.
void log_unimpl(StringType msg, Args... args)
Definition: log.h:289
std::unique_ptr< Gui > createFBGui(unsigned long windowid, float scale, bool do_loop, RunResources &r)
Definition: fb.cpp:141
virtual bool yesno(const std::string &question)
Prompt user with a question she can answer with yes/no.
Definition: gui.cpp:1264
@ u
Definition: GnashKey.h:167
@ DISPLAYSTATE_NORMAL
Definition: movie_root.h:445
std::int32_t x
Definition: BitmapData_as.cpp:434
StageHorizontalAlign
The possible horizonal positions of the Stage.
Definition: movie_root.h:458
const RunResources & runResources() const
Definition: movie_root.h:788
std::unique_ptr< Gui > createHaikuGui(unsigned long xid, float scale, bool loop, RunResources &r)
bool advanceMovie(bool doDisplay=true)
Give movie an heart-beat.
Definition: gui.cpp:935
@ W
Definition: GnashKey.h:135
@ e
Definition: GnashKey.h:151
void addFlashVars(VariableMap &vars)
Add variables to set into instances of the top-level movie definition.
Definition: gui.cpp:1241
int _height
Desired window height.
Definition: gui.h:497
std::string _audioDump
Name of a file to dump audio to.
Definition: gui.h:525
@ SCALEMODE_NOBORDER
Definition: movie_root.h:454
void setWorld()
Resets to one range with world flags.
Definition: snappingrange.h:303
void stop()
Put the application in "stop" mode.
Definition: gui.cpp:853
virtual void beforeRendering()
Definition: gui.h:167
float getYScale() const
Height of a window pixel, in stage pseudopixel units.
Definition: gui.h:431
bool isFullscreen() const
Definition: gui.h:208