[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog gui/NullGui.h gui/Player.cpp gu...
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] gnash ChangeLog gui/NullGui.h gui/Player.cpp gu... |
Date: |
Mon, 09 Oct 2006 13:47:44 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Bastiaan Jacques <bjacques> 06/10/09 13:47:44
Modified files:
. : ChangeLog
gui : NullGui.h Player.cpp fb.cpp fbsup.h gtk.cpp
gtksup.h gui.cpp gui.h kde.cpp kdesup.h sdl.cpp
sdlsup.h
Log message:
* gui: First attempt at a cleanup of Gui and friends; document
class Gui. Adjust related classes to match the changes to Gui.
* gui/sdl.cpp: Fix the flipped OpenGL rendering bug.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1087&r2=1.1088
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/NullGui.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fb.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fbsup.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtksup.h?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/kde.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/kdesup.h?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/sdl.cpp?cvsroot=gnash&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/sdlsup.h?cvsroot=gnash&r1=1.13&r2=1.14
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1087
retrieving revision 1.1088
diff -u -b -r1.1087 -r1.1088
--- ChangeLog 9 Oct 2006 13:43:57 -0000 1.1087
+++ ChangeLog 9 Oct 2006 13:47:44 -0000 1.1088
@@ -1,3 +1,9 @@
+2006-10-09 Bastiaan Jacques <address@hidden>
+
+ * gui: First attempt at a cleanup of Gui and friends; document
+ class Gui. Adjust related classes to match the changes to Gui.
+ * gui/sdl.cpp: Fix the flipped OpenGL rendering bug.
+
2006-10-09 Sandro Santilli <address@hidden>
* macros/ffmpeg.m4: check for libdts too (required); always run
Index: gui/NullGui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/NullGui.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- gui/NullGui.h 3 Oct 2006 16:34:43 -0000 1.4
+++ gui/NullGui.h 9 Oct 2006 13:47:44 -0000 1.5
@@ -59,7 +59,7 @@
{}
~NullGui() {}
- void setCallback(unsigned int interval)
+ void setInterval(unsigned int interval)
{
_interval=interval;
}
@@ -67,7 +67,7 @@
{
}
bool init(int, char ***) { return true; }
- bool createWindow(int , int)
+ bool createWindow(const char* /*title*/, int /*width*/, int /*height*/)
{
return true;
}
@@ -75,10 +75,6 @@
bool createMenu() { return true; }
bool setupEvents() { return true; }
void renderBuffer() { }
-
-private:
-
- unsigned int _interval;
};
} // end of gnash namespace
Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- gui/Player.cpp 7 Oct 2006 17:44:29 -0000 1.16
+++ gui/Player.cpp 9 Oct 2006 13:47:44 -0000 1.17
@@ -40,7 +40,7 @@
#include "config.h"
#endif
-#ifndef USE_KDE
+#ifndef GUI_KDE
# ifdef GUI_GTK
# include "gtksup.h"
# define GUI_CLASS GtkGui
@@ -349,7 +349,7 @@
if (!delay) {
delay = (unsigned int) (1000 / movie_fps) ; // milliseconds per frame
}
- _gui->setCallback(delay);
+ _gui->setInterval(delay);
if (exit_timeout) {
_gui->setTimeout((unsigned int)(exit_timeout * 1000));
Index: gui/fb.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/fb.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- gui/fb.cpp 7 Oct 2006 18:09:46 -0000 1.2
+++ gui/fb.cpp 9 Oct 2006 13:47:44 -0000 1.3
@@ -355,7 +355,7 @@
return true;
}
-void FBGui::setCallback(unsigned int interval)
+void FBGui::setInterval(unsigned int interval)
{
_interval = interval;
}
Index: gui/fbsup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/fbsup.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- gui/fbsup.h 7 Oct 2006 14:05:44 -0000 1.1
+++ gui/fbsup.h 9 Oct 2006 13:47:44 -0000 1.2
@@ -79,7 +79,7 @@
virtual bool createMenu();
virtual bool setupEvents();
virtual void renderBuffer();
- virtual void setCallback(unsigned int interval);
+ virtual void setInterval(unsigned int interval);
virtual void setTimeout(unsigned int timeout);
};
Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- gui/gtk.cpp 6 Oct 2006 21:47:04 -0000 1.27
+++ gui/gtk.cpp 9 Oct 2006 13:47:44 -0000 1.28
@@ -225,8 +225,9 @@
}
void
-GtkGui::setCallback(unsigned int interval)
+GtkGui::setInterval(unsigned int interval)
{
+ _interval = interval;
g_timeout_add_full (G_PRIORITY_LOW, interval, (GSourceFunc)advance_movie,
this, NULL);
}
Index: gui/gtksup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gtksup.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- gui/gtksup.h 23 Sep 2006 15:06:53 -0000 1.18
+++ gui/gtksup.h 9 Oct 2006 13:47:44 -0000 1.19
@@ -77,7 +77,7 @@
virtual bool createMenu();
virtual bool setupEvents();
virtual void renderBuffer();
- virtual void setCallback(unsigned int interval);
+ virtual void setInterval(unsigned int interval);
virtual void setTimeout(unsigned int timeout);
// Menu Item callbacks
Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- gui/gui.cpp 6 Oct 2006 21:47:04 -0000 1.19
+++ gui/gui.cpp 9 Oct 2006 13:47:44 -0000 1.20
@@ -51,8 +51,6 @@
namespace gnash {
-const char *GNASH = "Gnash";
-
Gui::Gui() :
_loop(true),
_xid(0),
@@ -76,25 +74,6 @@
{
}
-// what is this function for ?
-bool
-Gui::init(int xid, int /*argc*/, char *** /*argv*/)
-{
- _xid = xid;
-// return init(argc, argv);
- return false;
-}
-
-// what is this function for ?
-bool
-Gui::createWindow(int xid, int /*width*/, int /*height*/)
-{
-// GNASH_REPORT_FUNCTION;
- _xid = xid;
-// return createWindow(width, height);
- return false;
-}
-
Gui::~Gui()
{
// GNASH_REPORT_FUNCTION;
@@ -212,11 +191,9 @@
}
bool
-Gui::advance_movie(void *data)
+Gui::advance_movie(Gui* gui)
{
// GNASH_REPORT_FUNCTION;
-
- Gui *gui = reinterpret_cast<Gui*> (data);
gnash::movie_interface* m = gnash::get_current_root();
m->advance(1.0);
Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- gui/gui.h 6 Oct 2006 21:47:04 -0000 1.16
+++ gui/gui.h 9 Oct 2006 13:47:44 -0000 1.17
@@ -57,56 +57,77 @@
namespace gnash
{
-typedef bool (*callback_t)(void*);
-typedef enum {IDLE_MOVIE = 0, PLAY_MOVIE = 1, RESTART_MOVIE, PAUSE_MOVIE,
STOP_MOVIE, STEP_FORWARD, STEP_BACKWARD, JUMP_FORWARD, JUMP_BACKWARD,
QUIT_MOVIE} movie_state_e;
-
-extern const char *GNASH;
-extern movie_state_e menu_state;
-
-
+/// Parent class from which all GUI implementations will depend.
class DSOEXPORT Gui {
public:
+ /// Default constructor. Initialises members to safe defaults.
Gui();
- Gui(unsigned long xid, float scale, bool loop, unsigned int depth);
- virtual ~Gui();
- /// Initialize the gui and the associated renderer
- bool init(int xid, int argc, char **argv[]);
+ /**
+ * Expanded constructor for more control over member values.
+ *
+ * @param xid The X11 Window ID to attach to. If this is argument is zero,
+ * a new window is created.
+ *
+ * @param scale The scale used to resize the window.
+ *
+ * @param loop Defines whether or not the movie should be played once or
+ * looped indefinitely.
+ *
+ * @param depth Colour depth to be used in the client area of our window.
+ */
+ Gui(unsigned long xid, float scale, bool loop, unsigned int depth);
- bool createWindow(int xid, int width, int height);
+ virtual ~Gui();
+ /**
+ * Initialise the gui and the associated renderer.
+ *
+ * @param argc The commandline argument count.
+ * @param argv The commandline arguments.
+ */
virtual bool init(int argc, char **argv[]) = 0;
- /// Set main loop delay in milliseconds. @@ should rename to setDelay
- virtual void setCallback(unsigned int interval) = 0;
+ /// Set main loop delay in milliseconds.
+ virtual void setInterval(unsigned int interval) = 0;
+ /// Set the time in milliseconds after which the programme should exit.
virtual void setTimeout(unsigned int timeout) = 0;
- /// Create a window of given size. @@ shoudn't we use unsigned ints ?
- virtual bool createWindow(int width, int height) = 0;
-
- /// Create a window of given size with given title.
- //
- /// Default implementation discards title and calls the above version
- ///
- virtual bool createWindow(const char* /*title*/, int width, int height) {
- return createWindow(width, height);
- }
+ /**
+ * Create and display our window.
+ * @param title The window title.
+ * @param width The window width in pixels.
+ * @param height The window height in pixels.
+ */
+ virtual bool createWindow(const char* title, int width, int height) = 0;
+ /// Start main rendering loop.
virtual bool run(void *) = 0;
+
+ /// Create a menu and attach it to our window.
virtual bool createMenu() = 0;
+
+ /// Register event handlers.
virtual bool setupEvents() = 0;
- virtual void renderBuffer() = 0;
+ /// Render the current buffer. For OpenGL, this means that the buffer is
+ /// swapped.
+ virtual void renderBuffer() = 0;
+ /// @return The value to which the movie width should be scaled.
float getXScale() { return _xscale; }
+
+ /// @return The value to which the movie height shold be scaled.
float getYScale() { return _yscale; }
- bool loops() { return _loop; }
- void addMouseHandler(callback_t ptr);
- void addKeyboardHandler(callback_t ptr);
- void setXembed(int xid);
+ /// @return Whether or not the movie should be looped indefinitely.
+ bool loops() { return _loop; }
+ /** @name Menu callbacks
+ * These callbacks will be called when a menu item is clicked.
+ * @{
+ */
static void menu_restart();
static void menu_quit();
static void menu_play();
@@ -116,23 +137,44 @@
static void menu_step_backward();
static void menu_jump_forward();
static void menu_jump_backward();
+ /// @}
+
+ /// Mouse notification callback to be called when the mouse is moved.
+ /// @param x The mouse coordinate X component in pixels.
+ /// @param y The mouse coordinate Y component in pixels.
static void notify_mouse_moved(int x, int y);
+
+ /// Mouse notification callback to be called when the mouse is clicked.
+ /// @param mouse_pressed Determines whether the mouse button is being
+ /// pressed (true) or being released (false)
+ /// @param mask A binary representation of the buttons currently pressed.
static void notify_mouse_clicked(bool mouse_pressed, int mask);
- static bool advance_movie(void *data);
+
+ /// Advances the movie to the next frame. This is to take place after the
+ /// interval specified in the call to setInterval().
+ static bool advance_movie(Gui* gui);
+
+ /// Resize the client area view and the window accordingly.
void resize_view(int width, int height);
protected:
+ /// Determines if playback should restart after the movie ends.
bool _loop;
+ /// The X Window ID to attach to. If zero, we create a new window.
unsigned long _xid;
+ /// Desired window width.
int _width;
+ /// Desired window height.
int _height;
+ /// The window width scale.
float _xscale;
+ /// The window height scale.
float _yscale;
+ /// Desired colour depth in bits.
int _depth;
- std::string _name;
- callback_t _mouse_handler;
- callback_t _heyboard_handler;
+ /// Main loop interval: the time between successive advance_movie calls.
unsigned int _interval;
+ /// The handler which is called to update the client area of our window.
render_handler* _renderer;
};
Index: gui/kde.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/kde.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- gui/kde.cpp 25 Aug 2006 14:21:11 -0000 1.4
+++ gui/kde.cpp 9 Oct 2006 13:47:44 -0000 1.5
@@ -152,7 +152,7 @@
}
void
-KdeGui::setCallback(unsigned int interval)
+KdeGui::setInterval(unsigned int interval)
{
// GNASH_REPORT_FUNCTION;
_interval = interval;
Index: gui/kdesup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/kdesup.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- gui/kdesup.h 14 Sep 2006 23:54:22 -0000 1.5
+++ gui/kdesup.h 9 Oct 2006 13:47:44 -0000 1.6
@@ -83,7 +83,7 @@
virtual bool createMenu();
virtual bool setupEvents();
virtual void renderBuffer();
- virtual void setCallback(unsigned int interval);
+ virtual void setInterval(unsigned int interval);
virtual void setTimeout(unsigned int timeout);
#if defined(RENDERER_OPENGL) && defined(FIX_I810_LOD_BIAS)
virtual void setLodBias(float tex_lod_bias);
Index: gui/sdl.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/sdl.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- gui/sdl.cpp 6 Oct 2006 21:47:04 -0000 1.29
+++ gui/sdl.cpp 9 Oct 2006 13:47:44 -0000 1.30
@@ -35,7 +35,7 @@
//
//
-/* $Id: sdl.cpp,v 1.29 2006/10/06 21:47:04 strk Exp $ */
+/* $Id: sdl.cpp,v 1.30 2006/10/09 13:47:44 bjacques Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -90,7 +90,6 @@
SDLGui::SDLGui(unsigned long xid, float scale, bool loop, unsigned int depth)
: Gui(xid, scale, loop, depth),
_timeout(0),
- _func(advance_movie),
_core_trap(true)
{
@@ -181,7 +180,7 @@
}
}
- if ( _func ) _func(this);
+ Gui::advance_movie(this);
int delay = _interval - (SDL_GetTicks() - start_tick);
if (delay < 0)
@@ -268,7 +267,10 @@
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1);
}
#endif // RENDERER_OPENGL
+#if 0
+ // So this is currently unused. We may want to do so.
_name = basename(*argv[0]);
+#endif
return false;
}
@@ -327,6 +329,27 @@
renderer::cairo::set_handle(_cairo_handle);
#elif defined (RENDERER_OPENGL)
+ // Turn on alpha blending.
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ // Turn on line smoothing. Antialiased lines can be used to
+ // smooth the outsides of shapes.
+ glEnable(GL_LINE_SMOOTH);
+ glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); // GL_NICEST, GL_FASTEST,
GL_DONT_CARE
+ glMatrixMode(GL_PROJECTION);
+
+#define OVERSIZE 1.0f
+ glOrtho(-OVERSIZE, OVERSIZE, OVERSIZE, -OVERSIZE, -1, 1);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+
+ // We don't need lighting effects
+ glDisable(GL_LIGHTING);
+ // glColorPointer(4, GL_UNSIGNED_BYTE, 0, *);
+// glInterleavedArrays(GL_T2F_N3F_V3F, 0, *);
+ glPushAttrib (GL_ALL_ATTRIB_BITS);
+
# ifdef FIX_I810_LOD_BIAS
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT,
_tex_lod_bias);
# endif
@@ -368,7 +391,7 @@
}
void
-SDLGui::setCallback(unsigned int interval)
+SDLGui::setInterval(unsigned int interval)
{
_interval = interval;
}
Index: gui/sdlsup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/sdlsup.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- gui/sdlsup.h 23 Sep 2006 15:06:53 -0000 1.13
+++ gui/sdlsup.h 9 Oct 2006 13:47:44 -0000 1.14
@@ -68,15 +68,14 @@
virtual bool createMenu();
virtual bool setupEvents();
virtual void renderBuffer();
- virtual void setCallback(unsigned int interval);
+ virtual void setInterval(unsigned int interval);
virtual void disableCoreTrap();
virtual void setTimeout(unsigned int timeout);
void key_event(SDLKey key, bool down);
private:
- unsigned int _interval, _timeout;
- callback_t _func;
+ unsigned int _timeout;
SDL_Surface *_screen;
#ifdef RENDERER_CAIRO
cairo_surface_t *_cairo_surface;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog gui/NullGui.h gui/Player.cpp gu...,
Bastiaan Jacques <=