gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash/plugin/win32 npgnash.rc npgnash_resource....


From: Vitaly Alexeev
Subject: [Gnash-commit] gnash/plugin/win32 npgnash.rc npgnash_resource....
Date: Sun, 06 Aug 2006 19:02:14 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Vitaly Alexeev <alexeev>        06/08/06 19:02:14

Added files:
        plugin/win32   : npgnash.rc npgnash_resource.h player.cpp 
                         player.h plugin.cpp plugin.h 

Log message:
        win32 firefox plugin stuff

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/plugin/win32/npgnash.rc?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/plugin/win32/npgnash_resource.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/plugin/win32/player.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/plugin/win32/player.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/plugin/win32/plugin.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/plugin/win32/plugin.h?cvsroot=gnash&rev=1.1

Patches:
Index: npgnash.rc
===================================================================
RCS file: npgnash.rc
diff -N npgnash.rc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ npgnash.rc  6 Aug 2006 19:02:14 -0000       1.1
@@ -0,0 +1,105 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "npgnash_resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Russian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
+#ifdef _WIN32
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
+#pragma code_page(1251)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE 
+BEGIN
+    "resource1.h\0"
+END
+
+2 TEXTINCLUDE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904e4"
+        BEGIN
+            VALUE "CompanyName", " "
+            VALUE "FileDescription", "npgnash"
+            VALUE "FileExtents", "swf"
+            VALUE "FileOpenName", "npgnash"
+            VALUE "FileVersion", "1, 0, 0, 1"
+            VALUE "InternalName", "npgnash"
+            VALUE "LegalCopyright", "GNU"
+            VALUE "MIMEType", "application/x-shockwave-flash"
+            VALUE "OriginalFilename", "npgnash.dll"
+            VALUE "ProductName", "Gnash Plugin for Mozilla"
+            VALUE "ProductVersion", "1, 0, 0, 1"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1252
+    END
+END
+
+#endif    // Russian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+

Index: npgnash_resource.h
===================================================================
RCS file: npgnash_resource.h
diff -N npgnash_resource.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ npgnash_resource.h  6 Aug 2006 19:02:14 -0000       1.1
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by npgnash.rc
+//
+#define xxxxx                           101
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        101
+#define _APS_NEXT_COMMAND_VALUE         40001
+#define _APS_NEXT_CONTROL_VALUE         1001
+#define _APS_NEXT_SYMED_VALUE           102
+#endif
+#endif

Index: player.cpp
===================================================================
RCS file: player.cpp
diff -N player.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ player.cpp  6 Aug 2006 19:02:14 -0000       1.1
@@ -0,0 +1,289 @@
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// Linking Gnash statically or dynamically with other modules is making a
+// combined work based on Gnash. Thus, the terms and conditions of the GNU
+// General Public License cover the whole combination.
+//
+// As a special exception, the copyright holders of Gnash give you
+// permission to combine Gnash with free software programs or libraries
+// that are released under the GNU LGPL and with code included in any
+// release of Talkback distributed by the Mozilla Foundation. You may
+// copy and distribute such a system following the terms of the GNU GPL
+// for all but the LGPL-covered parts and Talkback, and following the
+// LGPL for the LGPL-covered parts.
+//
+// Note that people who make modified versions of Gnash are not obligated
+// to grant this special exception for their modified versions; it is their
+// choice whether to do so. The GNU General Public License gives permission
+// to release a modified version without this exception; this exception
+// also makes it possible to release a modified version which carries
+// forward this exception.
+// 
+//
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+// This has to be defined or we have typedef problems with Mozilla's
+// headers for 64 bit types. According the the header file, the fix is
+// to define this constant to turn off the older behaviour that we
+// don't care about.
+#define NO_NSPR_10_SUPPORT
+
+#      include <SDL.h>
+#      include "URL.h"
+
+#include "tu_file.h"
+#include "xmlsocket.h"
+#include "ogl.h"
+
+// Mozilla SDK headers
+#include "prinit.h"
+#include "plugin.h"
+#include "prlock.h"
+#include "prcvar.h"
+#include "prthread.h"
+
+#include <GL/gl.h>
+
+using namespace std;
+using namespace gnash;
+
+#define OVERSIZE       1.0f
+
+static float   s_scale = 1.0f;
+static bool    s_verbose = false;
+static bool    s_background = true;
+
+PRLock* s_ogl = NULL;
+
+static void
+message_log(const char* message)
+// Process a log message.
+{
+    if (s_verbose) {
+       fputs(message, stdout);
+        fflush(stdout); // needed on osx for some reason
+    }
+}
+
+static tu_file*
+file_opener(const char* url)
+// Callback function.  This opens files for the library.
+{
+    return new tu_file(url, "rb");
+}
+
+static void
+fs_callback(gnash::movie_interface* movie, const char* command, const char* 
args)
+// For handling notification callbacks from ActionScript.
+{
+    message_log("fs_callback: '"); // __GNASH_PLAYER_H__
+    message_log(command);
+    message_log("' '");
+    message_log(args);
+    message_log("'\n");
+}
+
+
+// Enable OpenGL
+void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC)
+{
+       PIXELFORMATDESCRIPTOR pfd;
+       int format;
+       
+       // get the device context (DC)
+       *hDC = GetDC( hWnd );
+       
+       // set the pixel format for the DC
+       ZeroMemory( &pfd, sizeof( pfd ) );
+       pfd.nSize = sizeof( pfd );
+       pfd.nVersion = 1;
+       pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | 
PFD_DOUBLEBUFFER;
+       pfd.iPixelType = PFD_TYPE_RGBA;
+       pfd.cColorBits = 24;
+       pfd.cDepthBits = 16;
+       pfd.iLayerType = PFD_MAIN_PLANE;
+       format = ChoosePixelFormat( *hDC, &pfd );
+       SetPixelFormat( *hDC, format, &pfd );
+       
+       // create and enable the render context (RC)
+       *hRC = wglCreateContext( *hDC );
+       wglMakeCurrent( *hDC, *hRC );
+}
+
+// Disable OpenGL
+void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC)
+{
+       wglMakeCurrent( NULL, NULL );
+       wglDeleteContext( hRC );
+       ReleaseDC( hWnd, hDC );
+}
+
+int
+main_loop(nsPluginInstance *inst)
+{
+       PR_Lock(s_ogl);
+
+       HWND hWnd = (HWND) inst->getWindow();
+       HDC hDC;
+       HGLRC hRC;
+       EnableOpenGL( hWnd, &hDC, &hRC );
+
+       assert(tu_types_validate());
+       bool    do_sound = false;
+       int             delay = 100;    // was 31
+
+       gnash::register_fscommand_callback(fs_callback);
+    
+       gnash::render_handler *render = gnash::create_render_handler_ogl();
+       gnash::set_render_handler(render);
+
+       gnash::sound_handler  *sound = NULL;
+#ifdef SOUND_SDL
+       if (do_sound)
+       {
+               sound = gnash::create_sound_handler_sdl();
+               gnash::set_sound_handler(sound);
+       }
+#endif
+
+    // Get info about the width & height of the movie.
+       int     movie_version = 0;
+       int     movie_width = 0;
+       int     movie_height = 0;
+       float movie_fps = 30.0f;
+       gnash::get_movie_info(URL(inst->getFilename()), &movie_version, 
&movie_width, &movie_height, &movie_fps, NULL, NULL);
+       if (movie_version == 0)
+       {
+               dbglogfile << "error: can't get info about " << 
inst->getFilename() << endl;
+    return -1;
+       }
+       log_msg("Movie %s: width is %d, height is %d, version is %d\n", 
inst->getFilename(),
+       movie_width, movie_height, movie_version);
+
+       // Load the actual movie.
+       gnash::movie_definition*        md = 
gnash::create_library_movie(URL(inst->getFilename()));
+       if (md == NULL)
+       {
+               dbglogfile << "error: can't create a movie from " << 
inst->getFilename() << endl;
+               return -1;
+       }
+
+       gnash::movie_interface* m = create_library_movie_inst(md);
+       if (m == NULL)
+       {
+               dbglogfile << "error: can't create movie instance" << endl;
+               return -1;
+       }
+       gnash::set_current_root(m);
+
+       uint32_t        start_ticks = 0;
+       start_ticks = SDL_GetTicks();
+       uint32_t        last_ticks = start_ticks;
+
+       for (;;)
+       {
+       
+               uint32_t        ticks;
+               ticks = SDL_GetTicks();
+               int     delta_ticks = ticks - last_ticks;
+               float   delta_t = delta_ticks / 1000.f;
+               last_ticks = ticks;
+
+               m = gnash::get_current_root();
+               gnash::delete_unused_root();
+
+               // to place on the center
+               int window_width = inst->getWidth();
+               int window_height = inst->getHeight();
+               float xscale = (float) window_width / (float) movie_width;
+               float yscale = (float) window_height / (float) movie_height;
+               s_scale = min(xscale, yscale);
+    int width = int(movie_width * s_scale);
+    int height = int(movie_height * s_scale);
+       
+               int mouse_x = inst->mouse_x - ((window_width - width) >> 1);
+               mouse_x = int(mouse_x / s_scale);
+               int mouse_y = inst->mouse_y - ((window_height - height) >> 1);
+               mouse_y = int(mouse_y / s_scale);
+               if (mouse_x >= 0 && mouse_y >= 0)
+               {
+                       m->notify_mouse_state(mouse_x, mouse_y, 
inst->mouse_buttons);    
+               }
+
+               m->set_display_viewport(window_width - width >> 1, 
window_height - height >> 1, width, height);
+               m->set_background_alpha(s_background ? 1.0f : 0.05f);
+               glDisable(GL_DEPTH_TEST);       // Disable depth testing.
+               glDrawBuffer(GL_BACK);
+
+               m->advance(delta_t);
+
+               // white background
+               glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
+               glClear(GL_COLOR_BUFFER_BIT);   
+
+               m->display();
+               SwapBuffers(hDC);
+
+               // nsPluginInstance::shut() has been called for this instance.
+               if (inst->getShutdown())
+               {
+                       dbglogfile << "player: Shutting down as requested..." 
<< endl;
+           break;
+               }
+       
+               // Don't hog the CPU.
+               PR_Unlock(s_ogl);
+               PR_Sleep(5);
+               PR_Lock(s_ogl);
+       }
+
+       if (m)
+       {
+               m->drop_ref();
+       }
+    
+       delete sound;
+       delete render;
+       
+       // Clean up as much as possible, so valgrind will help find actual 
leaks.
+       gnash::clear();
+
+       // shutdown OpenGL
+       DisableOpenGL( hWnd, hDC, hRC );
+
+       PR_Unlock(s_ogl);
+       return 0;
+}
+
+void playerThread(void *arg)
+{
+       nsPluginInstance *inst = (nsPluginInstance *)arg;    
+       log_trace("%s: instance is %p for %s\n", __PRETTY_FUNCTION__, inst,
+       inst->getFilename());
+   
+       main_loop(inst);
+
+       log_msg("%s: Done this = %p...\n", __PRETTY_FUNCTION__, inst);
+}
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:

Index: player.h
===================================================================
RCS file: player.h
diff -N player.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ player.h    6 Aug 2006 19:02:14 -0000       1.1
@@ -0,0 +1,45 @@
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// Linking Gnash statically or dynamically with other modules is making a
+// combined work based on Gnash. Thus, the terms and conditions of the GNU
+// General Public License cover the whole combination.
+//
+// As a special exception, the copyright holders of Gnash give you
+// permission to combine Gnash with free software programs or libraries
+// that are released under the GNU LGPL and with code included in any
+// release of Talkback distributed by the Mozilla Foundation. You may
+// copy and distribute such a system following the terms of the GNU GPL
+// for all but the LGPL-covered parts and Talkback, and following the
+// LGPL for the LGPL-covered parts.
+//
+// Note that people who make modified versions of Gnash are not obligated
+// to grant this special exception for their modified versions; it is their
+// choice whether to do so. The GNU General Public License gives permission
+// to release a modified version without this exception; this exception
+// also makes it possible to release a modified version which carries
+// forward this exception.
+// 
+//
+
+#ifndef __GNASH_PLAYER_H__
+#define __GNASH_PLAYER_H__
+
+int main_loop(nsPluginInstance *inst);
+void playerThread(void *inst);
+
+// EOF of __GNASH_PLAYER_H__
+#endif

Index: plugin.cpp
===================================================================
RCS file: plugin.cpp
diff -N plugin.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ plugin.cpp  6 Aug 2006 19:02:14 -0000       1.1
@@ -0,0 +1,209 @@
+ #include <windows.h>
+ #include <windowsx.h>
+ 
+#include "plugin.h"
+#include "player.h"
+
+#include "log.h"
+
+using namespace std;
+using namespace gnash; 
+
+extern PRLock* s_ogl;
+
+// general initialization and shutdown
+NPError NS_PluginInitialize()
+{
+       s_ogl = PR_NewLock();
+       assert(s_ogl);
+       dbglogfile << "NS_PluginInitialize " << endl;
+       return NPERR_NO_ERROR;
+}
+ 
+void NS_PluginShutdown()
+{
+  if (s_ogl)
+       {
+               PR_DestroyLock(s_ogl);
+               s_ogl = NULL;
+       }
+       dbglogfile << "NS_PluginShutdown " << endl;
+}
+ 
+ // construction and destruction of our plugin instance object
+nsPluginInstanceBase * NS_NewPluginInstance(nsPluginCreateData * 
aCreateDataStruct)
+{
+       dbglogfile << "NS_NewPluginInstance " << endl;
+       if (!aCreateDataStruct)
+       {
+               return NULL;
+       }
+ 
+       nsPluginInstance * plugin = new 
nsPluginInstance(aCreateDataStruct->instance);
+       return plugin;
+}
+ 
+void NS_DestroyPluginInstance(nsPluginInstanceBase * aPlugin)
+{
+       dbglogfile << "NS_DestroyPluginInstance " << endl;
+       if (aPlugin)
+       {
+               delete (nsPluginInstance *)aPlugin;
+       }
+}
+ 
+ // nsPluginInstance class implementation
+nsPluginInstance::nsPluginInstance(NPP aInstance) : nsPluginInstanceBase(),
+       mInstance(aInstance),
+       mInitialized(FALSE),
+       m_swf_file(""),
+       m_thread(NULL),
+       m_shutdown(FALSE),
+       mouse_x(0),
+       mouse_y(0),
+       mouse_buttons(0)
+{
+       dbglogfile << "nsPluginInstance " << endl;
+       mhWnd = NULL;
+}
+ 
+nsPluginInstance::~nsPluginInstance()
+{
+       dbglogfile << "~nsPluginInstance " << endl;
+}
+ 
+ static LRESULT CALLBACK PluginWinProc(HWND, UINT, WPARAM, LPARAM);
+ static WNDPROC lpOldProc = NULL;
+ 
+NPBool nsPluginInstance::init(NPWindow* aWindow)
+{
+       dbglogfile << "***init*** " << aWindow << endl;
+
+       if (aWindow == NULL)
+       {
+               return FALSE;
+       }
+ 
+       mX = aWindow->x;
+       mY = aWindow->y;
+       mWidth = aWindow->width;
+       mHeight = aWindow->height; 
+
+       if (mhWnd == (HWND) aWindow->window)
+       {
+               return true;
+       }
+
+       mhWnd = (HWND) aWindow->window;
+
+  // subclass window so we can intercept window messages and
+  // do our drawing to it
+  lpOldProc = SubclassWindow(mhWnd, (WNDPROC)PluginWinProc);
+ 
+  // associate window with our nsPluginInstance object so we can access 
+  // it in the window procedure
+  SetWindowLong(mhWnd, GWL_USERDATA, (LONG)this);
+ 
+  mInitialized = TRUE;
+  return TRUE;
+}
+
+
+uint16 nsPluginInstance::HandleEvent(void* event)
+{
+       dbglogfile << "event" << endl;
+       return 0;
+}
+NPError nsPluginInstance::SetWindow(NPP instance, NPWindow* window)
+{
+       dbglogfile << "SetWindow" << endl;
+       return NPERR_NO_ERROR;
+}
+
+NPError nsPluginInstance::NewStream(NPMIMEType type, NPStream * stream,
+                            NPBool seekable, uint16 * stype)
+{
+       dbglogfile << "NewStream" << stream->url << endl;
+       return NPERR_NO_ERROR;
+}
+
+NPError nsPluginInstance::DestroyStream(NPStream * stream, NPError reason)
+{
+       dbglogfile << "DestroyStream" << stream->url << endl;
+
+       m_swf_file = stream->url;
+       int start = m_swf_file.find("file:///", 0);
+       if (start >= 0)
+       {
+               m_swf_file = stream->url + 8;
+       }
+
+       assert(m_thread == NULL);
+
+       m_thread = PR_CreateThread(PR_USER_THREAD, playerThread, this,
+                             PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
+                             PR_JOINABLE_THREAD, 0);
+
+       return NPERR_NO_ERROR;
+}
+
+void nsPluginInstance::shut()
+{
+       if (m_thread)
+       {
+               dbglogfile << "Waiting for the thread to terminate..." << endl;
+               m_shutdown = true;
+
+               PR_JoinThread(m_thread);
+               m_thread = NULL;
+       }
+
+       // subclass it back
+       SubclassWindow(mhWnd, lpOldProc);
+       mhWnd = NULL;
+       mInitialized = FALSE;
+ }
+ 
+ NPBool nsPluginInstance::isInitialized()
+ {
+   return mInitialized;
+ }
+ 
+ const char * nsPluginInstance::getVersion()
+ {
+   return NPN_UserAgent(mInstance);
+ }
+
+static LRESULT CALLBACK PluginWinProc(HWND hWnd, UINT msg, WPARAM wParam, 
LPARAM lParam)
+{
+       // get our plugin instance object
+       nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLong(hWnd, 
GWL_USERDATA);
+       if (plugin)
+       {
+               switch (msg)
+               {
+                       case WM_MOUSEMOVE:
+                       {
+                               int x = GET_X_LPARAM(lParam); 
+                               int y = GET_Y_LPARAM(lParam); 
+                               plugin->notify_mouse_state(x, y, -1);
+                               break;
+                       }
+
+                       case WM_LBUTTONDOWN:
+                       case WM_LBUTTONUP:
+                       {
+                               int x = GET_X_LPARAM(lParam); 
+                               int y = GET_Y_LPARAM(lParam); 
+                               int     buttons = (msg == WM_LBUTTONDOWN) ? 1 : 
0;
+                               plugin->notify_mouse_state(x, y, buttons);
+                               break;
+                       }
+                       default:
+//                             dbglogfile << "msg " << msg << endl;
+                               break;
+               }
+       }
+       return DefWindowProc(hWnd, msg, wParam, lParam);
+}
+ 

Index: plugin.h
===================================================================
RCS file: plugin.h
diff -N plugin.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ plugin.h    6 Aug 2006 19:02:14 -0000       1.1
@@ -0,0 +1,71 @@
+#ifndef __PLUGIN_H__
+#define __PLUGIN_H__
+ 
+#include "pluginbase.h"
+#include <string>
+
+// Mozilla SDK headers
+#include "prinit.h"
+#include "prlock.h"
+#include "prcvar.h"
+#include "prerr.h"
+#include "prerror.h"
+#include "prthread.h"
+
+class nsPluginInstance : public nsPluginInstanceBase
+{
+       public:
+       nsPluginInstance(NPP aInstance);
+       ~nsPluginInstance();
+ 
+       NPBool init(NPWindow* aWindow);
+       void shut();
+       NPBool isInitialized();
+       uint16 HandleEvent(void* event);
+       NPError SetWindow(NPP instance, NPWindow* window);
+       NPError nsPluginInstance::NewStream(NPMIMEType type, NPStream * stream,
+                            NPBool seekable, uint16 * stype);
+       NPError nsPluginInstance::DestroyStream(NPStream * stream, NPError 
reason);
+
+
+
+       // locals
+       const char* getVersion();
+       HWND getWindow() { return mhWnd; }
+       int getWidth() { return mWidth; };
+       int getHeight() { return mHeight; };
+       const PRThread* getThread() { return m_thread; };
+       const char* getFilename() { return m_swf_file.c_str(); };
+  NPBool getShutdown() { return m_shutdown; };
+       void notify_mouse_state(int x, int y, int buttons)
+       {
+               mouse_x = x;
+               mouse_y = y;
+               if (buttons >= 0)
+               {
+                       mouse_buttons = buttons;
+               }
+       }
+
+       // Mouse state.
+       int     mouse_x;
+       int     mouse_y;
+       int     mouse_buttons;
+ 
+       private:
+
+       NPP mInstance;
+       NPBool mInitialized;
+       HWND mhWnd;
+       int mX;
+       int mY;
+       unsigned int mWidth;
+       unsigned int mHeight;
+       std::string m_swf_file;
+       PRThread* m_thread;
+       NPBool m_shutdown;
+
+ };
+ 
+ #endif // __PLUGIN_H__
+ 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]