mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
r=mikek, sr=blizzard, a=asa OS/2 only - not part of build - initial code for tester plugin
This commit is contained in:
parent
37cfc9460e
commit
74355fbbed
1
modules/plugin/tools/tester/os2/.cvsignore
Normal file
1
modules/plugin/tools/tester/os2/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
Makefile
|
77
modules/plugin/tools/tester/os2/Makefile.in
Normal file
77
modules/plugin/tools/tester/os2/Makefile.in
Normal file
@ -0,0 +1,77 @@
|
||||
#
|
||||
# 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):
|
||||
# IBM Corp.
|
||||
#
|
||||
|
||||
DEPTH = ../../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = plugin
|
||||
LIBRARY_NAME = npapi
|
||||
RESFILE = npapi.res
|
||||
REQUIRES = java \
|
||||
plugin \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
os2entry.cpp \
|
||||
dlgauto.cpp \
|
||||
dlgman.cpp \
|
||||
dlgtstr.cpp \
|
||||
guihlp.cpp \
|
||||
loadstatus.cpp \
|
||||
os2utils.cpp \
|
||||
plugin.cpp \
|
||||
$(NULL)
|
||||
|
||||
# plugins should always be shared, even in the "static" build
|
||||
FORCE_SHARED_LIB = 1
|
||||
|
||||
NO_DIST_INSTALL = 1
|
||||
NO_INSTALL = 1
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
$(DIST)/lib/$(LIB_PREFIX)plcommon_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(srcdir)/../include \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
install-plugin: $(SHARED_LIBRARY)
|
||||
ifdef SHARED_LIBRARY
|
||||
$(INSTALL) $(SHARED_LIBRARY) $(DIST)/bin/plugins
|
||||
endif
|
||||
|
||||
libs:: install-plugin
|
||||
|
||||
install:: $(SHARED_LIBRARY)
|
||||
ifdef SHARED_LIBRARY
|
||||
$(SYSINSTALL) $(IFLAGS2) $< $(DESTDIR)$(mozappdir)/plugins
|
||||
endif
|
240
modules/plugin/tools/tester/os2/dlgauto.cpp
Normal file
240
modules/plugin/tools/tester/os2/dlgauto.cpp
Normal file
@ -0,0 +1,240 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#define INCL_WIN
|
||||
#include <os2.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include "guihlp.h"
|
||||
#include "plugin.h"
|
||||
#include "scripter.h"
|
||||
#include "logger.h"
|
||||
#include "xp.h"
|
||||
|
||||
extern CLogger * pLogger;
|
||||
static CScripter * pScripter = NULL;
|
||||
|
||||
static void onCommand(HWND hWnd, int id, HWND hWndCtl, USHORT codeNotify)
|
||||
{
|
||||
CPlugin * pPlugin = (CPlugin *)WinQueryWindowULong(hWnd, QWL_USER);
|
||||
if(!pPlugin)
|
||||
return;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case IDC_EDIT_SCRIPT_FILE_NAME:
|
||||
{
|
||||
if(codeNotify != EN_CHANGE)
|
||||
break;
|
||||
char szString[256];
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_SCRIPT_FILE_NAME), sizeof(szString), szString);
|
||||
int iLen = strlen(szString);
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), (iLen > 0));
|
||||
if(iLen <= 0)
|
||||
break;
|
||||
|
||||
// synchronize log filename with current script filename
|
||||
char szLogFileName[256];
|
||||
char * p = strchr(szString, '.');
|
||||
|
||||
if(p != NULL)
|
||||
*p = '\0';
|
||||
|
||||
strcpy(szLogFileName, szString);
|
||||
strcat(szLogFileName, ".log");
|
||||
WinSetWindowText(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_EDIT_LOG_FILE_NAME), szLogFileName);
|
||||
|
||||
pPlugin->updatePrefs(gp_scriptfile, FALSE, szString);
|
||||
|
||||
break;
|
||||
}
|
||||
/*
|
||||
case IDC_BUTTON_STOP:
|
||||
assert(pScripter != NULL);
|
||||
pScripter->setStopAutoExecFlag(TRUE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), TRUE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_STOP), FALSE);
|
||||
break;
|
||||
*/
|
||||
case IDC_BUTTON_GO:
|
||||
{
|
||||
pLogger->blockDumpToFile(FALSE);
|
||||
|
||||
//WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), FALSE);
|
||||
//WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_STOP), TRUE);
|
||||
//UpdateWindow(WinWindowFromID(hWnd, IDC_BUTTON_STOP));
|
||||
EnableWindowNow(WinWindowFromID(hWnd, IDC_BUTTON_GO), FALSE);
|
||||
|
||||
EnableWindowNow(WinWindowFromID(hWnd, IDC_EDIT_SCRIPT_FILE_NAME), FALSE);
|
||||
EnableWindowNow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_EDIT_LOG_FILE_NAME), FALSE);
|
||||
EnableWindowNow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_CHECK_SHOW_LOG), FALSE);
|
||||
EnableWindowNow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_CHECK_LOG_TO_FRAME), FALSE);
|
||||
EnableWindowNow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_CHECK_LOG_TO_FILE), FALSE);
|
||||
BOOL bFlashWasEnabled = FALSE;
|
||||
if(WinIsWindowEnabled(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_BUTTON_FLUSH)))
|
||||
{
|
||||
bFlashWasEnabled = TRUE;
|
||||
EnableWindowNow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_BUTTON_FLUSH), FALSE);
|
||||
}
|
||||
EnableWindowNow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_BUTTON_CLEAR), FALSE);
|
||||
EnableWindowNow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_RADIO_MODE_MANUAL), FALSE);
|
||||
EnableWindowNow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_RADIO_MODE_AUTO), FALSE);
|
||||
|
||||
if(pScripter != NULL)
|
||||
delete pScripter;
|
||||
|
||||
pScripter = new CScripter();
|
||||
pScripter->associate(pPlugin);
|
||||
|
||||
char szFileName[_MAX_PATH];
|
||||
pPlugin ->getModulePath(szFileName, sizeof(szFileName));
|
||||
|
||||
char szFile[_MAX_PATH];
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_SCRIPT_FILE_NAME), sizeof(szFile), szFile);
|
||||
strcat(szFileName, szFile);
|
||||
|
||||
if(pScripter->createScriptFromFile(szFileName))
|
||||
{
|
||||
int iRepetitions = pScripter->getCycleRepetitions();
|
||||
int iDelay = pScripter->getCycleDelay();
|
||||
if(iDelay < 0)
|
||||
iDelay = 0;
|
||||
|
||||
assert(pLogger != NULL);
|
||||
pLogger->resetStartTime();
|
||||
|
||||
ShowWindowNow(WinWindowFromID(hWnd, IDC_STATIC_REPETITIONS_LABEL), TRUE);
|
||||
char szLeft[256];
|
||||
|
||||
for(int i = 0; i < iRepetitions; i++)
|
||||
{
|
||||
sprintf(szLeft, "%i", iRepetitions - i);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_REPETITIONS_LEFT), szLeft);
|
||||
pScripter->executeScript();
|
||||
/*
|
||||
if(pScripter->getStopAutoExecFlag())
|
||||
{
|
||||
pScripter->setStopAutoExecFlag(FALSE);
|
||||
break;
|
||||
}
|
||||
*/
|
||||
if(iDelay != 0)
|
||||
XP_Sleep(iDelay);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WinMessageBox(HWND_DESKTOP, hWnd, "Script file not found or invalid", "", 0, MB_OK | MB_ERROR);
|
||||
}
|
||||
|
||||
delete pScripter;
|
||||
pScripter = NULL;
|
||||
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_REPETITIONS_LEFT), "");
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_REPETITIONS_LABEL), FALSE);
|
||||
|
||||
//WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), TRUE);
|
||||
//WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_STOP), FALSE);
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), TRUE);
|
||||
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_SCRIPT_FILE_NAME), TRUE);
|
||||
WinEnableWindow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_EDIT_LOG_FILE_NAME), TRUE);
|
||||
WinEnableWindow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_CHECK_SHOW_LOG), TRUE);
|
||||
WinEnableWindow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_CHECK_LOG_TO_FRAME), TRUE);
|
||||
WinEnableWindow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_CHECK_LOG_TO_FILE), TRUE);
|
||||
if(bFlashWasEnabled)
|
||||
WinEnableWindow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_BUTTON_FLUSH), TRUE);
|
||||
WinEnableWindow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_BUTTON_CLEAR), TRUE);
|
||||
WinEnableWindow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_RADIO_MODE_MANUAL), TRUE);
|
||||
WinEnableWindow(WinWindowFromID(WinQueryWindow(hWnd, QW_PARENT), IDC_RADIO_MODE_AUTO), TRUE);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, MPARAM mParam)
|
||||
{
|
||||
CPlugin * pPlugin = (CPlugin *)mParam;
|
||||
WinSetWindowPtr(hWnd, QWL_USER, (PVOID)pPlugin);
|
||||
|
||||
int iTopMargin = 188;
|
||||
WinSetWindowPos(hWnd, NULL, 0, iTopMargin, 0, 0, SWP_SHOW );
|
||||
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_SCRIPT_FILE_NAME), pPlugin->m_Pref_szScriptFile);
|
||||
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_REPETITIONS_LEFT), "");
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_REPETITIONS_LABEL), FALSE);
|
||||
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), TRUE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_STOP), FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void onDestroy(HWND hWnd)
|
||||
{
|
||||
if(pScripter != NULL)
|
||||
{
|
||||
delete pScripter;
|
||||
pScripter = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
MRESULT EXPENTRY NP_LOADDS AutoDlgProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case WM_INITDLG:
|
||||
onInitDialog(hWnd, 0, mp2);
|
||||
return (MRESULT)FALSE;
|
||||
case WM_COMMAND:
|
||||
case WM_CONTROL:
|
||||
onCommand(hWnd, SHORT1FROMMP(mp1), 0, SHORT2FROMMP(mp1));
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
onDestroy(hWnd);
|
||||
break;
|
||||
|
||||
default:
|
||||
return WinDefDlgProc(hWnd, msg, mp1, mp2);
|
||||
}
|
||||
return (MRESULT)TRUE;
|
||||
}
|
235
modules/plugin/tools/tester/os2/dlgman.cpp
Normal file
235
modules/plugin/tools/tester/os2/dlgman.cpp
Normal file
@ -0,0 +1,235 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#define INCL_WIN
|
||||
#include <os2.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include "plugin.h"
|
||||
#include "helpers.h"
|
||||
#include "guiprefs.h"
|
||||
#include "os2utils.h"
|
||||
#include "xp.h"
|
||||
|
||||
extern CLogger * pLogger;
|
||||
|
||||
static void onCommand(HWND hWnd, int id, HWND hWndCtl, USHORT codeNotify)
|
||||
{
|
||||
CPlugin * pPlugin = (CPlugin *)WinQueryWindowULong(hWnd, QWL_USER);
|
||||
if (!pPlugin)
|
||||
return;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case IDC_COMBO_API_CALL:
|
||||
if(codeNotify != CBN_LBSELECT)
|
||||
break;
|
||||
updateUI(hWnd);
|
||||
break;
|
||||
case IDC_BUTTON_GO:
|
||||
pLogger->blockDumpToFile(FALSE);
|
||||
onGo(hWnd);
|
||||
break;
|
||||
case IDC_EDIT_ARG1:
|
||||
case IDC_EDIT_ARG2:
|
||||
case IDC_EDIT_ARG3:
|
||||
case IDC_EDIT_ARG4:
|
||||
case IDC_EDIT_ARG5:
|
||||
case IDC_EDIT_ARG6:
|
||||
case IDC_EDIT_ARG7:
|
||||
{
|
||||
if(codeNotify == EN_SETFOCUS)
|
||||
pPlugin->m_hWndLastEditFocus = hWndCtl;
|
||||
|
||||
char szString[80];
|
||||
char szEdit[128];
|
||||
SHORT iIndex = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_API_CALL));
|
||||
LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_API_CALL), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(iIndex), (MPARAM)NULL);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_API_CALL), LM_QUERYITEMTEXT, MPFROM2SHORT(iIndex, 80), (MPARAM)szString);
|
||||
if( ((strcmp(szString, STRING_NPN_POSTURL) == 0) || (strcmp(szString, STRING_NPN_POSTURLNOTIFY) == 0))
|
||||
&& (id == IDC_EDIT_ARG5)
|
||||
&& (codeNotify == EN_CHANGE))
|
||||
{
|
||||
WinQueryWindowText(hWndCtl, sizeof(szEdit), szEdit);
|
||||
int iLength = strlen(szEdit);
|
||||
WinSetDlgItemShort(hWnd, IDC_EDIT_ARG4, iLength, FALSE);
|
||||
}
|
||||
if( ((strcmp(szString, STRING_NPN_WRITE) == 0))
|
||||
&& (id == IDC_EDIT_ARG4)
|
||||
&& (codeNotify == EN_CHANGE))
|
||||
{
|
||||
WinQueryWindowText(hWndCtl, sizeof(szEdit), szEdit);
|
||||
int iLength = strlen(szEdit);
|
||||
WinSetDlgItemShort(hWnd, IDC_EDIT_ARG3, iLength, FALSE);
|
||||
}
|
||||
|
||||
// save values of window size on the fly as we type it
|
||||
if( (strcmp(szString, STRING_NPN_SETVALUE) == 0)
|
||||
&& ((id == IDC_EDIT_ARG3) || (id == IDC_EDIT_ARG4))
|
||||
&& (codeNotify == EN_CHANGE)
|
||||
&& (hWndCtl == WinQueryFocus(HWND_DESKTOP)))
|
||||
{
|
||||
iIndex = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG2));
|
||||
maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG2), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(iIndex), (MPARAM)NULL);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG2), LM_QUERYITEMTEXT, MPFROM2SHORT(iIndex, 80), (MPARAM)szString);
|
||||
if(strcmp(szString, "NPPVpluginWindowSize") == 0)
|
||||
{
|
||||
SHORT bTranslated;
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG3, &bTranslated, TRUE);
|
||||
int iWidth = bTranslated;
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG4, &bTranslated, TRUE);
|
||||
int iHeight = bTranslated;
|
||||
|
||||
if(pPlugin->m_iWidth != iWidth)
|
||||
pPlugin->m_iWidth = iWidth;
|
||||
if(pPlugin->m_iHeight != iHeight)
|
||||
pPlugin->m_iHeight = iHeight;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IDC_COMBO_ARG2:
|
||||
{
|
||||
if(codeNotify != CBN_LBSELECT)
|
||||
break;
|
||||
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG4), FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG4), FALSE);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG3), "*value:");
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), "");
|
||||
|
||||
char szString[80];
|
||||
SHORT iIndex = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_API_CALL));
|
||||
LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_API_CALL), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(iIndex), (MPARAM)NULL);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_API_CALL), LM_QUERYITEMTEXT, MPFROM2SHORT(iIndex, 80), (MPARAM)szString);
|
||||
if(strcmp(szString, STRING_NPN_SETVALUE) == 0)
|
||||
{
|
||||
iIndex = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG2));
|
||||
maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG2), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(iIndex), (MPARAM)NULL);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG2), LM_QUERYITEMTEXT, MPFROM2SHORT(iIndex, 80), (MPARAM)szString);
|
||||
if((strcmp(szString, "NPPVpluginWindowBool") == 0) ||
|
||||
(strcmp(szString, "NPPVpluginTransparentBool") == 0) ||
|
||||
(strcmp(szString, "NPPVpluginKeepLibraryInMemory") == 0))
|
||||
{
|
||||
HWND hWndCombo = WinWindowFromID(hWnd, IDC_COMBO_ARG3);
|
||||
WinSendMsg(hWndCombo, LM_DELETEALL, 0, 0);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "TRUE");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "FALSE");
|
||||
WinSendMsg(hWndCombo, LM_SELECTITEM, (MPARAM)0, (MPARAM)TRUE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG3), FALSE);
|
||||
WinShowWindow(hWndCombo, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG3), TRUE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG3), FALSE);
|
||||
if(strcmp(szString, "NPPVpluginWindowSize") == 0)
|
||||
{
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG4), TRUE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG4), TRUE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG4), TRUE);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG3), "width:");
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG4), "height:");
|
||||
WinSetDlgItemShort(hWnd, IDC_EDIT_ARG3, pPlugin->m_iWidth, TRUE);
|
||||
WinSetDlgItemShort(hWnd, IDC_EDIT_ARG4, pPlugin->m_iHeight, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IDC_BUTTON_PASTE:
|
||||
onPaste(pPlugin->m_hWndLastEditFocus);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, MPARAM lParam)
|
||||
{
|
||||
CPlugin * pPlugin = (CPlugin *)lParam;
|
||||
WinSetWindowULong(hWnd, QWL_USER, (ULONG)pPlugin);
|
||||
|
||||
// look at the last used API call if needed
|
||||
int iSel = 0;
|
||||
if (pPlugin && pPlugin->m_Pref_bRememberLastCall) {
|
||||
char szFileName[_MAX_PATH];
|
||||
GetINIFileName(pPlugin->getInstance(), szFileName, sizeof(szFileName));
|
||||
iSel = XP_GetPrivateProfileInt(SECTION_PREFERENCES, KEY_LAST_API_CALL, 0, szFileName);
|
||||
}
|
||||
fillAPIComboBoxAndSetSel(WinWindowFromID(hWnd, IDC_COMBO_API_CALL), iSel);
|
||||
updateUI(hWnd);
|
||||
|
||||
int iTopMargin = 188;
|
||||
WinSetWindowPos(hWnd, NULL, 0, iTopMargin, 0, 0, SWP_SHOW );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void onDestroy(HWND hWnd)
|
||||
{
|
||||
CPlugin * pPlugin = (CPlugin *)WinQueryWindowULong(hWnd, QWL_USER);
|
||||
if(pPlugin && pPlugin->m_Pref_bRememberLastCall) {
|
||||
// save last API call if needed
|
||||
char szFileName[_MAX_PATH];
|
||||
GetINIFileName(pPlugin->getInstance(), szFileName, sizeof(szFileName));
|
||||
int iSel = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_API_CALL));
|
||||
XP_WritePrivateProfileInt(SECTION_PREFERENCES, KEY_LAST_API_CALL, iSel, szFileName);
|
||||
}
|
||||
}
|
||||
|
||||
MRESULT EXPENTRY NP_LOADDS ManualDlgProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case WM_INITDLG:
|
||||
onInitDialog(hWnd, 0, mp2);
|
||||
return (MRESULT) FALSE;
|
||||
case WM_COMMAND:
|
||||
case WM_CONTROL:
|
||||
onCommand(hWnd, SHORT1FROMMP(mp1), WinWindowFromID(hWnd, SHORT1FROMMP(mp1)), SHORT2FROMMP(mp1));
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
onDestroy(hWnd);
|
||||
break;
|
||||
|
||||
default:
|
||||
return WinDefDlgProc(hWnd, msg, mp1, mp2);
|
||||
}
|
||||
return (MRESULT)TRUE;
|
||||
}
|
189
modules/plugin/tools/tester/os2/dlgtstr.cpp
Normal file
189
modules/plugin/tools/tester/os2/dlgtstr.cpp
Normal file
@ -0,0 +1,189 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
#define INCL_WIN
|
||||
#include <os2.h>
|
||||
|
||||
#include "xp.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include "plugin.h"
|
||||
#include "logger.h"
|
||||
|
||||
extern CLogger * pLogger;
|
||||
|
||||
static void onCommand(HWND hWnd, int id, HWND hWndCtl, USHORT codeNotify)
|
||||
{
|
||||
CPlugin * pPlugin = (CPlugin *)WinQueryWindowULong(hWnd, QWL_USER);
|
||||
if(!pPlugin)
|
||||
return;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case IDC_RADIO_MODE_MANUAL:
|
||||
if((codeNotify == BN_CLICKED) && (WinQueryButtonCheckstate(hWnd, IDC_RADIO_MODE_MANUAL) == BST_CHECKED))
|
||||
{
|
||||
pPlugin->showGUI(sg_manual);
|
||||
pPlugin->updatePrefs(gp_mode, sg_manual);
|
||||
}
|
||||
break;
|
||||
case IDC_EDIT_LOG_FILE_NAME:
|
||||
if(codeNotify == EN_CHANGE)
|
||||
{
|
||||
char szString[256];
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_LOG_FILE_NAME), sizeof(szString), szString);
|
||||
pPlugin->updatePrefs(gp_logfile, FALSE, szString);
|
||||
}
|
||||
case IDC_RADIO_MODE_AUTO:
|
||||
if((codeNotify == BN_CLICKED) && (WinQueryButtonCheckstate(hWnd, IDC_RADIO_MODE_AUTO) == BST_CHECKED))
|
||||
{
|
||||
pPlugin->showGUI(sg_auto);
|
||||
pPlugin->updatePrefs(gp_mode, sg_auto);
|
||||
}
|
||||
break;
|
||||
case IDC_BUTTON_FLUSH:
|
||||
pLogger->clearTarget();
|
||||
pLogger->dumpLogToTarget();
|
||||
break;
|
||||
case IDC_BUTTON_CLEAR:
|
||||
pLogger->clearTarget();
|
||||
pLogger->clearLog();
|
||||
break;
|
||||
break;
|
||||
case IDC_CHECK_LOG_TO_FILE:
|
||||
if(codeNotify == BN_CLICKED)
|
||||
{
|
||||
pPlugin->updatePrefs(gp_tofile, BST_CHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_LOG_TO_FILE));
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_LOG_FILE_NAME), (BST_CHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_LOG_TO_FILE)));
|
||||
pPlugin->onLogToFile(BST_CHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_LOG_TO_FILE));
|
||||
}
|
||||
break;
|
||||
case IDC_CHECK_LOG_TO_FRAME:
|
||||
if(codeNotify == BN_CLICKED)
|
||||
{
|
||||
pPlugin->updatePrefs(gp_toframe, BST_CHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_LOG_TO_FRAME));
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_FLUSH), (BST_UNCHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_SHOW_LOG))
|
||||
&& (BST_CHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_LOG_TO_FRAME)));
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_CLEAR), (BST_CHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_LOG_TO_FRAME)));
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_CHECK_SHOW_LOG), (BST_CHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_LOG_TO_FRAME)));
|
||||
pLogger->setLogToFrameFlag(BST_CHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_LOG_TO_FRAME));
|
||||
}
|
||||
break;
|
||||
case IDC_CHECK_SHOW_LOG:
|
||||
if(codeNotify == BN_CLICKED)
|
||||
{
|
||||
pPlugin->updatePrefs(gp_flush, WinQueryButtonCheckstate(hWnd, IDC_CHECK_SHOW_LOG) == BST_CHECKED);
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_FLUSH), (BST_UNCHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_SHOW_LOG))
|
||||
&& (BST_CHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_LOG_TO_FRAME)));
|
||||
pLogger->setShowImmediatelyFlag(WinQueryButtonCheckstate(hWnd, IDC_CHECK_SHOW_LOG) == BST_CHECKED);
|
||||
}
|
||||
break;
|
||||
case IDC_CHECK_REMEMBER_LAST:
|
||||
if(codeNotify == BN_CLICKED)
|
||||
pPlugin->updatePrefs(gp_rememberlast, WinQueryButtonCheckstate(hWnd, IDC_CHECK_REMEMBER_LAST) == BST_CHECKED);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MRESULT EXPENTRY NP_LOADDS ManualDlgProc(HWND, ULONG, MPARAM, MPARAM);
|
||||
MRESULT EXPENTRY NP_LOADDS AutoDlgProc(HWND, ULONG, MPARAM, MPARAM);
|
||||
|
||||
static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, MPARAM lParam)
|
||||
{
|
||||
CPlugin * pPlugin = (CPlugin *)lParam;
|
||||
|
||||
WinSetWindowULong(hWnd, QWL_USER, (ULONG)pPlugin);
|
||||
|
||||
WinSetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_SHOW );
|
||||
|
||||
HMODULE hInst = pPlugin->getInstance();
|
||||
HWND hWndManual = WinLoadDlg(hWnd, hWnd, (PFNWP)ManualDlgProc, hInst, IDD_DIALOG_MANUAL, (PVOID)pPlugin);
|
||||
HWND hWndAuto = WinLoadDlg(hWnd, hWnd, (PFNWP)AutoDlgProc, hInst, IDD_DIALOG_AUTO, (PVOID)pPlugin);
|
||||
|
||||
WinCheckButton(hWnd, (pPlugin->m_Pref_ShowGUI == sg_manual) ? IDC_RADIO_MODE_MANUAL : IDC_RADIO_MODE_AUTO, BST_CHECKED);
|
||||
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_LOG_FILE_NAME), pPlugin->m_Pref_szLogFile);
|
||||
|
||||
WinCheckButton(hWnd, IDC_CHECK_LOG_TO_FILE, (pPlugin->m_Pref_bToFile) ? BST_CHECKED : BST_UNCHECKED);
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_LOG_FILE_NAME), (BST_CHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_LOG_TO_FILE)));
|
||||
|
||||
WinCheckButton(hWnd, IDC_CHECK_LOG_TO_FRAME, (pPlugin->m_Pref_bToFrame) ? BST_CHECKED : BST_UNCHECKED);
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_CLEAR), (BST_CHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_LOG_TO_FRAME)));
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_CHECK_SHOW_LOG), (BST_CHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_LOG_TO_FRAME)));
|
||||
|
||||
WinCheckButton(hWnd, IDC_CHECK_SHOW_LOG, (pPlugin->m_Pref_bFlushNow) ? BST_CHECKED : BST_UNCHECKED);
|
||||
WinCheckButton(hWnd, IDC_CHECK_REMEMBER_LAST, (pPlugin->m_Pref_bRememberLastCall) ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_FLUSH), (BST_UNCHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_SHOW_LOG))
|
||||
&& (BST_CHECKED == WinQueryButtonCheckstate(hWnd, IDC_CHECK_LOG_TO_FRAME)));
|
||||
|
||||
pPlugin->onInit(hWnd, hWndManual, hWndAuto);
|
||||
|
||||
pPlugin->showGUI(pPlugin->m_Pref_ShowGUI);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void onDestroy(HWND hWnd)
|
||||
{
|
||||
CPlugin * pPlugin = (CPlugin *)WinQueryWindowULong(hWnd, QWL_USER);
|
||||
pPlugin->onDestroy();
|
||||
}
|
||||
|
||||
MRESULT EXPENTRY NP_LOADDS TesterDlgProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case WM_INITDLG:
|
||||
onInitDialog(hWnd, 0, mp2);
|
||||
return (MRESULT) FALSE;
|
||||
case WM_COMMAND:
|
||||
case WM_CONTROL:
|
||||
onCommand(hWnd, SHORT1FROMMP(mp1), 0, SHORT2FROMMP(mp1));
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
onDestroy(hWnd);
|
||||
break;
|
||||
|
||||
default:
|
||||
return WinDefDlgProc(hWnd, msg, mp1, mp2);
|
||||
}
|
||||
return (MRESULT)TRUE;
|
||||
}
|
735
modules/plugin/tools/tester/os2/guihlp.cpp
Normal file
735
modules/plugin/tools/tester/os2/guihlp.cpp
Normal file
@ -0,0 +1,735 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#define INCL_WIN
|
||||
#define INCL_WINLISTBOXES
|
||||
#include <os2.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "xp.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include "guihlp.h"
|
||||
#include "plugin.h"
|
||||
#include "comstrs.h"
|
||||
|
||||
static char szDefaultNPByteRangeList[] = "100-100,200-100,300-100";
|
||||
|
||||
static char szNotImplemented[] = "Currently not implemented";
|
||||
|
||||
void EnableWindowNow(HWND hWnd, BOOL bEnable)
|
||||
{
|
||||
WinEnableWindow(hWnd, bEnable);
|
||||
WinUpdateWindow(hWnd);
|
||||
}
|
||||
|
||||
void ShowWindowNow(HWND hWnd, BOOL iShow)
|
||||
{
|
||||
WinShowWindow(hWnd, iShow);
|
||||
WinUpdateWindow(hWnd);
|
||||
}
|
||||
|
||||
void fillAPIComboBoxAndSetSel(HWND hWndCombo, int iSel)
|
||||
{
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_VERSION);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_GETURL);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_GETURLNOTIFY);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_POSTURL);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_POSTURLNOTIFY);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_REQUESTREAD);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_NEWSTREAM);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_DESTROYSTREAM);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_WRITE);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_STATUS);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_USERAGENT);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_MEMALLOC);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_MEMFREE);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_MEMFLUSH);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_RELOADPLUGINS);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_GETJAVAENV);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_GETJAVAPEER);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_GETVALUE);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_SETVALUE);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_INVALIDATERECT);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_INVALIDATEREGION);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_FORCEREDRAW);
|
||||
|
||||
WinSendMsg(hWndCombo, LM_SELECTITEM, (MPARAM)iSel, (MPARAM)TRUE);
|
||||
}
|
||||
|
||||
static void setStaticTexts7(HWND hWnd, PSZ s1, PSZ s2, PSZ s3, PSZ s4, PSZ s5,PSZ s6, PSZ s7)
|
||||
{
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG1), s1);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG2), s2);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG3), s3);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG4), s4);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG5), s5);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG6), s6);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG7), s7);
|
||||
}
|
||||
|
||||
static void setEditTexts7(HWND hWnd, PSZ s1, PSZ s2, PSZ s3, PSZ s4, PSZ s5,PSZ s6, PSZ s7)
|
||||
{
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG1), s1);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), s2);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), s3);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG4), s4);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG5), s5);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG6), s6);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG7), s7);
|
||||
}
|
||||
|
||||
static void showArgControls7(HWND hWnd, BOOL b1, BOOL b2, BOOL b3, BOOL b4, BOOL b5, BOOL b6, BOOL b7)
|
||||
{
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG1), b1 ? TRUE : FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG2), b2 ? TRUE : FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG3), b3 ? TRUE : FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG4), b4 ? TRUE : FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG5), b5 ? TRUE : FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG6), b6 ? TRUE : FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG7), b7 ? TRUE : FALSE);
|
||||
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG1), b1 ? TRUE : FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG2), b2 ? TRUE : FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG3), b3 ? TRUE : FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG4), b4 ? TRUE : FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG5), b5 ? TRUE : FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG6), b6 ? TRUE : FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG7), b7 ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
static void enableEdits7(HWND hWnd, BOOL b1, BOOL b2, BOOL b3, BOOL b4, BOOL b5, BOOL b6, BOOL b7)
|
||||
{
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG1), b1);
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG2), b2);
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG3), b3);
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG4), b4);
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG5), b5);
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG6), b6);
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG7), b7);
|
||||
}
|
||||
|
||||
static void replaceEditWithCombo(HWND hWnd, BOOL b1, BOOL b2, BOOL b3, BOOL b6)
|
||||
{
|
||||
if(b1)
|
||||
{
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG1), FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG1), TRUE);
|
||||
}
|
||||
if(b2)
|
||||
{
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG2), FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG2), TRUE);
|
||||
}
|
||||
if(b3)
|
||||
{
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG3), FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG3), TRUE);
|
||||
}
|
||||
if(b6)
|
||||
{
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG6), FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG6), TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
#define NS_SAMPLE_URL "http://mozilla.org"
|
||||
|
||||
void updateUI(HWND hWnd)
|
||||
{
|
||||
CPlugin * pPlugin = (CPlugin *)WinQueryWindowULong(hWnd, QWL_USER);
|
||||
assert(pPlugin != NULL);
|
||||
|
||||
ULONG dwNPInstance = (ULONG)pPlugin->getNPInstance();
|
||||
char szNPInstance[16];
|
||||
sprintf(szNPInstance, "%#08lx", dwNPInstance);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_INFO), "");
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_INFO), FALSE);
|
||||
|
||||
setStaticTexts7(hWnd, "","","","","","","");
|
||||
setEditTexts7(hWnd, "","","","","","","");
|
||||
enableEdits7(hWnd, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
|
||||
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), TRUE);
|
||||
|
||||
char szString[80];
|
||||
SHORT iIndex = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_API_CALL));
|
||||
LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_API_CALL), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(iIndex), (MPARAM)NULL);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_API_CALL), LM_QUERYITEMTEXT, MPFROM2SHORT(iIndex, 80), (MPARAM)szString);
|
||||
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), TRUE);
|
||||
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG1), LM_DELETEALL, 0, 0);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG2), LM_DELETEALL, 0, 0);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_DELETEALL, 0, 0);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG6), LM_DELETEALL, 0, 0);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG1), FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG2), FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG3), FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG6), FALSE);
|
||||
|
||||
if(strcmp(szString, STRING_NPN_VERSION) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_GETURL) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "instance:", "URL:", "target (or 'NULL'):", "", "", "", "");
|
||||
setEditTexts7(hWnd, szNPInstance,NS_SAMPLE_URL,"_npapi_Display","","","","");
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_GETURLNOTIFY) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "instance:", "URL:", "target (or 'NULL'):", "notifyData:", "", "", "");
|
||||
setEditTexts7(hWnd, szNPInstance,NS_SAMPLE_URL,"_npapi_Display","0","","","");
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_POSTURL) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE);
|
||||
setStaticTexts7(hWnd, "instance:", "URL:", "target (or 'NULL'):", "len:", "buf:", "file:", "");
|
||||
setEditTexts7(hWnd, szNPInstance,NS_SAMPLE_URL,"_npapi_Display","0","","","");
|
||||
replaceEditWithCombo(hWnd, FALSE, FALSE, FALSE, TRUE);
|
||||
HWND hWndCombo = WinWindowFromID(hWnd, IDC_COMBO_ARG6);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "FALSE");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "TRUE");
|
||||
WinSendMsg(hWndCombo, LM_SELECTITEM, (MPARAM)0, (MPARAM)TRUE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_POSTURLNOTIFY) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
|
||||
enableEdits7(hWnd, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
|
||||
setStaticTexts7(hWnd, "instance:", "URL:", "target (or 'NULL'):", "len:", "buf:", "file:", "notifyData:");
|
||||
setEditTexts7(hWnd, szNPInstance,NS_SAMPLE_URL,"_npapi_Display","0","","","0");
|
||||
replaceEditWithCombo(hWnd, FALSE, FALSE, FALSE, TRUE);
|
||||
HWND hWndCombo = WinWindowFromID(hWnd, IDC_COMBO_ARG6);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "FALSE");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "TRUE");
|
||||
WinSendMsg(hWndCombo, LM_SELECTITEM, (MPARAM)0, (MPARAM)TRUE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_NEWSTREAM) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "instance:", "type:", "target:", "**stream:", "", "", "");
|
||||
char szStream[16];
|
||||
const NPStream * pStream = pPlugin->getNPStream();
|
||||
sprintf(szStream, "%#08lx", &pStream);
|
||||
setEditTexts7(hWnd, szNPInstance,"text/plain","_npapi_Display",szStream,"","","");
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), (pStream != NULL) ? FALSE : TRUE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_REQUESTREAD) == 0)
|
||||
{
|
||||
//serge
|
||||
showArgControls7(hWnd, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "instance:", "URL:", "Range:", "notifyData:", "", "", "");
|
||||
setEditTexts7(hWnd, szNPInstance,NS_SAMPLE_URL,szDefaultNPByteRangeList,"0","","","");
|
||||
/*
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_INFO), TRUE);
|
||||
WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_INFO), szNotImplemented);
|
||||
showArgControls7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
|
||||
*/
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_DESTROYSTREAM) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "instance:", "stream:", "reason:", "", "", "", "");
|
||||
char szStream[16];
|
||||
const NPStream * pStream = pPlugin->getNPStream();
|
||||
sprintf(szStream, "%#08lx", pStream);
|
||||
setEditTexts7(hWnd, szNPInstance,szStream,"","","","","");
|
||||
replaceEditWithCombo(hWnd, FALSE, FALSE, TRUE, FALSE);
|
||||
HWND hWndCombo = WinWindowFromID(hWnd, IDC_COMBO_ARG3);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "NPRES_DONE");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "NPRES_USER_BREAK");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "NPRES_NETWORK_ERR");
|
||||
WinSendMsg(hWndCombo, LM_SELECTITEM, (MPARAM)0, (MPARAM)TRUE);
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), (pStream == NULL) ? FALSE : TRUE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_WRITE) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "instance:", "stream:", "len:", "buf:", "", "", "");
|
||||
char szStream[16];
|
||||
const NPStream * pStream = pPlugin->getNPStream();
|
||||
sprintf(szStream, "%#08lx", pStream);
|
||||
setEditTexts7(hWnd, szNPInstance,szStream,"0","","","","");
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), (pStream == NULL) ? FALSE : TRUE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_STATUS) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "instance:", "message:", "", "", "", "", "");
|
||||
setEditTexts7(hWnd, szNPInstance,"Some message","","","","","");
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_USERAGENT) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "instance:", "", "", "", "", "", "");
|
||||
setEditTexts7(hWnd, szNPInstance,"","","","","","");
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_MEMALLOC) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "size:", "", "", "", "", "", "");
|
||||
setEditTexts7(hWnd, "256","","","","","","");
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), (pPlugin->m_pNPNAlloced == NULL) ? TRUE : FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_MEMFREE) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "ptr:", "", "", "", "", "", "");
|
||||
char szPtr[16];
|
||||
sprintf(szPtr, "%#08lx", pPlugin->m_pNPNAlloced);
|
||||
setEditTexts7(hWnd, szPtr,"","","","","","");
|
||||
WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), (pPlugin->m_pNPNAlloced == NULL) ? FALSE : TRUE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_MEMFLUSH) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "size:", "", "", "", "", "", "");
|
||||
setEditTexts7(hWnd, "256","","","","","","");
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_RELOADPLUGINS) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "reloadPages:", "", "", "", "", "", "");
|
||||
setEditTexts7(hWnd, "","","","","","","");
|
||||
replaceEditWithCombo(hWnd, TRUE, FALSE, FALSE, FALSE);
|
||||
HWND hWndCombo = WinWindowFromID(hWnd, IDC_COMBO_ARG1);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "TRUE");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "FALSE");
|
||||
WinSendMsg(hWndCombo, LM_SELECTITEM, (MPARAM)0, (MPARAM)TRUE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_GETJAVAENV) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_GETJAVAPEER) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "instance:", "", "", "", "", "", "");
|
||||
setEditTexts7(hWnd, szNPInstance,"","","","","","");
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_GETVALUE) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "instance:", "variable:", "", "", "", "", "");
|
||||
setEditTexts7(hWnd, szNPInstance,"","","","","","");
|
||||
replaceEditWithCombo(hWnd, FALSE, TRUE, FALSE, FALSE);
|
||||
HWND hWndCombo = WinWindowFromID(hWnd, IDC_COMBO_ARG2);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "NPNVxDisplay");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "NPNVxtAppContext");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "NPNVnetscapeWindow");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "NPNVjavascriptEnabledBool");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "NPNVasdEnabledBool");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "NPNVisOfflineBool");
|
||||
WinSendMsg(hWndCombo, LM_SELECTITEM, (MPARAM)0, (MPARAM)TRUE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_SETVALUE) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "instance:", "variable:", "*value:", "", "", "", "");
|
||||
setEditTexts7(hWnd, szNPInstance,"","","","","","");
|
||||
replaceEditWithCombo(hWnd, FALSE, TRUE, FALSE, FALSE);
|
||||
HWND hWndCombo = WinWindowFromID(hWnd, IDC_COMBO_ARG2);
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "NPPVpluginNameString");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "NPPVpluginDescriptionString");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "NPPVpluginWindowBool");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "NPPVpluginTransparentBool");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "NPPVpluginWindowSize");
|
||||
WinInsertLboxItem(hWndCombo, LIT_END, "NPPVpluginKeepLibraryInMemory");
|
||||
WinSendMsg(hWndCombo, LM_SELECTITEM, (MPARAM)0, (MPARAM)TRUE);
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_INVALIDATERECT) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "instance:", "top:", "left:", "bottom:", "right:", "", "");
|
||||
setEditTexts7(hWnd, szNPInstance,"0","0","0","0","","");
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_INVALIDATEREGION) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "instance:", "region:", "", "", "", "", "");
|
||||
setEditTexts7(hWnd, szNPInstance,"0","0","0","0","","");
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_FORCEREDRAW) == 0)
|
||||
{
|
||||
showArgControls7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
enableEdits7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
setStaticTexts7(hWnd, "instance:", "", "", "", "", "", "");
|
||||
setEditTexts7(hWnd, szNPInstance,"","","","","","");
|
||||
WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
|
||||
}
|
||||
else
|
||||
assert(0);
|
||||
}
|
||||
|
||||
/*
|
||||
NPByteRange g_npByteRangeList[] = {
|
||||
{100, 100, npByteRangeList + 1},
|
||||
{200, 100, npByteRangeList + 2},
|
||||
{300, 100, 0}
|
||||
};
|
||||
*/
|
||||
|
||||
void onGo(HWND hWnd)
|
||||
{
|
||||
CPlugin * pPlugin = (CPlugin *)WinQueryWindowULong(hWnd, QWL_USER);
|
||||
assert(pPlugin != NULL);
|
||||
|
||||
char szString[80];
|
||||
char sz1[128];
|
||||
char sz2[128];
|
||||
char sz3[128];
|
||||
char sz4[128];
|
||||
SHORT bTranslated;
|
||||
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_COMBO_API_CALL), sizeof(szString), szString);
|
||||
|
||||
if(strcmp(szString, STRING_NPN_VERSION) == 0)
|
||||
{
|
||||
pPlugin->makeNPNCall(action_npn_version, DEFAULT_DWARG_VALUE, DEFAULT_DWARG_VALUE,
|
||||
DEFAULT_DWARG_VALUE, DEFAULT_DWARG_VALUE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_GETURL) == 0)
|
||||
{
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), sizeof(sz1), sz1);
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(sz2), sz2);
|
||||
ULONG dwTarget = 0L;
|
||||
if(strcmp(sz2, "NULL") == 0)
|
||||
dwTarget = 0L;
|
||||
else
|
||||
dwTarget = (ULONG)sz2;
|
||||
pPlugin->makeNPNCall(action_npn_get_url, DEFAULT_DWARG_VALUE, (ULONG)sz1, dwTarget);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_GETURLNOTIFY) == 0)
|
||||
{
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), sizeof(sz1), sz1);
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(sz2), sz2);
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG4, &bTranslated, FALSE);
|
||||
ULONG dwData = (ULONG) bTranslated;
|
||||
ULONG dwTarget = 0L;
|
||||
if(strcmp(sz2, "NULL") == 0)
|
||||
dwTarget = 0L;
|
||||
else
|
||||
dwTarget = (ULONG)sz2;
|
||||
pPlugin->makeNPNCall(action_npn_get_url_notify, DEFAULT_DWARG_VALUE, (ULONG)sz1, dwTarget, dwData);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_REQUESTREAD) == 0)
|
||||
{
|
||||
extern NPByteRange * convertStringToNPByteRangeList(PSZ szString);
|
||||
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), sizeof(sz1), sz1);
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(sz2), sz2);
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG4, &bTranslated, FALSE);
|
||||
ULONG dwData = (ULONG) bTranslated;
|
||||
ULONG dwTarget = 0L;
|
||||
NPByteRange *npByteRangeList = convertStringToNPByteRangeList(sz2);
|
||||
if (!npByteRangeList) { // use default szDefaultNPByteRangeList
|
||||
npByteRangeList = convertStringToNPByteRangeList(szDefaultNPByteRangeList);
|
||||
}
|
||||
pPlugin->m_firstAction = action_npn_request_read;
|
||||
dwData = (ULONG) npByteRangeList;
|
||||
pPlugin->makeNPNCall(action_npn_get_url_notify, DEFAULT_DWARG_VALUE, (ULONG)sz1, dwTarget, dwData);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_POSTURL) == 0)
|
||||
{
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), sizeof(sz1), sz1);
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(sz2), sz2);
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG4, &bTranslated, FALSE);
|
||||
ULONG dwLen = (ULONG) bTranslated;
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG5), sizeof(sz3), sz3);
|
||||
SHORT index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG6));
|
||||
LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG6), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG6), LM_QUERYITEMTEXT, MPFROM2SHORT(index, 128), (MPARAM)sz4);
|
||||
BOOL bFile = (strcmp(sz4, "TRUE") == 0) ? TRUE : FALSE;
|
||||
ULONG dwTarget = 0L;
|
||||
if(strcmp(sz2, "NULL") == 0)
|
||||
dwTarget = 0L;
|
||||
else
|
||||
dwTarget = (ULONG)sz2;
|
||||
pPlugin->makeNPNCall(action_npn_post_url, DEFAULT_DWARG_VALUE, (ULONG)sz1, dwTarget, dwLen, (ULONG)sz3, (ULONG)bFile);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_POSTURLNOTIFY) == 0)
|
||||
{
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), sizeof(sz1), sz1);
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(sz2), sz2);
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG4, &bTranslated, FALSE);
|
||||
ULONG dwLen = (ULONG) bTranslated;
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG5), sizeof(sz3), sz3);
|
||||
SHORT index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG6));
|
||||
LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG6), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG6), LM_QUERYITEMTEXT, MPFROM2SHORT(index, 128), (MPARAM)sz4);
|
||||
BOOL bFile = (strcmp(sz4, "TRUE") == 0) ? TRUE : FALSE;
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG7, &bTranslated, FALSE);
|
||||
ULONG dwData = (ULONG) bTranslated;
|
||||
ULONG dwTarget = 0L;
|
||||
if(strcmp(sz2, "NULL") == 0)
|
||||
dwTarget = 0L;
|
||||
else
|
||||
dwTarget = (ULONG)sz2;
|
||||
pPlugin->makeNPNCall(action_npn_post_url_notify, DEFAULT_DWARG_VALUE, (ULONG)sz1, dwTarget, dwLen, (ULONG)sz3,
|
||||
(ULONG)bFile, dwData);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_NEWSTREAM) == 0)
|
||||
{
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), sizeof(sz1), sz1);
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(sz2), sz2);
|
||||
pPlugin->makeNPNCall(action_npn_new_stream, DEFAULT_DWARG_VALUE, (ULONG)sz1, (ULONG)sz2, DEFAULT_DWARG_VALUE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_DESTROYSTREAM) == 0)
|
||||
{
|
||||
SHORT index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG3));
|
||||
LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXT, MPFROM2SHORT(index, 128), (MPARAM)sz1);
|
||||
|
||||
NPError reason;
|
||||
if(strcmp(sz1, "NPRES_DONE") == 0)
|
||||
reason = NPRES_DONE;
|
||||
else if(strcmp(sz1, "NPRES_USER_BREAK") == 0)
|
||||
reason = NPRES_USER_BREAK;
|
||||
else if(strcmp(sz1, "NPRES_NETWORK_ERR") == 0)
|
||||
reason = NPRES_NETWORK_ERR;
|
||||
else
|
||||
reason = NPRES_DONE;
|
||||
|
||||
pPlugin->makeNPNCall(action_npn_destroy_stream, DEFAULT_DWARG_VALUE, DEFAULT_DWARG_VALUE, (ULONG)reason);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_REQUESTREAD) == 0)
|
||||
{
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_WRITE) == 0)
|
||||
{
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG4), sizeof(sz1), sz1);
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG3, &bTranslated, FALSE);
|
||||
ULONG dwLen = (ULONG) bTranslated;
|
||||
pPlugin->makeNPNCall(action_npn_write, DEFAULT_DWARG_VALUE, DEFAULT_DWARG_VALUE, dwLen, (ULONG)sz1);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_STATUS) == 0)
|
||||
{
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), sizeof(sz1), sz1);
|
||||
pPlugin->makeNPNCall(action_npn_status, DEFAULT_DWARG_VALUE, (ULONG)sz1);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_USERAGENT) == 0)
|
||||
{
|
||||
pPlugin->makeNPNCall(action_npn_user_agent);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_MEMALLOC) == 0)
|
||||
{
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG1, &bTranslated, FALSE);
|
||||
ULONG dwSize = (ULONG) bTranslated;
|
||||
pPlugin->makeNPNCall(action_npn_mem_alloc, dwSize);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_MEMFREE) == 0)
|
||||
{
|
||||
pPlugin->makeNPNCall(action_npn_mem_free);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_MEMFLUSH) == 0)
|
||||
{
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG1, &bTranslated, FALSE);
|
||||
ULONG dwSize = (ULONG) bTranslated;
|
||||
pPlugin->makeNPNCall(action_npn_mem_flush, dwSize);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_RELOADPLUGINS) == 0)
|
||||
{
|
||||
SHORT index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG1));
|
||||
LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG1), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG1), LM_QUERYITEMTEXT, MPFROM2SHORT(index, 128), (MPARAM)sz1);
|
||||
BOOL bReloadPages = (strcmp(sz1, "TRUE") == 0) ? TRUE : FALSE;
|
||||
pPlugin->makeNPNCall(action_npn_reload_plugins, (ULONG)bReloadPages);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_GETJAVAENV) == 0)
|
||||
{
|
||||
pPlugin->makeNPNCall(action_npn_get_java_env);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_GETJAVAPEER) == 0)
|
||||
{
|
||||
pPlugin->makeNPNCall(action_npn_get_java_peer);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_GETVALUE) == 0)
|
||||
{
|
||||
static ULONG dwValue = 0L;
|
||||
NPNVariable variable = (NPNVariable)NULL;
|
||||
|
||||
SHORT index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG2));
|
||||
LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG2), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG2), LM_QUERYITEMTEXT, MPFROM2SHORT(index, 128), (MPARAM)sz1);
|
||||
if(strcmp(sz1, "NPNVxDisplay") == 0)
|
||||
variable = NPNVxDisplay;
|
||||
else if(strcmp(sz1, "NPNVxtAppContext") == 0)
|
||||
variable = NPNVxtAppContext;
|
||||
else if(strcmp(sz1, "NPNVnetscapeWindow") == 0)
|
||||
variable = NPNVnetscapeWindow;
|
||||
else if(strcmp(sz1, "NPNVjavascriptEnabledBool") == 0)
|
||||
variable = NPNVjavascriptEnabledBool;
|
||||
else if(strcmp(sz1, "NPNVasdEnabledBool") == 0)
|
||||
variable = NPNVasdEnabledBool;
|
||||
else if(strcmp(sz1, "NPNVisOfflineBool") == 0)
|
||||
variable = NPNVisOfflineBool;
|
||||
|
||||
pPlugin->m_pValue = (void *)&dwValue;
|
||||
|
||||
pPlugin->makeNPNCall(action_npn_get_value, DEFAULT_DWARG_VALUE, (ULONG)variable, DEFAULT_DWARG_VALUE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_SETVALUE) == 0)
|
||||
{
|
||||
NPPVariable variable = (NPPVariable)NULL;
|
||||
static char szStringValue[256];
|
||||
static BOOL bBoolValue;
|
||||
|
||||
SHORT index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG2));
|
||||
LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG2), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG2), LM_QUERYITEMTEXT, MPFROM2SHORT(index, 128), (MPARAM)sz1);
|
||||
if(strcmp(sz1, "NPPVpluginNameString") == 0)
|
||||
{
|
||||
variable = NPPVpluginNameString;
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(szStringValue), szStringValue);
|
||||
pPlugin->m_pValue = (void *)&szStringValue[0];
|
||||
}
|
||||
else if(strcmp(sz1, "NPPVpluginDescriptionString") == 0)
|
||||
{
|
||||
variable = NPPVpluginDescriptionString;
|
||||
WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(szStringValue), szStringValue);
|
||||
pPlugin->m_pValue = (void *)&szStringValue[0];
|
||||
}
|
||||
else if(strcmp(sz1, "NPPVpluginWindowBool") == 0)
|
||||
{
|
||||
variable = NPPVpluginWindowBool;
|
||||
index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG3));
|
||||
LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXT, MPFROM2SHORT(index, 256), (MPARAM)szStringValue);
|
||||
bBoolValue = (strcmp(szStringValue, "TRUE") == 0) ? TRUE : FALSE;
|
||||
pPlugin->m_pValue = (void *)&bBoolValue;
|
||||
}
|
||||
else if(strcmp(sz1, "NPPVpluginTransparentBool") == 0)
|
||||
{
|
||||
variable = NPPVpluginTransparentBool;
|
||||
index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG3));
|
||||
LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXT, MPFROM2SHORT(index, 256), (MPARAM)szStringValue);
|
||||
bBoolValue = (strcmp(szStringValue, "TRUE") == 0) ? TRUE : FALSE;
|
||||
pPlugin->m_pValue = (void *)&bBoolValue;
|
||||
}
|
||||
else if(strcmp(sz1, "NPPVpluginWindowSize") == 0)
|
||||
{
|
||||
variable = NPPVpluginWindowSize;
|
||||
static NPSize npsize;
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG3, &bTranslated, TRUE);
|
||||
npsize.width = bTranslated;
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG4, &bTranslated, TRUE);
|
||||
npsize.height = bTranslated;
|
||||
pPlugin->m_pValue = (void *)&npsize;
|
||||
}
|
||||
else if(strcmp(sz1, "NPPVpluginKeepLibraryInMemory") == 0)
|
||||
{
|
||||
variable = NPPVpluginKeepLibraryInMemory;
|
||||
index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG3));
|
||||
LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
|
||||
WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXT, MPFROM2SHORT(index, 256), (MPARAM)szStringValue);
|
||||
bBoolValue = (strcmp(szStringValue, "TRUE") == 0) ? TRUE : FALSE;
|
||||
pPlugin->m_pValue = (void *)&bBoolValue;
|
||||
}
|
||||
pPlugin->makeNPNCall(action_npn_set_value, DEFAULT_DWARG_VALUE, (ULONG)variable, DEFAULT_DWARG_VALUE);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_INVALIDATERECT) == 0)
|
||||
{
|
||||
static NPRect nprect;
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG2, &bTranslated, TRUE);
|
||||
nprect.top = bTranslated;
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG3, &bTranslated, TRUE);
|
||||
nprect.left = bTranslated;
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG4, &bTranslated, TRUE);
|
||||
nprect.bottom = bTranslated;
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG5, &bTranslated, TRUE);
|
||||
nprect.right = bTranslated;
|
||||
pPlugin->makeNPNCall(action_npn_invalidate_rect, DEFAULT_DWARG_VALUE, (ULONG)&nprect);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_INVALIDATEREGION) == 0)
|
||||
{
|
||||
WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG2, &bTranslated, FALSE);
|
||||
int i = bTranslated;
|
||||
pPlugin->makeNPNCall(action_npn_invalidate_region, DEFAULT_DWARG_VALUE, (ULONG)i);
|
||||
}
|
||||
else if(strcmp(szString, STRING_NPN_FORCEREDRAW) == 0)
|
||||
{
|
||||
pPlugin->makeNPNCall(action_npn_force_redraw);
|
||||
}
|
||||
else
|
||||
assert(0);
|
||||
}
|
||||
|
||||
void onPaste(HWND hWndToPasteTo)
|
||||
{
|
||||
if(hWndToPasteTo == NULL)
|
||||
return;
|
||||
if(!WinOpenClipbrd(NULL))
|
||||
return;
|
||||
WinSendMsg(hWndToPasteTo, EM_PASTE, 0, 0);
|
||||
WinCloseClipbrd(NULL);
|
||||
}
|
48
modules/plugin/tools/tester/os2/guihlp.h
Normal file
48
modules/plugin/tools/tester/os2/guihlp.h
Normal file
@ -0,0 +1,48 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __GUIHLP_H__
|
||||
#define __GUIHLP_H__
|
||||
|
||||
void EnableWindowNow(HWND hWnd, BOOL bEnable);
|
||||
void ShowWindowNow(HWND hWnd, BOOL iShow);
|
||||
void fillAPIComboBoxAndSetSel(HWND hWndCombo, int iSel);
|
||||
void updateUI(HWND hWnd);
|
||||
void onGo(HWND hWnd);
|
||||
void onPaste(HWND hWndToPasteTo);
|
||||
|
||||
#endif // __GUIHLP_H__
|
55
modules/plugin/tools/tester/os2/guiprefs.h
Normal file
55
modules/plugin/tools/tester/os2/guiprefs.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __GUIPREFS_H__
|
||||
#define __GUIPREFS_H__
|
||||
|
||||
#define SECTION_PREFERENCES "Preferences"
|
||||
#define KEY_AUTO_MODE "AutoMode"
|
||||
#define KEY_LOG_FILE "LogFile"
|
||||
#define KEY_SCRIPT_FILE "ScriptFile"
|
||||
#define KEY_TO_FILE "LogToFile"
|
||||
#define KEY_TO_FRAME "LogToFrame"
|
||||
#define KEY_FLUSH_NOW "FlushImmediately"
|
||||
#define KEY_LOADSTATUS_WINDOW "LoadStatusWindow"
|
||||
#define KEY_REMEMBER_LAST_API_CALL "RememberLastAPICall"
|
||||
#define KEY_LAST_API_CALL "LastAPICall"
|
||||
|
||||
#define ENTRY_YES "Yes"
|
||||
#define ENTRY_NO "No"
|
||||
|
||||
#endif // __GUIPREFS_H__
|
84
modules/plugin/tools/tester/os2/loadstatus.cpp
Normal file
84
modules/plugin/tools/tester/os2/loadstatus.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#define INCL_WIN
|
||||
#define INCL_GPI
|
||||
#include <os2.h>
|
||||
#include <string.h>
|
||||
|
||||
extern HMODULE hInst;
|
||||
static char szClassName[] = "LoadStatusWindowClass";
|
||||
|
||||
HWND ShowLoadStatus(char * aMessage)
|
||||
{
|
||||
if (!aMessage)
|
||||
return NULL;
|
||||
|
||||
if (!WinRegisterClass((HAB)0, szClassName, (PFNWP)WinDefWindowProc, 0, sizeof(ULONG))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HWND hWnd = WinCreateWindow(HWND_DESKTOP, szClassName, "", WS_VISIBLE | WS_DISABLED,
|
||||
0, 0, 0, 0, HWND_DESKTOP, HWND_TOP, 255, (PVOID)NULL, NULL);
|
||||
if (!hWnd) {
|
||||
ERRORID error = WinGetLastError(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HPS hPS = WinGetPS(hWnd);
|
||||
if (!hPS) {
|
||||
WinDestroyWindow(hWnd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
POINTL ptls;
|
||||
GpiQueryTextBox(hPS, strlen(aMessage), aMessage, 1, &ptls);
|
||||
WinSetWindowPos(hWnd, HWND_TOP, 0, 0, ptls.x + 4, ptls.y + 2, SWP_SHOW );
|
||||
POINTL ptlStart;
|
||||
ptlStart.x = 2; ptlStart.y = 1;
|
||||
GpiCharStringAt(hPS, &ptlStart, strlen(aMessage), aMessage);
|
||||
WinReleasePS(hPS);
|
||||
|
||||
return hWnd;
|
||||
}
|
||||
|
||||
void DestroyLoadStatus(HWND ahWnd)
|
||||
{
|
||||
if (ahWnd)
|
||||
WinDestroyWindow(ahWnd);
|
||||
|
||||
}
|
93
modules/plugin/tools/tester/os2/npapi.rc
Normal file
93
modules/plugin/tools/tester/os2/npapi.rc
Normal file
@ -0,0 +1,93 @@
|
||||
|
||||
#define INCL_NOBASEAPI
|
||||
#include <os2.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
RCDATA NP_INFO_ProductVersion { 1,5,0,0, }
|
||||
|
||||
RCDATA NP_INFO_MIMEType { "application/npapi-test\0" }
|
||||
RCDATA NP_INFO_FileExtents { "pts\0" }
|
||||
RCDATA NP_INFO_FileOpenName{ "API (*.pts)\0" }
|
||||
|
||||
RCDATA NP_INFO_FileVersion { 1,5,0,0, }
|
||||
RCDATA NP_INFO_CompanyName { "Netscape Communications Corp.\0" }
|
||||
RCDATA NP_INFO_FileDescription { "32-bit NPAPI test plugin\0" }
|
||||
RCDATA NP_INFO_InternalName { "npapi.dll\0" }
|
||||
RCDATA NP_INFO_LegalCopyright { "Copyright ÿ 1997-2001\0" }
|
||||
RCDATA NP_INFO_OriginalFilename { "npapi.dll\0" }
|
||||
RCDATA NP_INFO_ProductName { "Netscape NPAPI Tester Plugin\0" }
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
DLGTEMPLATE IDD_DIALOG_TESTER DISCARDABLE
|
||||
BEGIN
|
||||
DIALOG "", IDD_DIALOG_TESTER, 0, 0, 149, 363,
|
||||
WS_VISIBLE | NOT FS_BORDER | NOT FS_DLGBORDER,
|
||||
|
||||
BEGIN
|
||||
LTEXT "Mode:", IDC_STATIC_MODE, 9, 348, 27, 8, SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
|
||||
CONTROL "Manual",IDC_RADIO_MODE_MANUAL,44,346, 49, 10, WC_BUTTON, BS_AUTORADIOBUTTON | BS_PUSHBUTTON | WS_VISIBLE
|
||||
CONTROL "Auto",IDC_RADIO_MODE_AUTO, 98, 346, 39, 10, WC_BUTTON, BS_AUTORADIOBUTTON | BS_PUSHBUTTON | WS_VISIBLE
|
||||
GROUPBOX "Log", IDC_STATIC, 9, 273, 132, 70, DT_MNEMONIC
|
||||
CONTROL "To file:",IDC_CHECK_LOG_TO_FILE,17,320,43, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_TABSTOP | BS_PUSHBUTTON | WS_VISIBLE
|
||||
ENTRYFIELD "", IDC_EDIT_LOG_FILE_NAME, 65, 319, 65, 11, ES_AUTOSCROLL | ES_MARGIN
|
||||
CONTROL "To frame",IDC_CHECK_LOG_TO_FRAME,17,293,52,10, WC_BUTTON, BS_AUTOCHECKBOX | WS_TABSTOP | BS_PUSHBUTTON | WS_VISIBLE
|
||||
PUSHBUTTON "Flush", IDC_BUTTON_FLUSH, 72, 292, 30, 12
|
||||
PUSHBUTTON "Clear", IDC_BUTTON_CLEAR, 102, 292, 30, 12
|
||||
CONTROL "Flush immediately",IDC_CHECK_SHOW_LOG,33,278,89,10,WC_BUTTON, BS_AUTOCHECKBOX | WS_TABSTOP | BS_PUSHBUTTON | WS_VISIBLE
|
||||
CONTROL "Remember last API call",IDC_CHECK_REMEMBER_LAST,9,258,112,10,WC_BUTTON, BS_AUTOCHECKBOX | WS_TABSTOP | BS_PUSHBUTTON | WS_VISIBLE
|
||||
END
|
||||
END
|
||||
|
||||
DLGTEMPLATE IDD_DIALOG_MANUAL DISCARDABLE
|
||||
BEGIN
|
||||
DIALOG "", IDD_DIALOG_MANUAL, 0, 0, 149, 228,
|
||||
WS_VISIBLE | NOT FS_BORDER | NOT FS_DLGBORDER,
|
||||
|
||||
BEGIN
|
||||
LTEXT "API call:",IDC_STATIC_APICALL,9,220, 34, 8, SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
|
||||
COMBOBOX "", IDC_COMBO_API_CALL, 9, -17, 105, 236, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
PUSHBUTTON "Go", IDC_BUTTON_GO, 117, 206, 24, 12
|
||||
LTEXT "Static", IDC_STATIC_ARG1, 9, 194, 132, 8, SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
|
||||
ENTRYFIELD "", IDC_EDIT_ARG1, 11, 180, 128, 11, ES_AUTOSCROLL | ES_MARGIN
|
||||
LTEXT "Static", IDC_STATIC_ARG2, 9, 167, 132, 8, SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
|
||||
ENTRYFIELD "", IDC_EDIT_ARG2, 11, 153, 128, 11, ES_AUTOSCROLL | ES_MARGIN
|
||||
LTEXT "Static", IDC_STATIC_ARG3, 9, 140, 132, 8, SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
|
||||
ENTRYFIELD "", IDC_EDIT_ARG3, 11, 126, 128, 11, ES_AUTOSCROLL | ES_MARGIN
|
||||
LTEXT "Static", IDC_STATIC_ARG4, 9, 113, 132, 8, SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
|
||||
ENTRYFIELD "", IDC_EDIT_ARG4, 11, 99, 128, 11, ES_AUTOSCROLL | ES_MARGIN
|
||||
LTEXT "Static", IDC_STATIC_ARG5, 9, 86, 132, 8, SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
|
||||
ENTRYFIELD "", IDC_EDIT_ARG5, 11, 73, 128, 11, ES_AUTOSCROLL | ES_MARGIN
|
||||
LTEXT "Static", IDC_STATIC_ARG6, 9, 60, 132, 8, SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
|
||||
ENTRYFIELD "", IDC_EDIT_ARG6, 11, 46, 128, 11, ES_AUTOSCROLL | ES_MARGIN
|
||||
LTEXT "Static", IDC_STATIC_ARG7, 9, 33, 132, 8, SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
|
||||
ENTRYFIELD "", IDC_EDIT_ARG7, 11, 19, 128, 11, ES_AUTOSCROLL | ES_MARGIN
|
||||
PUSHBUTTON "Paste...",IDC_BUTTON_PASTE, 9, 0, 132, 13
|
||||
LTEXT "Static", IDC_STATIC_INFO, 9, 169, 132, 8, SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
|
||||
COMBOBOX "", IDC_COMBO_ARG1, 9, 151, 132, 42, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
COMBOBOX "", IDC_COMBO_ARG6, 9, 3, 132, 55, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
COMBOBOX "", IDC_COMBO_ARG2, 10, 82, 130, 83, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
COMBOBOX "", IDC_COMBO_ARG3, 9, 71, 132, 67, CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
END
|
||||
END
|
||||
|
||||
DLGTEMPLATE IDD_DIALOG_AUTO DISCARDABLE
|
||||
BEGIN
|
||||
DIALOG "", IDD_DIALOG_AUTO, 0, 0, 149, 228,
|
||||
NOT FS_BORDER | NOT FS_DLGBORDER,
|
||||
|
||||
BEGIN
|
||||
LTEXT "Script file name:",IDC_STATIC,9,220, 64, 8, SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
|
||||
ENTRYFIELD "",IDC_EDIT_SCRIPT_FILE_NAME,11, 206, 101, 11, ES_AUTOSCROLL | ES_MARGIN
|
||||
PUSHBUTTON "Go", IDC_BUTTON_GO, 117, 206, 24, 12
|
||||
RTEXT "Static",IDC_STATIC_REPETITIONS_LEFT,77,189,23,8,SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
|
||||
LTEXT "Repetitions left:",IDC_STATIC_REPETITIONS_LABEL,9,189,63,8,SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
|
||||
END
|
||||
END
|
||||
|
||||
|
98
modules/plugin/tools/tester/os2/os2entry.cpp
Normal file
98
modules/plugin/tools/tester/os2/os2entry.cpp
Normal file
@ -0,0 +1,98 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*********************************************************/
|
||||
/* */
|
||||
/* Main entry point for Windows */
|
||||
/* */
|
||||
/*********************************************************/
|
||||
#include <os2.h>
|
||||
|
||||
#include "xp.h"
|
||||
#include "guiprefs.h"
|
||||
#include "loadstatus.h"
|
||||
#include "os2utils.h"
|
||||
|
||||
HMODULE hInst = NULL;
|
||||
HWND hWndLoadStatus = NULL;
|
||||
|
||||
//Compiler run-time functions
|
||||
extern "C" {
|
||||
int _CRT_init( void );
|
||||
void _CRT_term( void );
|
||||
void __ctordtorInit( void );
|
||||
void __ctordtorTerm( void );
|
||||
}
|
||||
|
||||
unsigned long _System _DLL_InitTerm(unsigned long hModule, unsigned long ulFlag)
|
||||
{
|
||||
APIRET rc;
|
||||
|
||||
switch (ulFlag) {
|
||||
case 0:
|
||||
// Init: Prime compiler run-time and construct static C++ objects.
|
||||
if ( _CRT_init() == -1 ) {
|
||||
return 0UL;
|
||||
} else {
|
||||
__ctordtorInit();
|
||||
hInst = hModule;
|
||||
char szFileName[_MAX_PATH];
|
||||
GetINIFileName(hInst, szFileName, sizeof(szFileName));
|
||||
char sz[256];
|
||||
XP_GetPrivateProfileString(SECTION_PREFERENCES, KEY_LOADSTATUS_WINDOW, ENTRY_NO, sz, sizeof(sz), szFileName);
|
||||
if (strcmpi(sz, ENTRY_YES) == 0)
|
||||
hWndLoadStatus = ShowLoadStatus("Tester dll is loaded");
|
||||
}
|
||||
break;
|
||||
|
||||
case 1 :
|
||||
__ctordtorTerm();
|
||||
_CRT_term();
|
||||
hInst = NULLHANDLE;
|
||||
if (hWndLoadStatus)
|
||||
DestroyLoadStatus(hWndLoadStatus);
|
||||
|
||||
break;
|
||||
|
||||
default :
|
||||
return 0UL;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
65
modules/plugin/tools/tester/os2/os2utils.cpp
Normal file
65
modules/plugin/tools/tester/os2/os2utils.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#define INCL_DOSMODULEMGR
|
||||
#include <os2.h>
|
||||
|
||||
#include "plugbase.h"
|
||||
|
||||
void GetModulePath(HMODULE aInstance, char * aPath, int aSize)
|
||||
{
|
||||
char sz[_MAX_PATH];
|
||||
DosQueryModuleName(aInstance, sizeof(sz), sz);
|
||||
char * p = strrchr(sz, '\\');
|
||||
if(p != NULL) {
|
||||
*++p = '\0';
|
||||
if((int)strlen(sz) < aSize)
|
||||
strcpy(aPath, sz);
|
||||
else
|
||||
strcpy(aPath, "");
|
||||
}
|
||||
else
|
||||
strcpy(aPath, "");
|
||||
}
|
||||
|
||||
static char szINIFile[] = NPAPI_INI_FILE_NAME;
|
||||
|
||||
void GetINIFileName(HMODULE aInstance, char * aName, int aSize)
|
||||
{
|
||||
GetModulePath(aInstance, aName, aSize);
|
||||
strcat(aName, szINIFile);
|
||||
}
|
44
modules/plugin/tools/tester/os2/os2utils.h
Normal file
44
modules/plugin/tools/tester/os2/os2utils.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __WINUTILS_H__
|
||||
#define __WINUTILS_H__
|
||||
|
||||
void GetModulePath(HMODULE aInstance, char * aPath, int aSize);
|
||||
void GetINIFileName(HMODULE aInstance, char * aName, int aSize);
|
||||
|
||||
#endif // __WINUTILS_H__
|
321
modules/plugin/tools/tester/os2/plugin.cpp
Normal file
321
modules/plugin/tools/tester/os2/plugin.cpp
Normal file
@ -0,0 +1,321 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#define INCL_WIN
|
||||
#include <os2.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include "plugin.h"
|
||||
#include "helpers.h"
|
||||
#include "logger.h"
|
||||
#include "guiprefs.h"
|
||||
#include "os2utils.h"
|
||||
|
||||
extern HMODULE hInst;
|
||||
extern CLogger * pLogger;
|
||||
|
||||
/***********************************************/
|
||||
/* */
|
||||
/* CPlugin class implementation */
|
||||
/* */
|
||||
/***********************************************/
|
||||
|
||||
CPlugin::CPlugin(NPP pNPInstance, USHORT wMode) :
|
||||
CPluginBase(pNPInstance, wMode),
|
||||
m_hInst(hInst),
|
||||
m_hWnd(NULL),
|
||||
m_hWndManual(NULL),
|
||||
m_hWndAuto(NULL),
|
||||
m_hWndParent(NULL),
|
||||
m_bPluginReady(FALSE),
|
||||
m_hWndLastEditFocus(NULL),
|
||||
m_iWidth(200),
|
||||
m_iHeight(500)
|
||||
{
|
||||
}
|
||||
|
||||
CPlugin::~CPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
static char szSection[] = SECTION_PREFERENCES;
|
||||
static char szYes[] = ENTRY_YES;
|
||||
static char szNo[] = ENTRY_NO;
|
||||
|
||||
void CPlugin::restorePreferences()
|
||||
{
|
||||
char szFileName[_MAX_PATH];
|
||||
GetINIFileName(m_hInst, szFileName, sizeof(szFileName));
|
||||
|
||||
char sz[256];
|
||||
XP_GetPrivateProfileString(szSection, KEY_AUTO_MODE, ENTRY_NO, sz, sizeof(sz), szFileName);
|
||||
m_Pref_ShowGUI = (strcmpi(sz, ENTRY_YES) == 0) ? sg_auto : sg_manual;
|
||||
|
||||
XP_GetPrivateProfileString(szSection, KEY_LOG_FILE, "Test.log", sz, sizeof(sz), szFileName);
|
||||
strcpy(m_Pref_szLogFile, sz);
|
||||
|
||||
XP_GetPrivateProfileString(szSection, KEY_SCRIPT_FILE, "Test.pts", sz, sizeof(sz), szFileName);
|
||||
strcpy(m_Pref_szScriptFile, sz);
|
||||
|
||||
XP_GetPrivateProfileString(szSection, KEY_TO_FILE, ENTRY_NO, sz, sizeof(sz), szFileName);
|
||||
m_Pref_bToFile = (strcmpi(sz, ENTRY_YES) == 0) ? TRUE : FALSE;
|
||||
|
||||
XP_GetPrivateProfileString(szSection, KEY_TO_FRAME, ENTRY_YES, sz, sizeof(sz), szFileName);
|
||||
m_Pref_bToFrame = (strcmpi(sz, ENTRY_YES) == 0) ? TRUE : FALSE;
|
||||
|
||||
XP_GetPrivateProfileString(szSection, KEY_FLUSH_NOW, ENTRY_YES, sz, sizeof(sz), szFileName);
|
||||
m_Pref_bFlushNow = (strcmpi(sz, ENTRY_YES) == 0) ? TRUE : FALSE;
|
||||
|
||||
XP_GetPrivateProfileString(szSection, KEY_REMEMBER_LAST_API_CALL, ENTRY_YES, sz, sizeof(sz), szFileName);
|
||||
m_Pref_bRememberLastCall = (strcmpi(sz, ENTRY_YES) == 0) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
void CPlugin::savePreferences()
|
||||
{
|
||||
char szFileName[_MAX_PATH];
|
||||
GetINIFileName(m_hInst, szFileName, sizeof(szFileName));
|
||||
|
||||
XP_WritePrivateProfileString(szSection, KEY_AUTO_MODE, (m_Pref_ShowGUI == sg_auto) ? szYes : szNo, szFileName);
|
||||
XP_WritePrivateProfileString(szSection, KEY_LOG_FILE, m_Pref_szLogFile, szFileName);
|
||||
XP_WritePrivateProfileString(szSection, KEY_SCRIPT_FILE, m_Pref_szScriptFile, szFileName);
|
||||
XP_WritePrivateProfileString(szSection, KEY_TO_FILE, m_Pref_bToFile ? szYes : szNo, szFileName);
|
||||
XP_WritePrivateProfileString(szSection, KEY_TO_FRAME, m_Pref_bToFrame ? szYes : szNo, szFileName);
|
||||
XP_WritePrivateProfileString(szSection, KEY_FLUSH_NOW, m_Pref_bFlushNow ? szYes : szNo, szFileName);
|
||||
XP_WritePrivateProfileString(szSection, KEY_REMEMBER_LAST_API_CALL, m_Pref_bRememberLastCall ? szYes : szNo, szFileName);
|
||||
}
|
||||
|
||||
void CPlugin::updatePrefs(GUIPrefs prefs, int iValue, char * szValue)
|
||||
{
|
||||
switch(prefs)
|
||||
{
|
||||
case gp_mode:
|
||||
m_Pref_ShowGUI = (ShowGUI)iValue;
|
||||
break;
|
||||
case gp_logfile:
|
||||
if(szValue && (strlen(szValue) < sizeof(m_Pref_szLogFile)))
|
||||
strcpy(m_Pref_szLogFile, szValue);
|
||||
break;
|
||||
case gp_scriptfile:
|
||||
if(szValue && (strlen(szValue) < sizeof(m_Pref_szScriptFile)))
|
||||
strcpy(m_Pref_szScriptFile, szValue);
|
||||
break;
|
||||
case gp_tofile:
|
||||
m_Pref_bToFile = (BOOL)iValue;
|
||||
break;
|
||||
case gp_toframe:
|
||||
m_Pref_bToFrame = (BOOL)iValue;
|
||||
break;
|
||||
case gp_flush:
|
||||
m_Pref_bFlushNow = (BOOL)iValue;
|
||||
break;
|
||||
case gp_rememberlast:
|
||||
m_Pref_bRememberLastCall = (BOOL)iValue;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CPlugin::getModulePath(PSZ szPath, int iSize)
|
||||
{
|
||||
GetModulePath(m_hInst, szPath, iSize);
|
||||
}
|
||||
|
||||
void CPlugin::getLogFileName(PSZ szLogFileName, int iSize)
|
||||
{
|
||||
if(getMode() == NP_EMBED)
|
||||
{
|
||||
char sz[256];
|
||||
getModulePath(szLogFileName, iSize);
|
||||
WinQueryWindowText(WinWindowFromID(m_hWnd, IDC_EDIT_LOG_FILE_NAME), sizeof(sz), sz);
|
||||
strcat(szLogFileName, sz);
|
||||
}
|
||||
else
|
||||
CPluginBase::getLogFileName(szLogFileName, iSize);
|
||||
}
|
||||
|
||||
MRESULT EXPENTRY NP_LOADDS TesterDlgProc(HWND, ULONG, MPARAM, MPARAM);
|
||||
|
||||
BOOL CPlugin::initEmbed(ULONG dwInitData)
|
||||
{
|
||||
restorePreferences();
|
||||
|
||||
HWND hWndParent = (HWND)dwInitData;
|
||||
|
||||
if(WinIsWindow((HAB)0, hWndParent))
|
||||
m_hWndParent = hWndParent;
|
||||
|
||||
WinLoadDlg(m_hWndParent, m_hWndParent, (PFNWP)TesterDlgProc, m_hInst, IDD_DIALOG_TESTER, (PVOID)this);
|
||||
|
||||
m_bPluginReady = (m_hWnd != NULL);
|
||||
|
||||
return m_bPluginReady;
|
||||
}
|
||||
|
||||
BOOL CPlugin::initFull(ULONG dwInitData)
|
||||
{
|
||||
m_bPluginReady = CPluginBase::initFull(dwInitData);
|
||||
return m_bPluginReady;
|
||||
}
|
||||
|
||||
void CPlugin::shutEmbed()
|
||||
{
|
||||
savePreferences();
|
||||
|
||||
if(m_hWnd != NULL)
|
||||
{
|
||||
WinDismissDlg(m_hWnd, IDD_DIALOG_TESTER); //WinDestroyWindow(m_hWnd);
|
||||
m_hWnd = NULL;
|
||||
}
|
||||
|
||||
m_bPluginReady = FALSE;
|
||||
}
|
||||
|
||||
void CPlugin::shutFull()
|
||||
{
|
||||
CPluginBase::shutFull();
|
||||
m_bPluginReady = FALSE;
|
||||
}
|
||||
|
||||
BOOL CPlugin::isInitialized()
|
||||
{
|
||||
return m_bPluginReady;
|
||||
}
|
||||
|
||||
void CPlugin::onInit(HWND hWnd, HWND hWndManual, HWND hWndAuto)
|
||||
{
|
||||
assert(hWnd != NULL);
|
||||
assert(hWndManual != NULL);
|
||||
assert(hWndAuto != NULL);
|
||||
|
||||
m_hWnd = hWnd;
|
||||
m_hWndManual = hWndManual;
|
||||
m_hWndAuto = hWndAuto;
|
||||
|
||||
pLogger->setShowImmediatelyFlag(WinQueryButtonCheckstate(m_hWnd, IDC_CHECK_SHOW_LOG) == BST_CHECKED);
|
||||
pLogger->setLogToFrameFlag(WinQueryButtonCheckstate(m_hWnd, IDC_CHECK_LOG_TO_FRAME) == BST_CHECKED);
|
||||
pLogger->setLogToFileFlag(WinQueryButtonCheckstate(m_hWnd, IDC_CHECK_LOG_TO_FILE) == BST_CHECKED);
|
||||
}
|
||||
|
||||
int CPlugin::messageBox(LPSTR szMessage, LPSTR szTitle, UINT uStyle)
|
||||
{
|
||||
return WinMessageBox(HWND_DESKTOP, m_hWnd, szMessage, szTitle, 0, uStyle);
|
||||
}
|
||||
|
||||
void CPlugin::onDestroy()
|
||||
{
|
||||
m_hWnd = NULL;
|
||||
}
|
||||
|
||||
void CPlugin::onLogToFile(BOOL bLogToFile)
|
||||
{
|
||||
pLogger->setLogToFileFlag(bLogToFile);
|
||||
if(!bLogToFile)
|
||||
pLogger->closeLogToFile();
|
||||
}
|
||||
|
||||
const HMODULE CPlugin::getInstance()
|
||||
{
|
||||
return m_hInst;
|
||||
}
|
||||
|
||||
const HWND CPlugin::getWindow()
|
||||
{
|
||||
return m_hWnd;
|
||||
}
|
||||
|
||||
const HWND CPlugin::getParent()
|
||||
{
|
||||
return m_hWndParent;
|
||||
}
|
||||
|
||||
void CPlugin::showGUI(ShowGUI sg)
|
||||
{
|
||||
switch (sg)
|
||||
{
|
||||
case sg_manual:
|
||||
WinShowWindow(m_hWndManual, TRUE);
|
||||
WinShowWindow(m_hWndAuto, FALSE);
|
||||
break;
|
||||
case sg_auto:
|
||||
WinShowWindow(m_hWndManual, FALSE);
|
||||
WinShowWindow(m_hWndAuto, TRUE);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ULONG CPlugin::makeNPNCall(NPAPI_Action action, ULONG dw1, ULONG dw2, ULONG dw3,
|
||||
ULONG dw4, ULONG dw5, ULONG dw6, ULONG dw7)
|
||||
{
|
||||
ULONG dwRet = CPluginBase::makeNPNCall(action, dw1, dw2, dw3, dw4, dw5, dw6, dw7);
|
||||
|
||||
// update GUI for Manual mode action
|
||||
if((getMode() == NP_EMBED) && (WinIsWindowVisible(m_hWndManual)))
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case action_npn_new_stream:
|
||||
case action_npn_destroy_stream:
|
||||
case action_npn_mem_alloc:
|
||||
case action_npn_mem_free:
|
||||
updateUI(m_hWndManual);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return dwRet;
|
||||
}
|
||||
|
||||
// Creation and destruction
|
||||
CPluginBase * CreatePlugin(NPP instance, uint16 mode)
|
||||
{
|
||||
CPlugin * pPlugin = new CPlugin(instance, mode);
|
||||
return (CPluginBase *)pPlugin;
|
||||
}
|
||||
|
||||
void DestroyPlugin(CPluginBase * pPlugin)
|
||||
{
|
||||
if(pPlugin != NULL)
|
||||
delete (CPluginBase *)pPlugin;
|
||||
}
|
134
modules/plugin/tools/tester/os2/plugin.h
Normal file
134
modules/plugin/tools/tester/os2/plugin.h
Normal file
@ -0,0 +1,134 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __PLUGIN_H__
|
||||
#define __PLUGIN_H__
|
||||
|
||||
#include "plugbase.h"
|
||||
|
||||
#define BST_UNCHECKED 0
|
||||
#define BST_CHECKED 1
|
||||
#define BST_INDETERMINATE 2
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sg_manual = 1,
|
||||
sg_auto
|
||||
} ShowGUI;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
gp_mode = 1,
|
||||
gp_logfile,
|
||||
gp_scriptfile,
|
||||
gp_tofile,
|
||||
gp_toframe,
|
||||
gp_flush,
|
||||
gp_rememberlast
|
||||
}GUIPrefs;
|
||||
|
||||
class CPlugin : public CPluginBase
|
||||
{
|
||||
private:
|
||||
HMODULE m_hInst;
|
||||
HWND m_hWnd;
|
||||
HWND m_hWndParent;
|
||||
HWND m_hWndManual;
|
||||
HWND m_hWndAuto;
|
||||
BOOL m_bPluginReady;
|
||||
|
||||
//
|
||||
// some GUI data
|
||||
//
|
||||
public:
|
||||
HWND m_hWndLastEditFocus;
|
||||
int m_iWidth;
|
||||
int m_iHeight;
|
||||
|
||||
// GUI preferences
|
||||
ShowGUI m_Pref_ShowGUI;
|
||||
char m_Pref_szLogFile[256];
|
||||
char m_Pref_szScriptFile[256];
|
||||
BOOL m_Pref_bToFile;
|
||||
BOOL m_Pref_bToFrame;
|
||||
BOOL m_Pref_bFlushNow;
|
||||
BOOL m_Pref_bRememberLastCall;
|
||||
|
||||
// public interface
|
||||
public:
|
||||
CPlugin(NPP pNPInstance, USHORT wMode);
|
||||
~CPlugin();
|
||||
|
||||
BOOL initEmbed(DWORD dwInitData);
|
||||
BOOL initFull(DWORD dwInitData);
|
||||
void shutEmbed();
|
||||
void shutFull();
|
||||
BOOL isInitialized();
|
||||
void getModulePath(LPSTR szPath, int iSize);
|
||||
int messageBox(LPSTR szMessage, LPSTR szTitle, UINT uStyle);
|
||||
void getLogFileName(LPSTR szLogFileName, int iSize);
|
||||
|
||||
ULONG makeNPNCall(NPAPI_Action = action_invalid,
|
||||
ULONG dw1 = 0L, ULONG dw2 = 0L,
|
||||
ULONG dw3 = 0L, ULONG dw4 = 0L,
|
||||
ULONG dw5 = 0L, ULONG dw6 = 0L,
|
||||
ULONG dw7 = 0L);
|
||||
|
||||
//
|
||||
// Windows specific methods
|
||||
//
|
||||
const HMODULE getInstance();
|
||||
const HWND getWindow();
|
||||
const HWND getParent();
|
||||
|
||||
// tester interface (GUI stuff)
|
||||
BOOL createTester();
|
||||
void destroyTester();
|
||||
void showGUI(ShowGUI sg);
|
||||
|
||||
// utilities
|
||||
void restorePreferences();
|
||||
void savePreferences();
|
||||
void updatePrefs(GUIPrefs prefs, int iValue, char * szValue = NULL);
|
||||
|
||||
// Window message handlers
|
||||
void onInit(HWND hWnd, HWND hWndManual, HWND hWndAuto);
|
||||
void onDestroy();
|
||||
void onLogToFile(BOOL bLofToFile);
|
||||
};
|
||||
|
||||
#endif // __PLUGIN_H__
|
74
modules/plugin/tools/tester/os2/resource.h
Normal file
74
modules/plugin/tools/tester/os2/resource.h
Normal file
@ -0,0 +1,74 @@
|
||||
/* RC_DATA types for version info - required */
|
||||
#define NP_INFO_ProductVersion 1
|
||||
#define NP_INFO_MIMEType 2
|
||||
#define NP_INFO_FileOpenName 3
|
||||
#define NP_INFO_FileExtents 4
|
||||
|
||||
/* RC_DATA types for version info - used if found */
|
||||
#define NP_INFO_FileDescription 5
|
||||
#define NP_INFO_ProductName 6
|
||||
|
||||
/* RC_DATA types for version info - optional */
|
||||
#define NP_INFO_CompanyName 7
|
||||
#define NP_INFO_FileVersion 8
|
||||
#define NP_INFO_InternalName 9
|
||||
#define NP_INFO_LegalCopyright 10
|
||||
#define NP_INFO_OriginalFilename 11
|
||||
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by npapi.rc
|
||||
//
|
||||
#define IDC_STATIC -1
|
||||
#define IDD_DIALOG_TESTER 102
|
||||
#define IDD_DIALOG_MANUAL 107
|
||||
#define IDD_DIALOG_AUTO 109
|
||||
#define IDC_RADIO_MODE_MANUAL 1002
|
||||
#define IDC_RADIO_MODE_AUTO 1003
|
||||
#define IDC_STATIC_MODE 1004
|
||||
#define IDC_STATIC_APICALL 1005
|
||||
#define IDC_COMBO_API_CALL 1006
|
||||
#define IDC_EDIT_ARG1 1007
|
||||
#define IDC_EDIT_ARG2 1008
|
||||
#define IDC_EDIT_ARG3 1009
|
||||
#define IDC_EDIT_ARG4 1010
|
||||
#define IDC_EDIT_ARG5 1011
|
||||
#define IDC_EDIT_ARG6 1012
|
||||
#define IDC_EDIT_ARG7 1013
|
||||
#define IDC_STATIC_ARG1 1014
|
||||
#define IDC_STATIC_ARG2 1015
|
||||
#define IDC_STATIC_ARG3 1016
|
||||
#define IDC_STATIC_ARG4 1017
|
||||
#define IDC_STATIC_ARG5 1018
|
||||
#define IDC_STATIC_ARG6 1019
|
||||
#define IDC_STATIC_ARG7 1020
|
||||
#define IDC_BUTTON_GO 1021
|
||||
#define IDC_BUTTON_PASTE 1022
|
||||
#define IDC_STATIC_INFO 1023
|
||||
#define IDC_COMBO_ARG1 1024
|
||||
#define IDC_COMBO_ARG6 1025
|
||||
#define IDC_COMBO_ARG2 1026
|
||||
#define IDC_COMBO_ARG3 1028
|
||||
#define IDC_EDIT_SCRIPT_FILE_NAME 1032
|
||||
#define IDC_BUTTON_START 1035
|
||||
#define IDC_BUTTON_STOP 1036
|
||||
#define IDC_EDIT_LOG_FILE_NAME 1037
|
||||
#define IDC_BUTTON_FLUSH 1038
|
||||
#define IDC_CHECK_SHOW_LOG 1039
|
||||
#define IDC_BUTTON_CLEAR 1040
|
||||
#define IDC_CHECK_LOG_TO_FILE 1042
|
||||
#define IDC_CHECK_LOG_TO_FRAME 1043
|
||||
#define IDC_STATIC_REPETITIONS_LEFT 1044
|
||||
#define IDC_CHECK_REMEMBER_LAST 1045
|
||||
#define IDC_STATIC_REPETITIONS_LABEL 1046
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 115
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1047
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user