Back to index

lightning-sunbird  0.9+nobinonly
guihlp.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #define INCL_WIN
00039 #define INCL_WINLISTBOXES
00040 #include <os2.h>
00041 #include <assert.h>
00042 
00043 #include "xp.h"
00044 #include "resource.h"
00045 
00046 #include "guihlp.h"
00047 #include "plugin.h"
00048 #include "comstrs.h"
00049 
00050 static char szDefaultNPByteRangeList[] = "100-100,200-100,300-100";
00051 
00052 static char szNotImplemented[] = "Currently not implemented";
00053 
00054 void EnableWindowNow(HWND hWnd, BOOL bEnable)
00055 {
00056   WinEnableWindow(hWnd, bEnable);
00057   WinUpdateWindow(hWnd);
00058 }
00059 
00060 void ShowWindowNow(HWND hWnd, BOOL iShow)
00061 {
00062   WinShowWindow(hWnd, iShow);
00063   WinUpdateWindow(hWnd);
00064 }
00065 
00066 void fillAPIComboBoxAndSetSel(HWND hWndCombo, int iSel)
00067 {
00068   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_VERSION);
00069   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_GETURL);
00070   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_GETURLNOTIFY);
00071   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_POSTURL);
00072   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_POSTURLNOTIFY);
00073   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_REQUESTREAD);
00074   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_NEWSTREAM);
00075   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_DESTROYSTREAM);
00076   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_WRITE);
00077   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_STATUS);
00078   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_USERAGENT);
00079   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_MEMALLOC);
00080   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_MEMFREE);
00081   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_MEMFLUSH);
00082   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_RELOADPLUGINS);
00083   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_GETJAVAENV);
00084   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_GETJAVAPEER);
00085   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_GETVALUE);
00086   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_SETVALUE);
00087   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_INVALIDATERECT);
00088   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_INVALIDATEREGION);
00089   WinInsertLboxItem(hWndCombo, LIT_END, STRING_NPN_FORCEREDRAW);
00090 
00091   WinSendMsg(hWndCombo, LM_SELECTITEM, (MPARAM)iSel, (MPARAM)TRUE);
00092 }
00093 
00094 static void setStaticTexts7(HWND hWnd, PSZ s1, PSZ s2, PSZ s3, PSZ s4, PSZ s5,PSZ s6, PSZ s7)
00095 {
00096   WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG1), s1);
00097   WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG2), s2);
00098   WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG3), s3);
00099   WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG4), s4);
00100   WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG5), s5);
00101   WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG6), s6);
00102   WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_ARG7), s7);
00103 }
00104 
00105 static void setEditTexts7(HWND hWnd, PSZ s1, PSZ s2, PSZ s3, PSZ s4, PSZ s5,PSZ s6, PSZ s7)
00106 {
00107   WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG1), s1);
00108   WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), s2);
00109   WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), s3);
00110   WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG4), s4);
00111   WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG5), s5);
00112   WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG6), s6);
00113   WinSetWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG7), s7);
00114 }
00115 
00116 static void showArgControls7(HWND hWnd, BOOL b1, BOOL b2, BOOL b3, BOOL b4, BOOL b5, BOOL b6, BOOL b7)
00117 {
00118   WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG1), b1 ? TRUE : FALSE);
00119   WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG2), b2 ? TRUE : FALSE);
00120   WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG3), b3 ? TRUE : FALSE);
00121   WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG4), b4 ? TRUE : FALSE);
00122   WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG5), b5 ? TRUE : FALSE);
00123   WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG6), b6 ? TRUE : FALSE);
00124   WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_ARG7), b7 ? TRUE : FALSE);
00125 
00126   WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG1), b1 ? TRUE : FALSE);
00127   WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG2), b2 ? TRUE : FALSE);
00128   WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG3), b3 ? TRUE : FALSE);
00129   WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG4), b4 ? TRUE : FALSE);
00130   WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG5), b5 ? TRUE : FALSE);
00131   WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG6), b6 ? TRUE : FALSE);
00132   WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG7), b7 ? TRUE : FALSE);
00133 }
00134 
00135 static void enableEdits7(HWND hWnd, BOOL b1, BOOL b2, BOOL b3, BOOL b4, BOOL b5, BOOL b6, BOOL b7)
00136 {
00137   WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG1), b1);
00138   WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG2), b2);
00139   WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG3), b3);
00140   WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG4), b4);
00141   WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG5), b5);
00142   WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG6), b6);
00143   WinEnableWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG7), b7);
00144 }
00145 
00146 static void replaceEditWithCombo(HWND hWnd, BOOL b1, BOOL b2, BOOL b3, BOOL b6)
00147 {
00148   if(b1)
00149   {
00150     WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG1), FALSE);
00151     WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG1), TRUE);
00152   }
00153   if(b2)
00154   {
00155     WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG2), FALSE);
00156     WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG2), TRUE);
00157   }
00158   if(b3)
00159   {
00160     WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG3), FALSE);
00161     WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG3), TRUE);
00162   }
00163   if(b6)
00164   {
00165     WinShowWindow(WinWindowFromID(hWnd, IDC_EDIT_ARG6), FALSE);
00166     WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG6), TRUE);
00167   }
00168 }
00169 
00170 #define NS_SAMPLE_URL "http://mozilla.org"
00171 
00172 void updateUI(HWND hWnd)
00173 {
00174   CPlugin * pPlugin = (CPlugin *)WinQueryWindowULong(hWnd, QWL_USER);
00175   assert(pPlugin != NULL);
00176 
00177   ULONG dwNPInstance = (ULONG)pPlugin->getNPInstance();
00178   char szNPInstance[16];
00179   sprintf(szNPInstance, "%#08lx", dwNPInstance);
00180   WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_INFO), "");
00181   WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_INFO), FALSE);
00182 
00183   setStaticTexts7(hWnd, "","","","","","","");
00184   setEditTexts7(hWnd, "","","","","","","");
00185   enableEdits7(hWnd, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
00186 
00187   WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), TRUE);
00188 
00189   char szString[80];
00190   SHORT iIndex = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_API_CALL));
00191   LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_API_CALL), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(iIndex), (MPARAM)NULL);
00192   WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_API_CALL), LM_QUERYITEMTEXT,  MPFROM2SHORT(iIndex, 80), (MPARAM)szString);
00193 
00194   WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), TRUE);
00195 
00196   WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG1), LM_DELETEALL, 0, 0);
00197   WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG2), LM_DELETEALL, 0, 0);
00198   WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_DELETEALL, 0, 0);
00199   WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG6), LM_DELETEALL, 0, 0);
00200   WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG1), FALSE);
00201   WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG2), FALSE);
00202   WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG3), FALSE);
00203   WinShowWindow(WinWindowFromID(hWnd, IDC_COMBO_ARG6), FALSE);
00204 
00205   if(strcmp(szString, STRING_NPN_VERSION) == 0)
00206   {
00207     showArgControls7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00208     WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
00209   }
00210   else if(strcmp(szString, STRING_NPN_GETURL) == 0)
00211   {
00212     showArgControls7(hWnd, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE);
00213     enableEdits7(hWnd, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE);
00214     setStaticTexts7(hWnd, "instance:", "URL:", "target (or 'NULL'):", "", "", "", "");
00215     setEditTexts7(hWnd, szNPInstance,NS_SAMPLE_URL,"_npapi_Display","","","","");
00216   }
00217   else if(strcmp(szString, STRING_NPN_GETURLNOTIFY) == 0)
00218   {
00219     showArgControls7(hWnd, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE);
00220     enableEdits7(hWnd, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE);
00221     setStaticTexts7(hWnd, "instance:", "URL:", "target (or 'NULL'):", "notifyData:", "", "", "");
00222     setEditTexts7(hWnd, szNPInstance,NS_SAMPLE_URL,"_npapi_Display","0","","","");
00223   }
00224   else if(strcmp(szString, STRING_NPN_POSTURL) == 0)
00225   {
00226     showArgControls7(hWnd, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE);
00227     enableEdits7(hWnd, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE);
00228     setStaticTexts7(hWnd, "instance:", "URL:", "target (or 'NULL'):", "len:", "buf:", "file:", "");
00229     setEditTexts7(hWnd, szNPInstance,NS_SAMPLE_URL,"_npapi_Display","0","","","");
00230     replaceEditWithCombo(hWnd, FALSE, FALSE, FALSE, TRUE);
00231     HWND hWndCombo = WinWindowFromID(hWnd, IDC_COMBO_ARG6);
00232     WinInsertLboxItem(hWndCombo, LIT_END, "FALSE");
00233     WinInsertLboxItem(hWndCombo, LIT_END, "TRUE");
00234     WinSendMsg(hWndCombo, LM_SELECTITEM, (MPARAM)0, (MPARAM)TRUE);
00235   }
00236   else if(strcmp(szString, STRING_NPN_POSTURLNOTIFY) == 0)
00237   {
00238     showArgControls7(hWnd, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
00239     enableEdits7(hWnd, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
00240     setStaticTexts7(hWnd, "instance:", "URL:", "target (or 'NULL'):", "len:", "buf:", "file:", "notifyData:");
00241     setEditTexts7(hWnd, szNPInstance,NS_SAMPLE_URL,"_npapi_Display","0","","","0");
00242     replaceEditWithCombo(hWnd, FALSE, FALSE, FALSE, TRUE);
00243     HWND hWndCombo = WinWindowFromID(hWnd, IDC_COMBO_ARG6);
00244     WinInsertLboxItem(hWndCombo, LIT_END, "FALSE");
00245     WinInsertLboxItem(hWndCombo, LIT_END, "TRUE");
00246     WinSendMsg(hWndCombo, LM_SELECTITEM, (MPARAM)0, (MPARAM)TRUE);
00247   }
00248   else if(strcmp(szString, STRING_NPN_NEWSTREAM) == 0)
00249   {
00250     showArgControls7(hWnd, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE);
00251     enableEdits7(hWnd, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE);
00252     setStaticTexts7(hWnd, "instance:", "type:", "target:", "**stream:", "", "", "");
00253     char szStream[16];
00254     const NPStream * pStream = pPlugin->getNPStream();
00255     sprintf(szStream, "%#08lx", &pStream);
00256     setEditTexts7(hWnd, szNPInstance,"text/plain","_npapi_Display",szStream,"","","");
00257     WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), (pStream != NULL) ? FALSE : TRUE);
00258   }
00259   else if(strcmp(szString, STRING_NPN_REQUESTREAD) == 0)
00260   {
00261 //serge
00262     showArgControls7(hWnd, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE);
00263     enableEdits7(hWnd, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE);
00264     setStaticTexts7(hWnd, "instance:", "URL:", "Range:", "notifyData:", "", "", "");
00265     setEditTexts7(hWnd, szNPInstance,NS_SAMPLE_URL,szDefaultNPByteRangeList,"0","","","");
00266    /*
00267     WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), FALSE);
00268     WinShowWindow(WinWindowFromID(hWnd, IDC_STATIC_INFO), TRUE);
00269     WinSetWindowText(WinWindowFromID(hWnd, IDC_STATIC_INFO), szNotImplemented);
00270     showArgControls7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00271     WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
00272     */
00273   }
00274   else if(strcmp(szString, STRING_NPN_DESTROYSTREAM) == 0)
00275   {
00276     showArgControls7(hWnd, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE);
00277     enableEdits7(hWnd, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE);
00278     setStaticTexts7(hWnd, "instance:", "stream:", "reason:", "", "", "", "");
00279     char szStream[16];
00280     const NPStream * pStream = pPlugin->getNPStream();
00281     sprintf(szStream, "%#08lx", pStream);
00282     setEditTexts7(hWnd, szNPInstance,szStream,"","","","","");
00283     replaceEditWithCombo(hWnd, FALSE, FALSE, TRUE, FALSE);
00284     HWND hWndCombo = WinWindowFromID(hWnd, IDC_COMBO_ARG3);
00285     WinInsertLboxItem(hWndCombo, LIT_END, "NPRES_DONE");
00286     WinInsertLboxItem(hWndCombo, LIT_END, "NPRES_USER_BREAK");
00287     WinInsertLboxItem(hWndCombo, LIT_END, "NPRES_NETWORK_ERR");
00288     WinSendMsg(hWndCombo, LM_SELECTITEM, (MPARAM)0, (MPARAM)TRUE);
00289     WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), (pStream == NULL) ? FALSE : TRUE);
00290   }
00291   else if(strcmp(szString, STRING_NPN_WRITE) == 0)
00292   {
00293     showArgControls7(hWnd, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE);
00294     enableEdits7(hWnd, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE);
00295     setStaticTexts7(hWnd, "instance:", "stream:", "len:", "buf:", "", "", "");
00296     char szStream[16];
00297     const NPStream * pStream = pPlugin->getNPStream();
00298     sprintf(szStream, "%#08lx", pStream);
00299     setEditTexts7(hWnd, szNPInstance,szStream,"0","","","","");
00300     WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), (pStream == NULL) ? FALSE : TRUE);
00301   }
00302   else if(strcmp(szString, STRING_NPN_STATUS) == 0)
00303   {
00304     showArgControls7(hWnd, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE);
00305     enableEdits7(hWnd, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE);
00306     setStaticTexts7(hWnd, "instance:", "message:", "", "", "", "", "");
00307     setEditTexts7(hWnd, szNPInstance,"Some message","","","","","");
00308   }
00309   else if(strcmp(szString, STRING_NPN_USERAGENT) == 0)
00310   {
00311     showArgControls7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00312     enableEdits7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00313     setStaticTexts7(hWnd, "instance:", "", "", "", "", "", "");
00314     setEditTexts7(hWnd, szNPInstance,"","","","","","");
00315     WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
00316   }
00317   else if(strcmp(szString, STRING_NPN_MEMALLOC) == 0)
00318   {
00319     showArgControls7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00320     enableEdits7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00321     setStaticTexts7(hWnd, "size:", "", "", "", "", "", "");
00322     setEditTexts7(hWnd, "256","","","","","","");
00323     WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), (pPlugin->m_pNPNAlloced == NULL) ? TRUE : FALSE);
00324     WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
00325   }
00326   else if(strcmp(szString, STRING_NPN_MEMFREE) == 0)
00327   {
00328     showArgControls7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00329     enableEdits7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00330     setStaticTexts7(hWnd, "ptr:", "", "", "", "", "", "");
00331     char szPtr[16];
00332     sprintf(szPtr, "%#08lx", pPlugin->m_pNPNAlloced);
00333     setEditTexts7(hWnd, szPtr,"","","","","","");
00334     WinEnableWindow(WinWindowFromID(hWnd, IDC_BUTTON_GO), (pPlugin->m_pNPNAlloced == NULL) ? FALSE : TRUE);
00335     WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
00336   }
00337   else if(strcmp(szString, STRING_NPN_MEMFLUSH) == 0)
00338   {
00339     showArgControls7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00340     enableEdits7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00341     setStaticTexts7(hWnd, "size:", "", "", "", "", "", "");
00342     setEditTexts7(hWnd, "256","","","","","","");
00343     WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
00344   }
00345   else if(strcmp(szString, STRING_NPN_RELOADPLUGINS) == 0)
00346   {
00347     showArgControls7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00348     enableEdits7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00349     setStaticTexts7(hWnd, "reloadPages:", "", "", "", "", "", "");
00350     setEditTexts7(hWnd, "","","","","","","");
00351     replaceEditWithCombo(hWnd, TRUE, FALSE, FALSE, FALSE);
00352     HWND hWndCombo = WinWindowFromID(hWnd, IDC_COMBO_ARG1);
00353     WinInsertLboxItem(hWndCombo, LIT_END, "TRUE");
00354     WinInsertLboxItem(hWndCombo, LIT_END, "FALSE");
00355     WinSendMsg(hWndCombo, LM_SELECTITEM, (MPARAM)0, (MPARAM)TRUE);
00356     WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
00357   }
00358   else if(strcmp(szString, STRING_NPN_GETJAVAENV) == 0)
00359   {
00360     showArgControls7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00361     WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
00362   }
00363   else if(strcmp(szString, STRING_NPN_GETJAVAPEER) == 0)
00364   {
00365     showArgControls7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00366     enableEdits7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00367     setStaticTexts7(hWnd, "instance:", "", "", "", "", "", "");
00368     setEditTexts7(hWnd, szNPInstance,"","","","","","");
00369     WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
00370   }
00371   else if(strcmp(szString, STRING_NPN_GETVALUE) == 0)
00372   {
00373     showArgControls7(hWnd, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE);
00374     enableEdits7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00375     setStaticTexts7(hWnd, "instance:", "variable:", "", "", "", "", "");
00376     setEditTexts7(hWnd, szNPInstance,"","","","","","");
00377     replaceEditWithCombo(hWnd, FALSE, TRUE, FALSE, FALSE);
00378     HWND hWndCombo = WinWindowFromID(hWnd, IDC_COMBO_ARG2);
00379     WinInsertLboxItem(hWndCombo, LIT_END, "NPNVxDisplay");
00380     WinInsertLboxItem(hWndCombo, LIT_END, "NPNVxtAppContext");
00381     WinInsertLboxItem(hWndCombo, LIT_END, "NPNVnetscapeWindow");
00382     WinInsertLboxItem(hWndCombo, LIT_END, "NPNVjavascriptEnabledBool");
00383     WinInsertLboxItem(hWndCombo, LIT_END, "NPNVasdEnabledBool");
00384     WinInsertLboxItem(hWndCombo, LIT_END, "NPNVisOfflineBool");
00385     WinSendMsg(hWndCombo, LM_SELECTITEM, (MPARAM)0, (MPARAM)TRUE);
00386     WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
00387   }
00388   else if(strcmp(szString, STRING_NPN_SETVALUE) == 0)
00389   {
00390     showArgControls7(hWnd, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE);
00391     enableEdits7(hWnd, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE);
00392     setStaticTexts7(hWnd, "instance:", "variable:", "*value:", "", "", "", "");
00393     setEditTexts7(hWnd, szNPInstance,"","","","","","");
00394     replaceEditWithCombo(hWnd, FALSE, TRUE, FALSE, FALSE);
00395     HWND hWndCombo = WinWindowFromID(hWnd, IDC_COMBO_ARG2);
00396     WinInsertLboxItem(hWndCombo, LIT_END, "NPPVpluginNameString");
00397     WinInsertLboxItem(hWndCombo, LIT_END, "NPPVpluginDescriptionString");
00398     WinInsertLboxItem(hWndCombo, LIT_END, "NPPVpluginWindowBool");
00399     WinInsertLboxItem(hWndCombo, LIT_END, "NPPVpluginTransparentBool");
00400     WinInsertLboxItem(hWndCombo, LIT_END, "NPPVpluginWindowSize");
00401     WinInsertLboxItem(hWndCombo, LIT_END, "NPPVpluginKeepLibraryInMemory");
00402     WinSendMsg(hWndCombo, LM_SELECTITEM, (MPARAM)0, (MPARAM)TRUE);
00403     WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
00404   }
00405   else if(strcmp(szString, STRING_NPN_INVALIDATERECT) == 0)
00406   {
00407     showArgControls7(hWnd, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE);
00408     enableEdits7(hWnd, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE);
00409     setStaticTexts7(hWnd, "instance:", "top:", "left:", "bottom:", "right:", "", "");
00410     setEditTexts7(hWnd, szNPInstance,"0","0","0","0","","");
00411     WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
00412   }
00413   else if(strcmp(szString, STRING_NPN_INVALIDATEREGION) == 0)
00414   {
00415     showArgControls7(hWnd, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE);
00416     enableEdits7(hWnd, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE);
00417     setStaticTexts7(hWnd, "instance:", "region:", "", "", "", "", "");
00418     setEditTexts7(hWnd, szNPInstance,"0","0","0","0","","");
00419     WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
00420   }
00421   else if(strcmp(szString, STRING_NPN_FORCEREDRAW) == 0)
00422   {
00423     showArgControls7(hWnd, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00424     enableEdits7(hWnd, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
00425     setStaticTexts7(hWnd, "instance:", "", "", "", "", "", "");
00426     setEditTexts7(hWnd, szNPInstance,"","","","","","");
00427     WinShowWindow(WinWindowFromID(hWnd, IDC_BUTTON_PASTE), FALSE);
00428   }
00429   else
00430     assert(0);
00431 }
00432 
00433 /*      
00434 NPByteRange g_npByteRangeList[] = {
00435    {100, 100, npByteRangeList + 1},
00436    {200, 100, npByteRangeList + 2},
00437    {300, 100, 0}
00438 };
00439 */
00440 
00441 void onGo(HWND hWnd)
00442 {
00443   CPlugin * pPlugin = (CPlugin *)WinQueryWindowULong(hWnd, QWL_USER);
00444   assert(pPlugin != NULL);
00445 
00446   char szString[80];
00447   char sz1[128];
00448   char sz2[128];
00449   char sz3[128];
00450   char sz4[128];
00451   SHORT bTranslated;
00452 
00453   WinQueryWindowText(WinWindowFromID(hWnd, IDC_COMBO_API_CALL), sizeof(szString), szString);
00454 
00455   if(strcmp(szString, STRING_NPN_VERSION) == 0)
00456   {
00457     pPlugin->makeNPNCall(action_npn_version, DEFAULT_DWARG_VALUE, DEFAULT_DWARG_VALUE, 
00458                          DEFAULT_DWARG_VALUE, DEFAULT_DWARG_VALUE);
00459   }
00460   else if(strcmp(szString, STRING_NPN_GETURL) == 0)
00461   {
00462     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), sizeof(sz1), sz1);
00463     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(sz2), sz2);
00464     ULONG dwTarget = 0L;
00465     if(strcmp(sz2, "NULL") == 0)
00466       dwTarget = 0L;
00467     else
00468       dwTarget = (ULONG)sz2;
00469     pPlugin->makeNPNCall(action_npn_get_url, DEFAULT_DWARG_VALUE, (ULONG)sz1, dwTarget);
00470   }
00471   else if(strcmp(szString, STRING_NPN_GETURLNOTIFY) == 0)
00472   {
00473     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), sizeof(sz1), sz1);
00474     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(sz2), sz2);
00475     WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG4, &bTranslated, FALSE);
00476     ULONG dwData = (ULONG) bTranslated;
00477     ULONG dwTarget = 0L;
00478     if(strcmp(sz2, "NULL") == 0)
00479       dwTarget = 0L;
00480     else
00481       dwTarget = (ULONG)sz2;
00482     pPlugin->makeNPNCall(action_npn_get_url_notify, DEFAULT_DWARG_VALUE, (ULONG)sz1, dwTarget, dwData);
00483   }
00484   else if(strcmp(szString, STRING_NPN_REQUESTREAD) == 0)
00485   {
00486     extern NPByteRange * convertStringToNPByteRangeList(PSZ szString);
00487 
00488     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), sizeof(sz1), sz1);
00489     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(sz2), sz2);
00490     WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG4, &bTranslated, FALSE);
00491     ULONG dwData = (ULONG) bTranslated;
00492     ULONG dwTarget = 0L;
00493     NPByteRange *npByteRangeList = convertStringToNPByteRangeList(sz2);
00494     if (!npByteRangeList) { // use default szDefaultNPByteRangeList
00495       npByteRangeList = convertStringToNPByteRangeList(szDefaultNPByteRangeList);
00496     }
00497     pPlugin->m_firstAction = action_npn_request_read;
00498     dwData = (ULONG) npByteRangeList;
00499     pPlugin->makeNPNCall(action_npn_get_url_notify, DEFAULT_DWARG_VALUE, (ULONG)sz1, dwTarget, dwData);
00500   }
00501   else if(strcmp(szString, STRING_NPN_POSTURL) == 0)
00502   {
00503     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), sizeof(sz1), sz1);
00504     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(sz2), sz2);
00505     WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG4, &bTranslated, FALSE);
00506     ULONG dwLen = (ULONG) bTranslated;
00507     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG5), sizeof(sz3), sz3);
00508     SHORT index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG6));
00509     LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG6), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
00510     WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG6), LM_QUERYITEMTEXT,  MPFROM2SHORT(index, 128), (MPARAM)sz4);
00511     BOOL bFile = (strcmp(sz4, "TRUE") == 0) ? TRUE : FALSE;
00512     ULONG dwTarget = 0L;
00513     if(strcmp(sz2, "NULL") == 0)
00514       dwTarget = 0L;
00515     else
00516       dwTarget = (ULONG)sz2;
00517     pPlugin->makeNPNCall(action_npn_post_url, DEFAULT_DWARG_VALUE, (ULONG)sz1, dwTarget, dwLen, (ULONG)sz3, (ULONG)bFile);
00518   }
00519   else if(strcmp(szString, STRING_NPN_POSTURLNOTIFY) == 0)
00520   {
00521     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), sizeof(sz1), sz1);
00522     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(sz2), sz2);
00523     WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG4, &bTranslated, FALSE);
00524     ULONG dwLen = (ULONG) bTranslated;
00525     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG5), sizeof(sz3), sz3);
00526     SHORT index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG6));
00527     LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG6), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
00528     WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG6), LM_QUERYITEMTEXT,  MPFROM2SHORT(index, 128), (MPARAM)sz4);
00529     BOOL bFile = (strcmp(sz4, "TRUE") == 0) ? TRUE : FALSE;
00530     WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG7, &bTranslated, FALSE);
00531     ULONG dwData = (ULONG) bTranslated;
00532     ULONG dwTarget = 0L;
00533     if(strcmp(sz2, "NULL") == 0)
00534       dwTarget = 0L;
00535     else
00536       dwTarget = (ULONG)sz2;
00537     pPlugin->makeNPNCall(action_npn_post_url_notify, DEFAULT_DWARG_VALUE, (ULONG)sz1, dwTarget, dwLen, (ULONG)sz3, 
00538                          (ULONG)bFile, dwData);
00539   }
00540   else if(strcmp(szString, STRING_NPN_NEWSTREAM) == 0)
00541   {
00542     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), sizeof(sz1), sz1);
00543     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(sz2), sz2);
00544     pPlugin->makeNPNCall(action_npn_new_stream, DEFAULT_DWARG_VALUE, (ULONG)sz1, (ULONG)sz2, DEFAULT_DWARG_VALUE);
00545   }
00546   else if(strcmp(szString, STRING_NPN_DESTROYSTREAM) == 0)
00547   {
00548     SHORT index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG3));
00549     LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
00550     WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXT,  MPFROM2SHORT(index, 128), (MPARAM)sz1);
00551   
00552     NPError reason;
00553     if(strcmp(sz1, "NPRES_DONE") == 0)
00554       reason = NPRES_DONE;
00555     else if(strcmp(sz1, "NPRES_USER_BREAK") == 0)
00556       reason = NPRES_USER_BREAK;
00557     else if(strcmp(sz1, "NPRES_NETWORK_ERR") == 0)
00558       reason = NPRES_NETWORK_ERR;
00559     else
00560       reason = NPRES_DONE;
00561 
00562     pPlugin->makeNPNCall(action_npn_destroy_stream, DEFAULT_DWARG_VALUE, DEFAULT_DWARG_VALUE, (ULONG)reason);
00563   }
00564   else if(strcmp(szString, STRING_NPN_REQUESTREAD) == 0)
00565   {
00566   }
00567   else if(strcmp(szString, STRING_NPN_WRITE) == 0)
00568   {
00569     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG4), sizeof(sz1), sz1);
00570     WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG3, &bTranslated, FALSE);
00571     ULONG dwLen = (ULONG) bTranslated;
00572     pPlugin->makeNPNCall(action_npn_write, DEFAULT_DWARG_VALUE, DEFAULT_DWARG_VALUE, dwLen, (ULONG)sz1);
00573   }
00574   else if(strcmp(szString, STRING_NPN_STATUS) == 0)
00575   {
00576     WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG2), sizeof(sz1), sz1);
00577     pPlugin->makeNPNCall(action_npn_status, DEFAULT_DWARG_VALUE, (ULONG)sz1);
00578   }
00579   else if(strcmp(szString, STRING_NPN_USERAGENT) == 0)
00580   {
00581     pPlugin->makeNPNCall(action_npn_user_agent);
00582   }
00583   else if(strcmp(szString, STRING_NPN_MEMALLOC) == 0)
00584   {
00585     WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG1, &bTranslated, FALSE);
00586     ULONG dwSize = (ULONG) bTranslated;
00587     pPlugin->makeNPNCall(action_npn_mem_alloc, dwSize);
00588   }
00589   else if(strcmp(szString, STRING_NPN_MEMFREE) == 0)
00590   {
00591     pPlugin->makeNPNCall(action_npn_mem_free);
00592   }
00593   else if(strcmp(szString, STRING_NPN_MEMFLUSH) == 0)
00594   {
00595     WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG1, &bTranslated, FALSE);
00596     ULONG dwSize = (ULONG) bTranslated;
00597     pPlugin->makeNPNCall(action_npn_mem_flush, dwSize);
00598   }
00599   else if(strcmp(szString, STRING_NPN_RELOADPLUGINS) == 0)
00600   {
00601     SHORT index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG1));
00602     LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG1), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
00603     WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG1), LM_QUERYITEMTEXT,  MPFROM2SHORT(index, 128), (MPARAM)sz1);
00604     BOOL bReloadPages = (strcmp(sz1, "TRUE") == 0) ? TRUE : FALSE;
00605     pPlugin->makeNPNCall(action_npn_reload_plugins, (ULONG)bReloadPages);
00606   }
00607   else if(strcmp(szString, STRING_NPN_GETJAVAENV) == 0)
00608   {
00609     pPlugin->makeNPNCall(action_npn_get_java_env);
00610   }
00611   else if(strcmp(szString, STRING_NPN_GETJAVAPEER) == 0)
00612   {
00613     pPlugin->makeNPNCall(action_npn_get_java_peer);
00614   }
00615   else if(strcmp(szString, STRING_NPN_GETVALUE) == 0)
00616   {
00617     static ULONG dwValue = 0L;
00618     NPNVariable variable = (NPNVariable)NULL;
00619 
00620     SHORT index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG2));
00621     LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG2), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
00622     WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG2), LM_QUERYITEMTEXT,  MPFROM2SHORT(index, 128), (MPARAM)sz1);
00623     if(strcmp(sz1, "NPNVxDisplay") == 0)
00624       variable = NPNVxDisplay;
00625     else if(strcmp(sz1, "NPNVxtAppContext") == 0)
00626       variable = NPNVxtAppContext;
00627     else if(strcmp(sz1, "NPNVnetscapeWindow") == 0)
00628       variable = NPNVnetscapeWindow;
00629     else if(strcmp(sz1, "NPNVjavascriptEnabledBool") == 0)
00630       variable = NPNVjavascriptEnabledBool;
00631     else if(strcmp(sz1, "NPNVasdEnabledBool") == 0)
00632       variable = NPNVasdEnabledBool;
00633     else if(strcmp(sz1, "NPNVisOfflineBool") == 0)
00634       variable = NPNVisOfflineBool;
00635 
00636     pPlugin->m_pValue = (void *)&dwValue;
00637 
00638     pPlugin->makeNPNCall(action_npn_get_value, DEFAULT_DWARG_VALUE, (ULONG)variable, DEFAULT_DWARG_VALUE);
00639   }
00640   else if(strcmp(szString, STRING_NPN_SETVALUE) == 0)
00641   {
00642     NPPVariable variable = (NPPVariable)NULL;
00643     static char szStringValue[256];
00644     static BOOL bBoolValue;
00645 
00646     SHORT index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG2));
00647     LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG2), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
00648     WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG2), LM_QUERYITEMTEXT,  MPFROM2SHORT(index, 128), (MPARAM)sz1);
00649     if(strcmp(sz1, "NPPVpluginNameString") == 0)
00650     {
00651       variable = NPPVpluginNameString;
00652       WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(szStringValue), szStringValue);
00653       pPlugin->m_pValue = (void *)&szStringValue[0];
00654     }
00655     else if(strcmp(sz1, "NPPVpluginDescriptionString") == 0)
00656     {
00657       variable = NPPVpluginDescriptionString;
00658       WinQueryWindowText(WinWindowFromID(hWnd, IDC_EDIT_ARG3), sizeof(szStringValue), szStringValue);
00659       pPlugin->m_pValue = (void *)&szStringValue[0];
00660     }
00661     else if(strcmp(sz1, "NPPVpluginWindowBool") == 0)
00662     {
00663       variable = NPPVpluginWindowBool;
00664       index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG3));
00665       LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
00666       WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXT,  MPFROM2SHORT(index, 256), (MPARAM)szStringValue);
00667       bBoolValue = (strcmp(szStringValue, "TRUE") == 0) ? TRUE : FALSE;
00668       pPlugin->m_pValue = (void *)&bBoolValue;
00669     }
00670     else if(strcmp(sz1, "NPPVpluginTransparentBool") == 0)
00671     {
00672       variable = NPPVpluginTransparentBool;
00673       index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG3));
00674       LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
00675       WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXT,  MPFROM2SHORT(index, 256), (MPARAM)szStringValue);
00676       bBoolValue = (strcmp(szStringValue, "TRUE") == 0) ? TRUE : FALSE;
00677       pPlugin->m_pValue = (void *)&bBoolValue;
00678     }
00679     else if(strcmp(sz1, "NPPVpluginWindowSize") == 0)
00680     {
00681       variable = NPPVpluginWindowSize;
00682       static NPSize npsize;
00683       WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG3, &bTranslated, TRUE);
00684       npsize.width = bTranslated;
00685       WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG4, &bTranslated, TRUE);
00686       npsize.height = bTranslated;
00687       pPlugin->m_pValue = (void *)&npsize;
00688     }
00689     else if(strcmp(sz1, "NPPVpluginKeepLibraryInMemory") == 0)
00690     {
00691       variable = NPPVpluginKeepLibraryInMemory;
00692       index = WinQueryLboxSelectedItem(WinWindowFromID(hWnd, IDC_COMBO_ARG3));
00693       LONG maxchar = (LONG)WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXTLENGTH, MPFROMSHORT(index), (MPARAM)NULL);
00694       WinSendMsg(WinWindowFromID(hWnd, IDC_COMBO_ARG3), LM_QUERYITEMTEXT,  MPFROM2SHORT(index, 256), (MPARAM)szStringValue);
00695       bBoolValue = (strcmp(szStringValue, "TRUE") == 0) ? TRUE : FALSE;
00696       pPlugin->m_pValue = (void *)&bBoolValue;
00697     }
00698     pPlugin->makeNPNCall(action_npn_set_value, DEFAULT_DWARG_VALUE, (ULONG)variable, DEFAULT_DWARG_VALUE);
00699   }
00700   else if(strcmp(szString, STRING_NPN_INVALIDATERECT) == 0)
00701   {
00702     static NPRect nprect;
00703     WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG2, &bTranslated, TRUE);
00704     nprect.top = bTranslated;
00705     WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG3, &bTranslated, TRUE);
00706     nprect.left = bTranslated;
00707     WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG4, &bTranslated, TRUE);
00708     nprect.bottom = bTranslated;
00709     WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG5, &bTranslated, TRUE);
00710     nprect.right = bTranslated;
00711     pPlugin->makeNPNCall(action_npn_invalidate_rect, DEFAULT_DWARG_VALUE, (ULONG)&nprect);
00712   }
00713   else if(strcmp(szString, STRING_NPN_INVALIDATEREGION) == 0)
00714   {
00715     WinQueryDlgItemShort(hWnd, IDC_EDIT_ARG2, &bTranslated, FALSE);
00716     int i = bTranslated;
00717     pPlugin->makeNPNCall(action_npn_invalidate_region, DEFAULT_DWARG_VALUE, (ULONG)i);
00718   }
00719   else if(strcmp(szString, STRING_NPN_FORCEREDRAW) == 0)
00720   {
00721     pPlugin->makeNPNCall(action_npn_force_redraw);
00722   }
00723   else
00724     assert(0);
00725 }
00726 
00727 void onPaste(HWND hWndToPasteTo)
00728 {
00729   if(hWndToPasteTo == NULL)
00730     return;
00731   if(!WinOpenClipbrd(NULL))
00732     return;
00733   WinSendMsg(hWndToPasteTo, EM_PASTE, 0, 0);
00734   WinCloseClipbrd(NULL);
00735 }