Plugin DK, not part of the build, hopefully no duplicate files this time.

git-svn-id: svn://10.0.0.236/trunk@69270 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
av%netscape.com
2000-05-11 22:13:06 +00:00
parent 95ba8ef614
commit f77c154953
34 changed files with 3154 additions and 0 deletions

View File

@@ -0,0 +1,159 @@
# Microsoft Developer Studio Project File - Name="basic" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=basic - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "basic.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "basic.mak" CFG="basic - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "basic - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "basic - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "basic - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "basic___Win32_Release"
# PROP BASE Intermediate_Dir "basic___Win32_Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BASIC_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\include" /I "..\..\mozilla\include" /I "..\..\mozilla\release\include" /D "XP_PC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BASIC_EXPORTS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 ..\..\mozilla\release\lib\xpcom.lib kernel32.lib user32.lib gdi32.lib /nologo /dll /machine:I386
!ELSEIF "$(CFG)" == "basic - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "basic___Win32_Debug"
# PROP BASE Intermediate_Dir "basic___Win32_Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BASIC_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\..\mozilla\include" /I "..\..\mozilla\debug\include" /D "DEBUG" /D "XP_PC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BASIC_EXPORTS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 ..\..\mozilla\debug\lib\xpcom.lib kernel32.lib user32.lib gdi32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "basic - Win32 Release"
# Name "basic - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\common\dbg.cpp
# End Source File
# Begin Source File
SOURCE=..\common\instbase.cpp
# End Source File
# Begin Source File
SOURCE=.\instwin.cpp
# End Source File
# Begin Source File
SOURCE=..\common\listener.cpp
# End Source File
# Begin Source File
SOURCE=..\common\npentry.cpp
# End Source File
# Begin Source File
SOURCE=..\common\plugin.cpp
# End Source File
# Begin Source File
SOURCE=.\winentry.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\include\basiccid.h
# End Source File
# Begin Source File
SOURCE=..\include\dbg.h
# End Source File
# Begin Source File
SOURCE=..\include\instbase.h
# End Source File
# Begin Source File
SOURCE=.\instwin.h
# End Source File
# Begin Source File
SOURCE=..\include\listener.h
# End Source File
# Begin Source File
SOURCE=..\include\plugin.h
# End Source File
# Begin Source File
SOURCE=..\include\xplat.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "basic"=.\basic.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,220 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
*/
/**********************************************************************
*
* instwin.cpp
*
* Implementation of the plugin instance class for Windows
*
***********************************************************************/
#include <windows.h>
#include <windowsx.h>
#include "instwin.h"
#include "dbg.h"
CPluginInstance * Platform_CreatePluginInstance(nsISupports *aOuter, REFNSIID aIID, const char* aPluginMIMEType)
{
CPluginInstanceWin *inst = new CPluginInstanceWin();
return (CPluginInstance *)inst;
}
/*------------------------------------
* CPluginInstanceWin implementation
*-----------------------------------*/
CPluginInstanceWin::CPluginInstanceWin() : CPluginInstance()
{
dbgOut1("CPluginInstanceWin::CPluginInstanceWin");
platform = nsnull;
}
CPluginInstanceWin::~CPluginInstanceWin()
{
dbgOut1("CPluginInstanceWin::~CPluginInstanceWin");
}
nsresult CPluginInstanceWin::PlatformNew()
{
dbgOut1("CPluginInstanceWin::PlatformNew");
platform = new CPlatformWin();
if(platform == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
nsresult CPluginInstanceWin::PlatformDestroy()
{
dbgOut1("CPluginInstanceWin::PlatformDestroy");
if(platform != nsnull)
{
delete platform;
platform = nsnull;
}
return NS_OK;
}
nsresult CPluginInstanceWin::PlatformSetWindow(nsPluginWindow* window)
{
dbgOut1("CPluginInstanceWin::PlatformSetWindow");
if(fWindow == nsnull) // we do not have a window yet
{
// platform should not be initialized if(fWindow == nsnull) but...
if(platform->m_bInitialized)
platform->shut();
if(window == nsnull) // not very meaningful if(fWindow == nsnull)
return NS_OK;
if(window->window != nsnull) // spurious entry
return platform->init(window);
else // First time in
return NS_OK;
}
else // (fWindow != nsnull), we already have a window
{
if((window == nsnull) || (window->window == nsnull)) // window went away
{
if(platform->m_bInitialized)
platform->shut();
return NS_OK;
}
if(!platform->m_bInitialized) // First time in
return platform->init(window);
else
{ // Netscape window has been resized or changed
if(platform->m_hWnd != (HWND)window->window) // changed
{
platform->shut();
return platform->init(window);
}
else // resized?
return NS_OK;
}
}
return NS_OK;
}
PRInt16 CPluginInstanceWin::PlatformHandleEvent(nsPluginEvent* event)
{
dbgOut1("CPluginInstanceWin::PlatformHandleEvent");
return 0;
}
/*------------------------------------
* CPlatformWin implementation
*-----------------------------------*/
static LRESULT CALLBACK PluginWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
CPlatformWin::CPlatformWin() :
m_bInitialized(PR_FALSE),
m_hWnd(nsnull),
m_OldWindowProc(nsnull)
{
dbgOut1("CPlatformWin::CPlatformWin");
}
CPlatformWin::~CPlatformWin()
{
dbgOut1("CPlatformWin::~CPlatformWin");
}
nsresult CPlatformWin::init(nsPluginWindow * window)
{
dbgOut1("CPlatformWin::init");
m_hWnd = (HWND)window->window;
if(!IsWindow(m_hWnd))
return NS_ERROR_UNEXPECTED;
m_OldWindowProc = SubclassWindow(m_hWnd, (WNDPROC)PluginWindowProc);
m_bInitialized = PR_TRUE;
return NS_OK;
}
void CPlatformWin::shut()
{
dbgOut1("CPlatformWin::shut");
if(m_hWnd != nsnull)
{
SubclassWindow(m_hWnd, m_OldWindowProc);
m_OldWindowProc = nsnull;
m_hWnd = nsnull;
}
m_bInitialized = PR_FALSE;
}
/*------------------------------------
* Window message handlers
*-----------------------------------*/
static void onPaint(HWND hWnd)
{
PAINTSTRUCT ps;
HDC hDC = BeginPaint(hWnd, &ps);
HBRUSH hBrush = CreateSolidBrush(RGB(0,255,0));
HBRUSH hBrushOld = SelectBrush(hDC, hBrush);
RECT rc;
GetClientRect(hWnd, &rc);
FillRect(hDC, &rc, hBrush);
SelectBrush(hDC, hBrushOld);
DeleteBrush(hBrush);
EndPaint(hWnd, &ps);
}
static void onDestroyWindow(HWND hWnd)
{
dbgOut1("onDestroyWindow");
}
static LRESULT CALLBACK PluginWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_PAINT:
HANDLE_WM_PAINT(hWnd, wParam, lParam, onPaint);
return 0L;
case WM_DESTROY:
HANDLE_WM_DESTROY(hWnd, wParam, lParam, onDestroyWindow);
break;
default:
break;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
}

View File

@@ -0,0 +1,57 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
*/
#ifndef __INSTWIN_H__
#define __INSTWIN_H__
#include "instbase.h"
class CPlatformWin
{
public:
nsresult init(nsPluginWindow * window);
void shut();
CPlatformWin();
~CPlatformWin();
HWND m_hWnd;
WNDPROC m_OldWindowProc;
PRBool m_bInitialized;
};
class CPluginInstanceWin : public CPluginInstance
{
nsresult PlatformNew();
nsresult PlatformDestroy();
nsresult PlatformSetWindow(nsPluginWindow* window);
PRInt16 PlatformHandleEvent(nsPluginEvent* event);
public:
CPluginInstanceWin();
~CPluginInstanceWin();
CPlatformWin * platform;
};
#endif //__INSTWIN_H__

View File

@@ -0,0 +1,9 @@
<HTML><BODY>
<object type="application/basicplugin-test">alternative text </object>
</BODY></HTML>
<BR>

View File

@@ -0,0 +1,70 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
*/
/*
* Mainly for debug purposes and in case we need a handle
* to application Windows instance
*/
/**********************************************************************
*
* winentry.cpp
*
* Windows entry point. Mainly for debug purposes.
*
***********************************************************************/
#include <windows.h>
#include "dbg.h"
HINSTANCE hInst = NULL;
BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)
{
#ifdef DEBUG
char szReason[80];
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
strcpy(szReason, "DLL_PROCESS_ATTACH");
break;
case DLL_THREAD_ATTACH:
strcpy(szReason, "DLL_THREAD_ATTACH");
break;
case DLL_PROCESS_DETACH:
strcpy(szReason, "DLL_PROCESS_DETACH");
break;
case DLL_THREAD_DETACH:
strcpy(szReason, "DLL_THREAD_DETACH");
break;
}
dbgOut2("DllMain -- %s", szReason);
#endif
hInst = hDLL;
return TRUE;
}