Gnash  0.8.10
aos4sup.h
Go to the documentation of this file.
00001 //
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
00003 //   2011 Free Software Foundation, Inc
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 
00020 #ifndef __AOS4SUP_H__
00021 #define __AOS4SUP_H__
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include "gnashconfig.h"
00025 #endif
00026 
00027 #include "aos4_gnash_prefs.h"
00028 
00029 #include <vector>
00030 #include <proto/intuition.h>
00031 #include <proto/graphics.h>
00032 #include <proto/Picasso96API.h>
00033 #include <proto/layers.h>
00034 #include <proto/Picasso96API.h>
00035 #include <proto/dos.h>
00036 #include <proto/exec.h>
00037 #include <proto/timer.h>
00038 #include <exec/execbase.h>
00039 #include <devices/timer.h>
00040 
00041 #include <graphics/blitattr.h>
00042 #include <graphics/composite.h>
00043 
00044 #ifdef RENDERER_CAIRO
00045 #include <cairo.h>
00046 #include <cairo-amigaos.h>
00047 #endif
00048 
00049 #undef End
00050 #undef ACTION_END
00051 #include "gui.h"
00052 
00053 #ifdef RENDERER_AGG
00054 # include "aos4_agg_glue.h"
00055 #elif defined(RENDERER_CAIRO)
00056 # include "aos4_cairo_glue.h"
00057 #elif defined(RENDERER_OPENGL)
00058 # include "aos4_ogl_glue.h"
00059 #endif
00060 
00061 #define End TAG_END
00062 
00063 #include "Renderer.h"
00064 #include "Renderer_agg.h"
00065 
00066 static struct TimeVal os4timer_starttime;
00067 
00068 namespace gnash
00069 {
00070 
00071 class AOS4Gui : public Gui
00072 {
00073 public:
00074     AOS4Gui(unsigned long xid, float scale, bool loop, RunResources& r);
00075     virtual ~AOS4Gui();
00076     virtual bool init(int argc, char **argv[]);
00077     virtual bool createWindow(const char *title, int width, int height, int xPosition = 0, int yPosition = 0);
00078     virtual bool run();
00079     virtual bool createMenu();
00080     virtual bool setupEvents();
00081     virtual void renderBuffer();
00082     virtual void setInterval(unsigned int interval);
00083     virtual void disableCoreTrap();
00084     virtual void setTimeout(unsigned int timeout);
00085     void setInvalidatedRegions(const InvalidatedRanges& ranges);
00086     void key_event(gnash::key::code key, int state, bool down);
00087         void resize(int width, int height);
00088         virtual bool showMouse(bool show);
00089         virtual void setFullscreen();
00090         virtual void unsetFullscreen();
00091         virtual void showAboutDialog();
00092         virtual struct GnashPrefs *ReadPrefs(void);
00093 private:
00094         geometry::Range2d<int> _validbounds;
00095     std::vector< geometry::Range2d<int> > _drawbounds;
00096 
00097     unsigned int                 _timeout;
00098     bool                         _core_trap;
00099         struct MsgPort          *_port;
00100         uint32                           _timerSig;
00101         struct TimeRequest      *_timerio;
00102         struct TimerIFace       *ITimer;
00103         char                            *_window_title;
00104 
00105     static key::code os4_to_gnash_key(struct IntuiMessage *imsg);
00106     static int os4_to_gnash_modifier(int state);
00107         uint32 OS4_GetTicks();
00108         void PrintMsg( CONST_STRPTR text );
00109         void TimerExit(void);
00110         bool TimerInit(void);
00111         void TimerReset(uint32 microDelay);
00112         void killAudioTask();
00113 
00114         int      _orig_width;
00115     int  _orig_height;
00116         int      _orig_xPosition;
00117     int  _orig_yPosition;
00118 
00119 #ifdef RENDERER_AGG
00120     AOS4AggGlue      _glue;
00121 #elif defined(RENDERER_CAIRO)
00122     AOS4CairoGlue    _glue;
00123 #elif defined(RENDERER_OPENGL)
00124     AOS4OglGlue      _glue;
00125 #endif
00126 
00127 };
00128 
00129 // void xt_event_handler(Widget xtwidget, gpointer instance,
00130 //       XEvent *xevent, Boolean *b);
00131 
00132 // end of namespace gnash
00133 }
00134 
00135 // end of __AOS4SUP_H__
00136 #endif