From 16f504a9dca3fe3b70568f67b7d41241ae485288 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 18:49:04 +0200 Subject: Adding upstream version 7.0.6-dfsg. Signed-off-by: Daniel Baumann --- .../xpcom18a4/nsprpub/pr/tests/w16gui/.cvsignore | 1 + .../xpcom18a4/nsprpub/pr/tests/w16gui/Makefile.in | 99 +++ .../xpcom18a4/nsprpub/pr/tests/w16gui/popfile.c | 167 +++++ .../xpcom18a4/nsprpub/pr/tests/w16gui/popfind.c | 149 +++++ .../xpcom18a4/nsprpub/pr/tests/w16gui/popfont.c | 94 +++ .../xpcom18a4/nsprpub/pr/tests/w16gui/poppad.c | 672 +++++++++++++++++++++ .../xpcom18a4/nsprpub/pr/tests/w16gui/poppad.h | 66 ++ .../xpcom18a4/nsprpub/pr/tests/w16gui/poppad.ico | Bin 0 -> 326 bytes .../xpcom18a4/nsprpub/pr/tests/w16gui/poppad.rc | 121 ++++ .../xpcom18a4/nsprpub/pr/tests/w16gui/popprnt0.c | 49 ++ .../xpcom18a4/nsprpub/pr/tests/w16gui/readme.1st | 37 ++ 11 files changed, 1455 insertions(+) create mode 100644 src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/.cvsignore create mode 100644 src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/Makefile.in create mode 100644 src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popfile.c create mode 100644 src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popfind.c create mode 100644 src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popfont.c create mode 100644 src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.c create mode 100644 src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.h create mode 100644 src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.ico create mode 100644 src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.rc create mode 100644 src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popprnt0.c create mode 100644 src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/readme.1st (limited to 'src/libs/xpcom18a4/nsprpub/pr/tests/w16gui') diff --git a/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/.cvsignore b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/Makefile.in b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/Makefile.in new file mode 100644 index 00000000..ead153ea --- /dev/null +++ b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/Makefile.in @@ -0,0 +1,99 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla 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/MPL/ +# +# 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 the Netscape Portable Runtime (NSPR). +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998-2000 +# 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 MPL, 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 MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +#! gmake + + + +MOD_DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(MOD_DEPTH)/config/autoconf.mk + +include $(topsrcdir)/config/config.mk + +W16STDIO = $(MOD_DEPTH)/pr/src/md/windows/$(OBJDIR)/w16stdio.$(OBJ_SUFFIX) + +CSRCS = poppad.c \ + popfile.c \ + popfont.c \ + popfind.c \ + popprnt0.c + + +INCLUDES = -I$(dist_includedir) +LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib +LIBPLDS = $(dist_libdir)/plds$(MOD_MAJOR_VERSION).lib +TARGETS = $(OBJDIR)/poppad.exe +OS_CFLAGS = $(OS_EXE_CFLAGS) + +include $(topsrcdir)/config/rules.mk + + +ifeq ($(OS_TARGET),WIN16) +$(OBJDIR)/poppad.exe: $(OBJS) + @$(MAKE_OBJDIR) + echo system windows >w16link + echo name $@ >>w16link + echo option map >>w16link + echo option stack=16K >>w16link + echo debug $(DEBUGTYPE) all >>w16link + echo file >>w16link + echo $(OBJDIR)\\poppad.$(OBJ_SUFFIX), >>w16link + echo $(OBJDIR)\\popfile.$(OBJ_SUFFIX), >>w16link + echo $(OBJDIR)\\popfont.$(OBJ_SUFFIX), >>w16link + echo $(OBJDIR)\\popfind.$(OBJ_SUFFIX), >>w16link + echo $(OBJDIR)\\popprnt0.$(OBJ_SUFFIX), >>w16link + echo $(W16STDIO) >>w16link + echo library $(LIBPR) >>w16link + echo library $(LIBPLDS) >>w16link + echo library clibl, commdlg >>w16link + echo library winsock.lib >>w16link + wlink @w16link. + wrc -bt=windows poppad.rc $(OBJDIR)\\poppad.exe +else +$(OBJDIR)/poppad.exe: $(OBJS) + link $(LDOPTS) $< $(LIBPLC) $(LIBPR) wsock32.lib -out:$@ +endif + +export:: $(TARGETS) + + +clean:: + rm -rf $(TARGETS) diff --git a/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popfile.c b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popfile.c new file mode 100644 index 00000000..9aa7187d --- /dev/null +++ b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popfile.c @@ -0,0 +1,167 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla 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/MPL/ + * + * 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 the Netscape Portable Runtime (NSPR). + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * 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 MPL, 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 MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/*------------------------------------------ + POPFILE.C -- Popup Editor File Functions + (c) Charles Petzold, 1992 + ------------------------------------------*/ + +#include +#include +#include + +static OPENFILENAME ofn ; + +void PopFileInitialize (HWND hwnd) + { + static char *szFilter[] = { "Text Files (*.TXT)", "*.txt", + "ASCII Files (*.ASC)", "*.asc", + "All Files (*.*)", "*.*", + "" } ; + + ofn.lStructSize = sizeof (OPENFILENAME) ; + ofn.hwndOwner = hwnd ; + ofn.hInstance = NULL ; + ofn.lpstrFilter = szFilter [0] ; + ofn.lpstrCustomFilter = NULL ; + ofn.nMaxCustFilter = 0 ; + ofn.nFilterIndex = 0 ; + ofn.lpstrFile = NULL ; // Set in Open and Close functions + ofn.nMaxFile = _MAX_PATH ; + ofn.lpstrFileTitle = NULL ; // Set in Open and Close functions + ofn.nMaxFileTitle = _MAX_FNAME + _MAX_EXT ; + ofn.lpstrInitialDir = NULL ; + ofn.lpstrTitle = NULL ; + ofn.Flags = 0 ; // Set in Open and Close functions + ofn.nFileOffset = 0 ; + ofn.nFileExtension = 0 ; + ofn.lpstrDefExt = "txt" ; + ofn.lCustData = 0L ; + ofn.lpfnHook = NULL ; + ofn.lpTemplateName = NULL ; + } + +BOOL PopFileOpenDlg (HWND hwnd, LPSTR lpstrFileName, LPSTR lpstrTitleName) + { + ofn.hwndOwner = hwnd ; + ofn.lpstrFile = lpstrFileName ; + ofn.lpstrFileTitle = lpstrTitleName ; + ofn.Flags = OFN_CREATEPROMPT ; + + return GetOpenFileName (&ofn) ; + } + +BOOL PopFileSaveDlg (HWND hwnd, LPSTR lpstrFileName, LPSTR lpstrTitleName) + { + ofn.hwndOwner = hwnd ; + ofn.lpstrFile = lpstrFileName ; + ofn.lpstrFileTitle = lpstrTitleName ; + ofn.Flags = OFN_OVERWRITEPROMPT ; + + return GetSaveFileName (&ofn) ; + } + +static long PopFileLength (int hFile) + { + long lCurrentPos = _llseek (hFile, 0L, 1) ; + long lFileLength = _llseek (hFile, 0L, 2) ; + + _llseek (hFile, lCurrentPos, 0) ; + + return lFileLength ; + } + +BOOL PopFileRead (HWND hwndEdit, LPSTR lpstrFileName) + { + long lLength ; + HANDLE hBuffer ; + int hFile ; + LPSTR lpstrBuffer ; + + if (-1 == (hFile = _lopen (lpstrFileName, OF_READ | OF_SHARE_DENY_WRITE))) + return FALSE ; + + if ((lLength = PopFileLength (hFile)) >= 32000) + { + _lclose (hFile) ; + return FALSE ; + } + + if (NULL == (hBuffer = GlobalAlloc (GHND, lLength + 1))) + { + _lclose (hFile) ; + return FALSE ; + } + + lpstrBuffer = GlobalLock (hBuffer) ; + _lread (hFile, lpstrBuffer, (WORD) lLength) ; + _lclose (hFile) ; + lpstrBuffer [(WORD) lLength] = '\0' ; + + SetWindowText (hwndEdit, lpstrBuffer) ; + GlobalUnlock (hBuffer) ; + GlobalFree (hBuffer) ; + + return TRUE ; + } + +BOOL PopFileWrite (HWND hwndEdit, LPSTR lpstrFileName) + { + HANDLE hBuffer ; + int hFile ; + LPSTR lpstrBuffer ; + WORD wLength ; + + if (-1 == (hFile = _lopen (lpstrFileName, OF_WRITE | OF_SHARE_EXCLUSIVE))) + if (-1 == (hFile = _lcreat (lpstrFileName, 0))) + return FALSE ; + + wLength = GetWindowTextLength (hwndEdit) ; + hBuffer = (HANDLE) SendMessage (hwndEdit, EM_GETHANDLE, 0, 0L) ; + lpstrBuffer = (LPSTR) LocalLock (hBuffer) ; + + if (wLength != _lwrite (hFile, lpstrBuffer, wLength)) + { + _lclose (hFile) ; + return FALSE ; + } + + _lclose (hFile) ; + LocalUnlock (hBuffer) ; + + return TRUE ; + } diff --git a/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popfind.c b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popfind.c new file mode 100644 index 00000000..023095ea --- /dev/null +++ b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popfind.c @@ -0,0 +1,149 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla 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/MPL/ + * + * 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 the Netscape Portable Runtime (NSPR). + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * 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 MPL, 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 MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/*-------------------------------------------------------- + POPFIND.C -- Popup Editor Search and Replace Functions + (c) Charles Petzold, 1992 + --------------------------------------------------------*/ + +#include +#include +#include +#define MAX_STRING_LEN 256 + +static char szFindText [MAX_STRING_LEN] ; +static char szReplText [MAX_STRING_LEN] ; + +HWND PopFindFindDlg (HWND hwnd) + { + static FINDREPLACE fr ; // must be static for modeless dialog!!! + + fr.lStructSize = sizeof (FINDREPLACE) ; + fr.hwndOwner = hwnd ; + fr.hInstance = NULL ; + fr.Flags = FR_HIDEUPDOWN | FR_HIDEMATCHCASE | FR_HIDEWHOLEWORD ; + fr.lpstrFindWhat = szFindText ; + fr.lpstrReplaceWith = NULL ; + fr.wFindWhatLen = sizeof (szFindText) ; + fr.wReplaceWithLen = 0 ; + fr.lCustData = 0 ; + fr.lpfnHook = NULL ; + fr.lpTemplateName = NULL ; + + return FindText (&fr) ; + } + +HWND PopFindReplaceDlg (HWND hwnd) + { + static FINDREPLACE fr ; // must be static for modeless dialog!!! + + fr.lStructSize = sizeof (FINDREPLACE) ; + fr.hwndOwner = hwnd ; + fr.hInstance = NULL ; + fr.Flags = FR_HIDEUPDOWN | FR_HIDEMATCHCASE | FR_HIDEWHOLEWORD ; + fr.lpstrFindWhat = szFindText ; + fr.lpstrReplaceWith = szReplText ; + fr.wFindWhatLen = sizeof (szFindText) ; + fr.wReplaceWithLen = sizeof (szReplText) ; + fr.lCustData = 0 ; + fr.lpfnHook = NULL ; + fr.lpTemplateName = NULL ; + + return ReplaceText (&fr) ; + } + +BOOL PopFindFindText (HWND hwndEdit, int *piSearchOffset, LPFINDREPLACE lpfr) + { + int iPos ; + LOCALHANDLE hLocal ; + LPSTR lpstrDoc, lpstrPos ; + + // Get a pointer to the edit document + + hLocal = (HWND) SendMessage (hwndEdit, EM_GETHANDLE, 0, 0L) ; + lpstrDoc = (LPSTR) LocalLock (hLocal) ; + + // Search the document for the find string + + lpstrPos = _fstrstr (lpstrDoc + *piSearchOffset, lpfr->lpstrFindWhat) ; + LocalUnlock (hLocal) ; + + // Return an error code if the string cannot be found + + if (lpstrPos == NULL) + return FALSE ; + + // Find the position in the document and the new start offset + + iPos = lpstrPos - lpstrDoc ; + *piSearchOffset = iPos + _fstrlen (lpfr->lpstrFindWhat) ; + + // Select the found text + + SendMessage (hwndEdit, EM_SETSEL, 0, + MAKELONG (iPos, *piSearchOffset)) ; + + return TRUE ; + } + +BOOL PopFindNextText (HWND hwndEdit, int *piSearchOffset) + { + FINDREPLACE fr ; + + fr.lpstrFindWhat = szFindText ; + + return PopFindFindText (hwndEdit, piSearchOffset, &fr) ; + } + +BOOL PopFindReplaceText (HWND hwndEdit, int *piSearchOffset, LPFINDREPLACE lpfr) + { + // Find the text + + if (!PopFindFindText (hwndEdit, piSearchOffset, lpfr)) + return FALSE ; + + // Replace it + + SendMessage (hwndEdit, EM_REPLACESEL, 0, (long) lpfr->lpstrReplaceWith) ; + + return TRUE ; + } + +BOOL PopFindValidFind (void) + { + return *szFindText != '\0' ; + } diff --git a/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popfont.c b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popfont.c new file mode 100644 index 00000000..5f28af70 --- /dev/null +++ b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popfont.c @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla 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/MPL/ + * + * 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 the Netscape Portable Runtime (NSPR). + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * 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 MPL, 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 MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/*------------------------------------------ + POPFONT.C -- Popup Editor Font Functions + (c) Charles Petzold, 1992 + ------------------------------------------*/ + +#include +#include + +static LOGFONT logfont ; +static HFONT hFont ; + +BOOL PopFontChooseFont (HWND hwnd) + { + CHOOSEFONT cf ; + + cf.lStructSize = sizeof (CHOOSEFONT) ; + cf.hwndOwner = hwnd ; + cf.hDC = NULL ; + cf.lpLogFont = &logfont ; + cf.iPointSize = 0 ; + cf.Flags = CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS + | CF_EFFECTS ; + cf.rgbColors = 0L ; + cf.lCustData = 0L ; + cf.lpfnHook = NULL ; + cf.lpTemplateName = NULL ; + cf.hInstance = NULL ; + cf.lpszStyle = NULL ; + cf.nFontType = 0 ; // Returned from ChooseFont + cf.nSizeMin = 0 ; + cf.nSizeMax = 0 ; + + return ChooseFont (&cf) ; + } + +void PopFontInitialize (HWND hwndEdit) + { + GetObject (GetStockObject (SYSTEM_FONT), sizeof (LOGFONT), + (LPSTR) &logfont) ; + hFont = CreateFontIndirect (&logfont) ; + SendMessage (hwndEdit, WM_SETFONT, hFont, 0L) ; + } + +void PopFontSetFont (HWND hwndEdit) + { + HFONT hFontNew ; + + hFontNew = CreateFontIndirect (&logfont) ; + SendMessage (hwndEdit, WM_SETFONT, hFontNew, 0L) ; + DeleteObject (hFont) ; + hFont = hFontNew ; + } + +void PopFontDeinitialize (void) + { + DeleteObject (hFont) ; + } diff --git a/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.c b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.c new file mode 100644 index 00000000..c62ef23b --- /dev/null +++ b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.c @@ -0,0 +1,672 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla 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/MPL/ + * + * 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 the Netscape Portable Runtime (NSPR). + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * 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 MPL, 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 MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/*--------------------------------------- + POPPAD.C -- Popup Editor + (c) Charles Petzold, 1992 + ---------------------------------------*/ + +#include "nspr.h" +#include "plevent.h" +#include +#include +#include +#include "poppad.h" +#include + +#define EDITID 1 +#define UNTITLED "(untitled)" + +long FAR PASCAL _export WndProc (HWND, UINT, UINT, LONG) ; +BOOL FAR PASCAL _export AboutDlgProc (HWND, UINT, UINT, LONG) ; + +/* Declarations for NSPR customization +** +*/ +typedef struct PadEvent +{ + PLEvent plEvent; + int unused; +} PadEvent; + +static void PR_CALLBACK TimerThread( void *arg); +static void PR_CALLBACK HandlePadEvent( PadEvent *padEvent ); +static void PR_CALLBACK DestroyPadEvent( PadEvent *padevent ); +static PRThread *tThread; +static PLEventQueue *padQueue; +static int quitSwitch = 0; +static long ThreadSleepTime = 1000; +static long timerCount = 0; +static char *startMessage = "Poppad: NSPR GUI and event test program.\n" + "You should see lines of 50 characters\n" + "with a new character appearing at 1 second intervals.\n" + "Every 10 seconds gets a '+'; every 5 seconds gets a '_';\n" + "every 1 second gets a '.'.\n\n" + "You should be able to type in the window.\n\n\n"; + + + // Functions in POPFILE.C + +void PopFileInitialize (HWND) ; +BOOL PopFileOpenDlg (HWND, LPSTR, LPSTR) ; +BOOL PopFileSaveDlg (HWND, LPSTR, LPSTR) ; +BOOL PopFileRead (HWND, LPSTR) ; +BOOL PopFileWrite (HWND, LPSTR) ; + + // Functions in POPFIND.C + +HWND PopFindFindDlg (HWND) ; +HWND PopFindReplaceDlg (HWND) ; +BOOL PopFindFindText (HWND, int *, LPFINDREPLACE) ; +BOOL PopFindReplaceText (HWND, int *, LPFINDREPLACE) ; +BOOL PopFindNextText (HWND, int *) ; +BOOL PopFindValidFind (void) ; + + // Functions in POPFONT.C + +void PopFontInitialize (HWND) ; +BOOL PopFontChooseFont (HWND) ; +void PopFontSetFont (HWND) ; +void PopFontDeinitialize (void) ; + + // Functions in POPPRNT.C + +BOOL PopPrntPrintFile (HANDLE, HWND, HWND, LPSTR) ; + + // Global variables + +static char szAppName [] = "PopPad" ; +static HWND hDlgModeless ; +static HWND hwndEdit ; + +int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance, + LPSTR lpszCmdLine, int nCmdShow) + { + MSG msg; + HWND hwnd ; + HANDLE hAccel ; + WNDCLASS wndclass ; + + PR_STDIO_INIT(); + PR_Init(0, 0, 0); + + if (!hPrevInstance) + { + wndclass.style = CS_HREDRAW | CS_VREDRAW ; + wndclass.lpfnWndProc = WndProc ; + wndclass.cbClsExtra = 0 ; + wndclass.cbWndExtra = 0 ; + wndclass.hInstance = hInstance ; + wndclass.hIcon = LoadIcon (hInstance, szAppName) ; + wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ; + wndclass.hbrBackground = GetStockObject (WHITE_BRUSH) ; + wndclass.lpszMenuName = szAppName ; + wndclass.lpszClassName = szAppName ; + + RegisterClass (&wndclass) ; + } + + hwnd = CreateWindow (szAppName, NULL, + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + NULL, NULL, hInstance, lpszCmdLine) ; + + ShowWindow (hwnd, nCmdShow) ; + UpdateWindow (hwnd); + + hAccel = LoadAccelerators (hInstance, szAppName) ; + + for(;;) + { + if ( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE )) + { + if (GetMessage(&msg, NULL, 0, 0)) + { + if (hDlgModeless == NULL || !IsDialogMessage (hDlgModeless, &msg)) + { + if (!TranslateAccelerator (hwnd, hAccel, &msg)) + { + TranslateMessage (&msg) ; + DispatchMessage (&msg) ; + } /* end if !TranslateAccelerator */ + } + } + else + { + break; + } /* end if GetMessage() */ + } + else /* !PeekMessage */ + { + PR_Sleep(50); + }/* end if PeekMessage() */ + } /* end for() */ + + PR_JoinThread( tThread ); + PL_DestroyEventQueue( padQueue ); + PR_Cleanup(); + return msg.wParam ; + } + +void DoCaption (HWND hwnd, char *szTitleName) + { + char szCaption [64 + _MAX_FNAME + _MAX_EXT] ; + + wsprintf (szCaption, "%s - %s", (LPSTR) szAppName, + (LPSTR) (szTitleName [0] ? szTitleName : UNTITLED)) ; + + SetWindowText (hwnd, szCaption) ; + } + +void OkMessage (HWND hwnd, char *szMessage, char *szTitleName) + { + char szBuffer [64 + _MAX_FNAME + _MAX_EXT] ; + + wsprintf (szBuffer, szMessage, + (LPSTR) (szTitleName [0] ? szTitleName : UNTITLED)) ; + + MessageBox (hwnd, szBuffer, szAppName, MB_OK | MB_ICONEXCLAMATION) ; + } + +short AskAboutSave (HWND hwnd, char *szTitleName) + { + char szBuffer [64 + _MAX_FNAME + _MAX_EXT] ; + short nReturn ; + + wsprintf (szBuffer, "Save current changes in %s?", + (LPSTR) (szTitleName [0] ? szTitleName : UNTITLED)) ; + + nReturn = MessageBox (hwnd, szBuffer, szAppName, + MB_YESNOCANCEL | MB_ICONQUESTION) ; + + if (nReturn == IDYES) + if (!SendMessage (hwnd, WM_COMMAND, IDM_SAVE, 0L)) + nReturn = IDCANCEL ; + + return nReturn ; + } + +long FAR PASCAL _export WndProc (HWND hwnd, UINT message, UINT wParam, + LONG lParam) + { + static BOOL bNeedSave = FALSE ; + static char szFileName [_MAX_PATH] ; + static char szTitleName [_MAX_FNAME + _MAX_EXT] ; + static FARPROC lpfnAboutDlgProc ; + static HANDLE hInst ; + static int iOffset ; + static UINT messageFindReplace ; + LONG lSelect ; + LPFINDREPLACE lpfr ; + WORD wEnable ; + + switch (message) + { + case WM_CREATE: + // Get About dialog instance address + + hInst = ((LPCREATESTRUCT) lParam)->hInstance ; + lpfnAboutDlgProc = MakeProcInstance ((FARPROC) AboutDlgProc, + hInst) ; + + // Create the edit control child window + + hwndEdit = CreateWindow ("edit", NULL, + WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | + WS_BORDER | ES_LEFT | ES_MULTILINE | + ES_NOHIDESEL | ES_AUTOHSCROLL | ES_AUTOVSCROLL, + 0, 0, 0, 0, + hwnd, EDITID, hInst, NULL) ; + + SendMessage (hwndEdit, EM_LIMITTEXT, 32000, 0L) ; + + // Initialize common dialog box stuff + + PopFileInitialize (hwnd) ; + PopFontInitialize (hwndEdit) ; + + messageFindReplace = RegisterWindowMessage (FINDMSGSTRING) ; + + // Process command line + + lstrcpy (szFileName, (LPSTR) + (((LPCREATESTRUCT) lParam)->lpCreateParams)) ; + + if (lstrlen (szFileName) > 0) + { + GetFileTitle (szFileName, szTitleName, + sizeof (szTitleName)) ; + + if (!PopFileRead (hwndEdit, szFileName)) + OkMessage (hwnd, "File %s cannot be read!", + szTitleName) ; + } + + DoCaption (hwnd, szTitleName) ; + + /* Initialize Event Processing for NSPR + ** Retrieve the event queue just created + ** Create the TimerThread + */ + PL_InitializeEventsLib("someName"); + padQueue = PL_GetMainEventQueue(); + tThread = PR_CreateThread(PR_USER_THREAD, + TimerThread, + NULL, + PR_PRIORITY_NORMAL, + PR_LOCAL_THREAD, + PR_JOINABLE_THREAD, + 0 ); + return 0 ; + + case WM_SETFOCUS: + SetFocus (hwndEdit) ; + return 0 ; + + case WM_SIZE: + MoveWindow (hwndEdit, 0, 0, LOWORD (lParam), + HIWORD (lParam), TRUE) ; + return 0 ; + + case WM_INITMENUPOPUP: + switch (lParam) + { + case 1: // Edit menu + + // Enable Undo if edit control can do it + + EnableMenuItem (wParam, IDM_UNDO, + SendMessage (hwndEdit, EM_CANUNDO, 0, 0L) ? + MF_ENABLED : MF_GRAYED) ; + + // Enable Paste if text is in the clipboard + + EnableMenuItem (wParam, IDM_PASTE, + IsClipboardFormatAvailable (CF_TEXT) ? + MF_ENABLED : MF_GRAYED) ; + + // Enable Cut, Copy, and Del if text is selected + + lSelect = SendMessage (hwndEdit, EM_GETSEL, 0, 0L) ; + wEnable = HIWORD (lSelect) != LOWORD (lSelect) ? + MF_ENABLED : MF_GRAYED ; + + EnableMenuItem (wParam, IDM_CUT, wEnable) ; + EnableMenuItem (wParam, IDM_COPY, wEnable) ; + EnableMenuItem (wParam, IDM_DEL, wEnable) ; + break ; + + case 2: // Search menu + + // Enable Find, Next, and Replace if modeless + // dialogs are not already active + + wEnable = hDlgModeless == NULL ? + MF_ENABLED : MF_GRAYED ; + + EnableMenuItem (wParam, IDM_FIND, wEnable) ; + EnableMenuItem (wParam, IDM_NEXT, wEnable) ; + EnableMenuItem (wParam, IDM_REPLACE, wEnable) ; + break ; + } + return 0 ; + + case WM_COMMAND : + // Messages from edit control + + if (LOWORD (lParam) && wParam == EDITID) + { + switch (HIWORD (lParam)) + { + case EN_UPDATE: + bNeedSave = TRUE ; + return 0 ; + + case EN_ERRSPACE: + case EN_MAXTEXT: + MessageBox (hwnd, "Edit control out of space.", + szAppName, MB_OK | MB_ICONSTOP) ; + return 0 ; + } + break ; + } + + switch (wParam) + { + // Messages from File menu + + case IDM_NEW: + if (bNeedSave && IDCANCEL == + AskAboutSave (hwnd, szTitleName)) + return 0 ; + + SetWindowText (hwndEdit, "\0") ; + szFileName [0] = '\0' ; + szTitleName [0] = '\0' ; + DoCaption (hwnd, szTitleName) ; + bNeedSave = FALSE ; + return 0 ; + + case IDM_OPEN: + if (bNeedSave && IDCANCEL == + AskAboutSave (hwnd, szTitleName)) + return 0 ; + + if (PopFileOpenDlg (hwnd, szFileName, szTitleName)) + { + if (!PopFileRead (hwndEdit, szFileName)) + { + OkMessage (hwnd, "Could not read file %s!", + szTitleName) ; + szFileName [0] = '\0' ; + szTitleName [0] = '\0' ; + } + } + + DoCaption (hwnd, szTitleName) ; + bNeedSave = FALSE ; + return 0 ; + + case IDM_SAVE: + if (szFileName [0]) + { + if (PopFileWrite (hwndEdit, szFileName)) + { + bNeedSave = FALSE ; + return 1 ; + } + else + OkMessage (hwnd, "Could not write file %s", + szTitleName) ; + return 0 ; + } + // fall through + case IDM_SAVEAS: + if (PopFileSaveDlg (hwnd, szFileName, szTitleName)) + { + DoCaption (hwnd, szTitleName) ; + + if (PopFileWrite (hwndEdit, szFileName)) + { + bNeedSave = FALSE ; + return 1 ; + } + else + OkMessage (hwnd, "Could not write file %s", + szTitleName) ; + } + return 0 ; + + case IDM_PRINT: + if (!PopPrntPrintFile (hInst, hwnd, hwndEdit, + szTitleName)) + OkMessage (hwnd, "Could not print file %s", + szTitleName) ; + return 0 ; + + case IDM_EXIT: + SendMessage (hwnd, WM_CLOSE, 0, 0L) ; + return 0 ; + + // Messages from Edit menu + + case IDM_UNDO: + SendMessage (hwndEdit, WM_UNDO, 0, 0L) ; + return 0 ; + + case IDM_CUT: + SendMessage (hwndEdit, WM_CUT, 0, 0L) ; + return 0 ; + + case IDM_COPY: + SendMessage (hwndEdit, WM_COPY, 0, 0L) ; + return 0 ; + + case IDM_PASTE: + SendMessage (hwndEdit, WM_PASTE, 0, 0L) ; + return 0 ; + + case IDM_DEL: + SendMessage (hwndEdit, WM_CLEAR, 0, 0L) ; + return 0 ; + + case IDM_SELALL: + SendMessage (hwndEdit, EM_SETSEL, 0, + MAKELONG (0, 32767)) ; + return 0 ; + + // Messages from Search menu + + case IDM_FIND: + iOffset = HIWORD ( + SendMessage (hwndEdit, EM_GETSEL, 0, 0L)) ; + hDlgModeless = PopFindFindDlg (hwnd) ; + return 0 ; + + case IDM_NEXT: + iOffset = HIWORD ( + SendMessage (hwndEdit, EM_GETSEL, 0, 0L)) ; + + if (PopFindValidFind ()) + PopFindNextText (hwndEdit, &iOffset) ; + else + hDlgModeless = PopFindFindDlg (hwnd) ; + + return 0 ; + + case IDM_REPLACE: + iOffset = HIWORD ( + SendMessage (hwndEdit, EM_GETSEL, 0, 0L)) ; + + hDlgModeless = PopFindReplaceDlg (hwnd) ; + return 0 ; + + case IDM_FONT: + if (PopFontChooseFont (hwnd)) + PopFontSetFont (hwndEdit) ; + + return 0 ; + + // Messages from Help menu + + case IDM_HELP: + OkMessage (hwnd, "Help not yet implemented!", NULL) ; + return 0 ; + + case IDM_ABOUT: + DialogBox (hInst, "AboutBox", hwnd, lpfnAboutDlgProc); + return 0 ; + } + break ; + + case WM_CLOSE: + if (!bNeedSave || IDCANCEL != AskAboutSave (hwnd, szTitleName)) + DestroyWindow (hwnd) ; + + return 0 ; + + case WM_QUERYENDSESSION: + if (!bNeedSave || IDCANCEL != AskAboutSave (hwnd, szTitleName)) + return 1L ; + + return 0 ; + + case WM_DESTROY: + PopFontDeinitialize () ; + PostQuitMessage (0) ; + quitSwitch = 1; + return 0 ; + + default: + // Process "Find-Replace" messages + + if (message == messageFindReplace) + { + lpfr = (LPFINDREPLACE) lParam ; + + if (lpfr->Flags & FR_DIALOGTERM) + hDlgModeless = NULL ; + + if (lpfr->Flags & FR_FINDNEXT) + if (!PopFindFindText (hwndEdit, &iOffset, lpfr)) + OkMessage (hwnd, "Text not found!", NULL) ; + + if (lpfr->Flags & FR_REPLACE || + lpfr->Flags & FR_REPLACEALL) + if (!PopFindReplaceText (hwndEdit, &iOffset, lpfr)) + OkMessage (hwnd, "Text not found!", NULL) ; + + if (lpfr->Flags & FR_REPLACEALL) + while (PopFindReplaceText (hwndEdit, &iOffset, lpfr)); + + return 0 ; + } + break ; + } + return DefWindowProc (hwnd, message, wParam, lParam) ; + } + +BOOL FAR PASCAL _export AboutDlgProc (HWND hDlg, UINT message, UINT wParam, + LONG lParam) + { + switch (message) + { + case WM_INITDIALOG: + return TRUE ; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + EndDialog (hDlg, 0) ; + return TRUE ; + } + break ; + } + return FALSE ; + } +/* +** TimerThread() -- The Main function of the timer pop thread +** +*/ +static void PR_CALLBACK TimerThread( void *arg) +{ + do { + PadEvent *ev; + + /* + ** Should we quit now? + */ + if ( quitSwitch ) + break; + /* + ** Create and Post the event the event + */ + PL_ENTER_EVENT_QUEUE_MONITOR( padQueue ); + ev = (PadEvent *) PR_NEW( PadEvent ); + PL_InitEvent( &ev->plEvent, NULL, + (PLHandleEventProc)HandlePadEvent, + (PLDestroyEventProc)DestroyPadEvent ); + PL_PostEvent( padQueue, &ev->plEvent ); + PL_EXIT_EVENT_QUEUE_MONITOR( padQueue ); + + PR_Sleep( ThreadSleepTime ); + } while(1); + return; +} + +/* +** HandlePadEvent() -- gets called because of PostEvent +*/ +static void PR_CALLBACK HandlePadEvent( PadEvent *padEvent ) +{ + if ( timerCount++ == 0 ) + { + char *cp; + + for ( cp = startMessage; *cp != 0 ; cp++ ) + { + SendMessage( hwndEdit, WM_CHAR, *cp, MAKELONG( *cp, 1 )); + } + } + /* + ** Send a WM_CHAR event the edit Window + */ + if ((timerCount % 10) == 0) + { + SendMessage( hwndEdit, WM_CHAR, '+', MAKELONG( '+', 1 )); + } + else if ((timerCount % 5) == 0) + { + SendMessage( hwndEdit, WM_CHAR, '_', MAKELONG( '_', 1 )); + } + else + { + SendMessage( hwndEdit, WM_CHAR, '.', MAKELONG( '.', 1 )); + } + + if ( (timerCount % 50) == 0) + { + SendMessage( hwndEdit, WM_CHAR, '\n', MAKELONG( '\n', 1 )); + } + + /* + ** PL_RevokeEvents() is broken. Test to fix it. + */ + { + static long revokeCounter = 0; + + if (revokeCounter++ > 10 ) + { + PR_Sleep( ThreadSleepTime * 10 ); + SendMessage( hwndEdit, WM_CHAR, '*', MAKELONG( '\n', 1 )); + PL_RevokeEvents( padQueue, NULL ); + revokeCounter = 0; + } + } + return; +} + +/* +** DestroyPadEvent() -- Called after HandlePadEvent() +*/ +static void PR_CALLBACK DestroyPadEvent( PadEvent *padevent ) +{ + PR_Free( padevent ); + return; +} diff --git a/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.h b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.h new file mode 100644 index 00000000..202095e5 --- /dev/null +++ b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.h @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla 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/MPL/ + * + * 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 the Netscape Portable Runtime (NSPR). + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * 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 MPL, 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 MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/*---------------------- + POPPAD.H header file + (c) Charles Petzold, 1992 + ----------------------*/ + +#define IDM_NEW 10 +#define IDM_OPEN 11 +#define IDM_SAVE 12 +#define IDM_SAVEAS 13 +#define IDM_PRINT 14 +#define IDM_EXIT 15 + +#define IDM_UNDO 20 +#define IDM_CUT 21 +#define IDM_COPY 22 +#define IDM_PASTE 23 +#define IDM_DEL 24 +#define IDM_SELALL 25 + +#define IDM_FIND 30 +#define IDM_NEXT 31 +#define IDM_REPLACE 32 + +#define IDM_FONT 40 + +#define IDM_HELP 50 +#define IDM_ABOUT 51 + +#define IDD_FNAME 10 diff --git a/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.ico b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.ico new file mode 100644 index 00000000..fe7097c5 Binary files /dev/null and b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.ico differ diff --git a/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.rc b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.rc new file mode 100644 index 00000000..227f5e4a --- /dev/null +++ b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/poppad.rc @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla 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/MPL/ + * + * 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 the Netscape Portable Runtime (NSPR). + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * 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 MPL, 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 MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/*--------------------------- + POPPAD.RC resource script + ---------------------------*/ + +#include +#include "poppad.h" + +PopPad ICON "poppad.ico" + +PopPad MENU + { + POPUP "&File" + { + MENUITEM "&New", IDM_NEW + MENUITEM "&Open...", IDM_OPEN + MENUITEM "&Save", IDM_SAVE + MENUITEM "Save &As...", IDM_SAVEAS + MENUITEM SEPARATOR + MENUITEM "&Print...", IDM_PRINT + MENUITEM SEPARATOR + MENUITEM "E&xit", IDM_EXIT + } + POPUP "&Edit" + { + MENUITEM "&Undo\tCtrl+Z", IDM_UNDO + MENUITEM SEPARATOR + MENUITEM "Cu&t\tCtrl+X", IDM_CUT + MENUITEM "&Copy\tCtrl+C", IDM_COPY + MENUITEM "&Paste\tCtrl+V", IDM_PASTE + MENUITEM "De&lete\tDel", IDM_DEL + MENUITEM SEPARATOR + MENUITEM "&Select All", IDM_SELALL + } + POPUP "&Search" + { + MENUITEM "&Find...", IDM_FIND + MENUITEM "Find &Next\tF3", IDM_NEXT + MENUITEM "&Replace...", IDM_REPLACE + } + POPUP "&Character" + { + MENUITEM "&Font...", IDM_FONT + } + POPUP "&Help" + { + MENUITEM "&Help", IDM_HELP + MENUITEM "&About PopPad...", IDM_ABOUT + } + } + +PopPad ACCELERATORS + { + "^Z", IDM_UNDO + VK_BACK, IDM_UNDO, VIRTKEY, ALT + "^X", IDM_CUT + VK_DELETE, IDM_CUT, VIRTKEY, SHIFT + "^C", IDM_COPY + VK_INSERT, IDM_COPY, VIRTKEY, CONTROL + "^V", IDM_PASTE + VK_INSERT, IDM_PASTE, VIRTKEY, SHIFT + VK_DELETE, IDM_DEL, VIRTKEY + VK_F3, IDM_NEXT, VIRTKEY + VK_F1, IDM_HELP, VIRTKEY + } + +AboutBox DIALOG 20, 20, 160, 80 + STYLE WS_POPUP | WS_DLGFRAME + { + CTEXT "PopPad" -1, 0, 12, 160, 8 + ICON "PopPad" -1, 8, 8, 0, 0 + CTEXT "Popup Editor for Microsoft Windows" -1, 0, 36, 160, 8 + CTEXT "Copyright (c) Charles Petzold, 1992" -1, 0, 48, 160, 8 + DEFPUSHBUTTON "OK" IDOK, 64, 60, 32, 14, WS_GROUP + } + +PrintDlgBox DIALOG 20, 20, 100, 76 + STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE + CAPTION "PopPad" + { + CTEXT "Sending", -1, 0, 10, 100, 8 + CTEXT "", IDD_FNAME, 0, 20, 100, 8 + CTEXT "to print spooler.", -1, 0, 30, 100, 8 + DEFPUSHBUTTON "Cancel", IDCANCEL, 34, 50, 32, 14, WS_GROUP + } diff --git a/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popprnt0.c b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popprnt0.c new file mode 100644 index 00000000..4e76377f --- /dev/null +++ b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/popprnt0.c @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla 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/MPL/ + * + * 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 the Netscape Portable Runtime (NSPR). + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * 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 MPL, 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 MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/*--------------------------------------------------------------- + POPPRNT0.C -- Popup Editor Printing Functions (dummy version) + (c) Charles Petzold, 1992 + ---------------------------------------------------------------*/ + +#include + +BOOL PopPrntPrintFile (HANDLE hInst, HWND hwnd, HWND hwndEdit, + LPSTR lpstrTitleName) + { + return FALSE ; + } diff --git a/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/readme.1st b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/readme.1st new file mode 100644 index 00000000..afdf847f --- /dev/null +++ b/src/libs/xpcom18a4/nsprpub/pr/tests/w16gui/readme.1st @@ -0,0 +1,37 @@ +readme.1st. + +The files in the pr/tests/w16gui directory are taken +from "Programming Windows 3.1" by Charles Petzold, +specifically, the programs in chapter 14 related +to the "poppad4" sample application. + +These programs are compiled with nspr20 to test nspr 2.0 +and to demostrate the use of nspr in a gui application. + +Library (DLL) PLDSxx.lib PLDSxx.dll is required to be +linked with this test case. Functions in this dll are +in the source ns/nspr20/lib/ds/plevent.* files. + +Permission to use. + +The source for poppad.c are used under license from +Petzold. The license to use is stated in the book. +The following paragraph of the license grants that +use. + + 5. SAMPLE CODE. If the SOFTWARE includes Sample Code, then + Microsoft grants you a royalty-free right to reproduce and + distribute the sample code of the SOFTWARE provided that you: + (a) distribute the sample code only in conjunction with and + as part of your software product; (b) do not use Microsoft's + or its authors' names, logos, or trademarks to market your + software product; (c) include the copyright notice that appears + on the SOFTWARE on your product label and as a part of the + sign-on message for your software product; and (d) agree to + idemnify, hold harmless, and defend Microsoft and its authors + from and against any claims or lawsuits, including attorneys' + fees, that arise or result from the use or distribution of + your software product. + +lth. 9/24/97. + -- cgit v1.2.3