wine/programs/notepad/dialog.c
Alexandre Julliard dadf78ffa9 Release 980517
Sun May 17 16:23:56 1998  Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>

	* [file/profile.c]
	Fix the return value of PROFILE_GetSection

	* [misc/crtdll.c]
	Do _getdrive, fix _chdrive.

	* [misc/commdlg.c]
	First cut at ChooseColor[WA].

	* [misc/network.c]
	Do something sensible for WNetGetDirectoryType16.

Sun May 17 10:21:35 1998  Andreas Mohr <100.30936@germany.net>

	* [controls/menu.c]
	Fixed disabled sub menus with MF_BYPOSITION that were not disabled.

	* [misc/crtdll.c] [relay32/crtdll.spec] [include/winerror.h]
	Implemented fscanf, fsetpos, _access, _fpreset (thanks to Uwe Bonnes),
	and _ltoa. 

	* [loader/task.c]
	MakeProcInstance: must use CURRENT_DS if hInst == NULL.

	* [misc/shell.c]
	SHELL_GetResourceTable, InternalExtractIcon: fixed broken .ICO handling

	* [windows/winpos.c]
	DeferWindowPos: removed "same parent" requirement.
	Which doc states that this is required ?

Sat May 16 20:08:11 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [loader/module.c] [loader/ne/module.c]
	More NE module cleanups.

	* [loader/task.c]
	Fixed SwitchStackBack().

Fri May 15 10:04:27 1998  Marcus Meissner <marcus@jet.franken.de>

	* [configure.in][inlcude/acconfig.h]
	Fixed broken OSS check, added check for working sigaltstack,
	fixed broken statfs checks on some linux systems.

	* [files/directory.c][loader/pe_image.c][relay32/builtin.c]
	  [loader/module.c]
	Added handling of win32 module pathnames.

	* [relay32/wnaspi32.spec]
	New file.

	* [misc/lzexpand.c]
	LZCopy auto-decompresses LZ compressed files, even if they are not
	specially flagged. Fixes some InstallShield problems.

	* [misc/registry.c]
	Some fixes for RegQueryInfoKey (reference program monkey.exe
	from Win32 SDK works now better). Probably still has faults.

Fri May 15 08:58:58 1998  Martin Boehme <boehme@informatik.mu-luebeck.de>

	* [graphics/mapping.c] [include/dc.h] [include/gdi.h] [objects/dc.c]
	Reworked the way world transformations and mapping modes are handled
	so that both of these transformations can be computed in a single
	step.

	* [graphics/painting.c] [graphics/path.c] [include/path.h]
	More GDI path support.

	* [graphics/x11drv/graphics.c]
	Fixed the return value of GRAPH_DrawArc for the zero height /
	zero width case to reflect Windows' behaviour.

	* [include/windows.h] [relay32/gdi32.spec] [objects/dc.c]
	Implemented ModifyWorldTransform and CombineTransform.

Tue May 14 18:03:46 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [controls/commctrl.c][relay32/comctl32.spec]
	  [controls/*.c][include/*.h]
	Implemented InitCommonControlsEx (dll version 4.72 compatible).
	InitCommonControls calls ImageCommonControlsEx.
	Registering code of the common controls had to be changed
	(see XXXX_Register functions).

	* [controls/status.c][include/commctrl.h][include/status.h]
	Implemented most new features and fixed the look and feel.

	* [contols/commctrl.c][include/commctrl.h][relay32/comctl32.spec]
	Implemented MenuHelp (incomplete).

	* [controls/status.c][controls/progress.c]
	Changed allocation strategy for control specific memory.

	* [controls/header.c][include/header.h][include/commctrl.h]
	First implementation of header control.

	* [windows/defwnd.c][windows/syscolors.c]
	Fixed default control colors for Win95 look.

	* [windows/nonclient.c]
	Fixed off by one error for Win95 look. Top border of child windows
	should be visible.

	* [misc/imagelist.h]
	Improved documentation and fixed some bugs.

Thu May 14 15:42:21 1998  Robert Wilhelm  <robert@physiol.med.tu-muenchen.de>

	* [relay32/crtdll.spec]
	Added hypot,j0,j1,jn and ceil.

Wed May 13 19:10:10 1998  Pascal Cuoq <pcuoq@ens-lyon.fr>

	* [controls/listbox.c]
	Item height is now exactly font height.
	Wine listboxes now behave like Windows' when they are 
	created without WS_VSCROLL but the program subsequently 
	calls ShowScrollBar or SetScrollInfo.

Wed May 13 18:33:01 1998  Ulrich Weigand <weigand@informatik.uni-erlangen.de>

	* [relay32/relay386.c]
	Restore ES also in the non-debug case.

	* [windows/event.c]
	Bugfix: Blocking TSXNextEvent could deadlock Wine.

	* [win32/process.c] [windows/message.c]
	Silly stubs for MsgWaitForMultipleObjects / PostThreadMessage
	that make some programs run better.

	* [windows/winproc.c]
	WINPROC_MapMsg32Ato16/16To32A: added WM_NOTIFY.  

        * [win32/kernel32.c]
	Added 16->32 thunking and improved 32->16 thunking functions.

	* [tools/build.c]
	Added new variant of CallFrom16 stub for use with Win95 thunks.

	* [if1632/kernel.spec] [if1632/builtin.c] [win32/kernel32.c]
	Added a few undocumented KERNEL functions.

	* [loader/ne/module.c] [loader/ne/segment.c]
	Call DllEntryPoint for 16-bit DLLs with subsystem >= 4.0.

	* [win32/kernel32.spec] [win32/wow32.spec] [win32/ordinals.c]
	Use names from the Oct 94 beta release for undoc. functions.

Wed May 13 14:18:26 1998  Matthew Becker <mbecker@glasscity.net>

	* [misc/registry.c]
	Code cleanup.

	* [misc/cpu.c]
	Commented out the registry puts temporarily.

	* [programs/regtest/*]
	New registry testing program.

Tue May 12 22:54:03 1998  Michael Mess <michael@kawo2.rwth-aachen.de>

	* [multimedia/audio.c]
	ioctl's do not commute in /dev/dsp initialization.

Tue May 12 20:11:42 1998  Karl Garrison <karlos@eznet.net>

	* [win32/console.c]
	Implemented SetConsoleTextAttribute, FillConsoleOutputCharacter.
	Improved cursor positioning.
	This allows for text colors in an xterm, rxvt, or console.

Tue May 12 17:57:52 1998  Petter Reinholdtsen <pere@td.org.uit.no>

	* [Makefile.in]
	Create prefix/{bin|lib} directories if missing during install.

Sun May 10 19:37:51 1998  Jan Willamowius <jan@janhh.shnet.org>

	* [multimedia/mmio.c]
	Have mmioSetBuffer return success (0), so Corel Draw 4
	keeps working. (IO is still unbuffered)

Wed May  6 16:57:55 1998  James Juran <jrj120@psu.edu>

        * [Makefile.in] [Make.rules.in]
	Changed "make clean" to remove `textedit` backup files (*%)

	* [controls/menu.c][graphics/x11drv/xfont.c][include/libres.h]
	  [loader/main.c][loader/ne/module.c][scheduler/synchro.c]
	  [win32/time.c][windows/winpos.c][include/windows.h]
	Fixed miscellaneous compilation warnings.

	* [misc/main.c][miscemu/main.c][include/main.h]
	Moved prototypes to new include file main.h, various cleanups.

Tue May  5 21:05:06 1998  Morten Welinder  <terra@diku.dk>

	* [misc/winsock.c]
	Don't refer to __FreeBSD__ when HAVE_STRERROR is meant.

	* [misc/debugstr.c]
	For debug_dumpstrSend, send strings to stderr.

Tue May  5 21:47:40 1998  Huw D M Davies <h.davies1@physics.oxford.ac.uk>

	* [objects/region.c]
	Fix for REGION_RegionOp() if newReg is one of the source regions.

Tue May  5 18:27:32 1998  Jim Peterson <jspeter@roanoke.infi.net>

	* [misc/main.c]
	Add '-h/-help' option and print WINE_RELEASE_INFO with usage message.

	* [misc/spy.c]
	Realign trace messages.

Tue May  5 15:46:47 1998  Donnie V. Savage <dsavage@cisco.com>

	* [graphics/ddraw.c]
	Fixed compile warnings

	* [misc/winsock.c]
	Warnings should not be errors.

Tue May  5 13:40:42 1998  Jim Peterson <jspeter@roanoke.infi.net>

	* [*/*]
	Remove many warnings through explicit casts, added #include's,
	and corrected printf formats.

Tue May  5 05:18:12 1998  Insomnia (Stea Greene) <insomnia@core.binghamton.edu>

	* [graphics/ddraw.c]
	Kept unchanged portion of old palette when changing only a few
	palette entries.  Really should only deallocate the changed cells.
	This make StarCraft work almost perfectly (sound overflows still
	cause static).

Mon May  4 15:04:57 1998  Alexander V. Lukyanov <lav@long.yar.ru>

	* [misc/lstr.c]
	FormatMessage: terminate string on %0, undo linefeed strip.
1998-05-17 17:13:43 +00:00

466 lines
11 KiB
C

/*
* Notepad
*
* Copyright 1998 Marcel Baur <mbaur@g26.ethz.ch>
*/
#include <stdio.h>
#include "windows.h"
#include "commdlg.h"
#include "winnls.h"
#include "winerror.h"
#ifdef WINELIB
#include "shell.h"
#include "options.h"
#endif
#include "main.h"
#include "license.h"
#include "language.h"
#include "dialog.h"
#include "version.h"
#include "debug.h"
static LRESULT DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
int AlertIDS(UINT ids_message, UINT ids_caption, WORD type) {
/*
* Given some ids strings, this acts as a language-aware wrapper for
* "MessageBox"
*/
CHAR szMessage[MAX_STRING_LEN];
CHAR szCaption[MAX_STRING_LEN];
LoadString(Globals.hInstance, ids_message, szMessage, sizeof(szMessage));
LoadString(Globals.hInstance, ids_caption, szCaption, sizeof(szCaption));
return (MessageBox(Globals.hMainWnd, szMessage, szCaption, type));
}
void AlertFileNotFound(LPCSTR szFilename) {
int nResult;
nResult = AlertIDS(IDS_NOTFOUND, IDS_ERROR, 0);
}
VOID AlertOutOfMemory(void) {
int nResult;
nResult = AlertIDS(IDS_OUT_OF_MEMORY, IDS_ERROR, 0);
PostQuitMessage(1);
}
BOOL ExistFile(LPCSTR szFilename) {
/*
* Returns: TRUE - if "szFileName" exists
* FALSE - if it does not
*/
WIN32_FIND_DATA32A entry;
HANDLE32 handle;
handle = FindFirstFile32A(szFilename, &entry);
return (handle!=INVALID_HANDLE_VALUE32);
}
VOID DoSaveFile(VOID) {
// Really Save the file
// ... (Globals.szFileName);
}
BOOL DoCloseFile(void) {
// Return value: TRUE - User agreed to close (both save/don't save)
// FALSE - User cancelled close by selecting "Cancel"
CHAR szMessage[MAX_STRING_LEN];
CHAR szCaption[MAX_STRING_LEN];
INT nResult;
if (strlen(Globals.szFileName)>0) {
// prompt user to save changes
// FIXME: The following resources are not yet in the .rc files
// szMessage, szCaption show up random values. Please keep these lines!
// LoadString(Globals.hInstance, ids_savechanges, szMessage, sizeof(szMessage));
// LoadString(Globals.hInstance, ids_savetitle, szCaption, sizeof(szCaption));
nResult = MessageBox(Globals.hMainWnd, szMessage, szCaption, MB_YESNOCANCEL);
switch (nResult) {
case IDYES: DoSaveFile();
break;
case IDNO: break;
case IDCANCEL: return(FALSE);
break;
default: return(FALSE);
break;
}
}
// Forget file name
lstrcpyn(Globals.szFileName, "\0", 1);
LANGUAGE_UpdateWindowCaption();
return(TRUE);
}
void DoOpenFile(LPCSTR szFileName) {
// Close any files and prompt to save changes
if (DoCloseFile) {
// Open file
lstrcpyn(Globals.szFileName, szFileName, strlen(szFileName)+1);
LANGUAGE_UpdateWindowCaption();
}
}
VOID DIALOG_FileNew(VOID)
{
// Close any files and promt to save changes
if (DoCloseFile()) {
// do nothing yet
}
}
VOID DIALOG_FileOpen(VOID)
{
OPENFILENAME openfilename;
CHAR szPath[MAX_PATHNAME_LEN];
CHAR szDir[MAX_PATHNAME_LEN];
CHAR szzFilter[2 * MAX_STRING_LEN + 100];
LPSTR p = szzFilter;
LoadString(Globals.hInstance, IDS_TEXT_FILES_TXT, p, MAX_STRING_LEN);
p += strlen(p) + 1;
lstrcpy(p, "*.txt");
p += strlen(p) + 1;
LoadString(Globals.hInstance, IDS_ALL_FILES, p, MAX_STRING_LEN);
p += strlen(p) + 1;
lstrcpy(p, "*.*");
p += strlen(p) + 1;
*p = '\0';
GetWindowsDirectory(szDir, sizeof(szDir));
openfilename.lStructSize = sizeof(openfilename);
openfilename.hwndOwner = Globals.hMainWnd;
openfilename.hInstance = Globals.hInstance;
openfilename.lpstrFilter = szzFilter;
openfilename.lpstrCustomFilter = 0;
openfilename.nMaxCustFilter = 0;
openfilename.nFilterIndex = 0;
openfilename.lpstrFile = szPath;
openfilename.nMaxFile = sizeof(szPath);
openfilename.lpstrFileTitle = 0;
openfilename.nMaxFileTitle = 0;
openfilename.lpstrInitialDir = szDir;
openfilename.lpstrTitle = 0;
openfilename.Flags = 0;
openfilename.nFileOffset = 0;
openfilename.nFileExtension = 0;
openfilename.lpstrDefExt = 0;
openfilename.lCustData = 0;
openfilename.lpfnHook = 0;
openfilename.lpTemplateName = 0;
if (GetOpenFileName(&openfilename)) {
if (ExistFile(openfilename.lpstrFile))
DoOpenFile(openfilename.lpstrFile);
else
AlertFileNotFound(openfilename.lpstrFile);
}
}
VOID DIALOG_FileSave(VOID)
{
fprintf(stderr, "FileSave()\n");
}
VOID DIALOG_FileSaveAs(VOID)
{
OPENFILENAME saveas;
CHAR szPath[MAX_PATHNAME_LEN];
CHAR szDir[MAX_PATHNAME_LEN];
CHAR szzFilter[2 * MAX_STRING_LEN + 100];
LPSTR p = szzFilter;
LoadString(Globals.hInstance, IDS_TEXT_FILES_TXT, p, MAX_STRING_LEN);
p += strlen(p) + 1;
lstrcpy(p, "*.txt");
p += strlen(p) + 1;
LoadString(Globals.hInstance, IDS_ALL_FILES, p, MAX_STRING_LEN);
p += strlen(p) + 1;
lstrcpy(p, "*.*");
p += strlen(p) + 1;
*p = '\0';
GetWindowsDirectory(szDir, sizeof(szDir));
saveas.lStructSize = 0;
saveas.hwndOwner = Globals.hMainWnd;
saveas.hInstance = Globals.hInstance;
saveas.lpstrFilter = szzFilter;
saveas.lpstrCustomFilter = 0;
saveas.nMaxCustFilter = 0;
saveas.nFilterIndex = 0;
saveas.lpstrFile = szPath;
saveas.nMaxFile = sizeof(szPath);
saveas.lpstrFileTitle = 0;
saveas.nMaxFileTitle = 0;
saveas.lpstrInitialDir = szDir;
saveas.lpstrTitle = 0;
saveas.Flags = 0;
saveas.nFileOffset = 0;
saveas.nFileExtension = 0;
saveas.lpstrDefExt = 0;
saveas.lCustData = 0;
saveas.lpfnHook = 0;
saveas.lpTemplateName = 0;
if (GetSaveFileName(&saveas)) {
lstrcpyn(Globals.szFileName, saveas.lpstrFile,
strlen(saveas.lpstrFile)+1);
LANGUAGE_UpdateWindowCaption();
DIALOG_FileSave();
}
}
VOID DIALOG_FilePrint(VOID)
{
PRINTDLG printer;
printer.lStructSize = sizeof(printer);
printer.hwndOwner = Globals.hMainWnd;
printer.hInstance = Globals.hInstance;
printer.hDevMode = 0;
printer.hDevNames = 0;
printer.hDC = 0;
printer.Flags = 0;
printer.nFromPage = 0;
printer.nToPage = 0;
printer.nMinPage = 0;
printer.nMaxPage = 0;
printer.nCopies = 0;
printer.lCustData = 0;
printer.lpfnPrintHook = 0;
printer.lpfnSetupHook = 0;
printer.lpPrintTemplateName = 0;
printer.lpSetupTemplateName = 0;
printer.hPrintTemplate = 0;
printer.hSetupTemplate = 0;
if (PrintDlg16(&printer)) {
// do nothing
};
}
VOID DIALOG_FilePageSetup(VOID)
{
DIALOG_PageSetup();
}
VOID DIALOG_FilePrinterSetup(VOID)
{
fprintf(stderr, "FilePrinterSetup()\n");
}
VOID DIALOG_FileExit(VOID)
{
if (DoCloseFile()) {
PostQuitMessage(0);
}
}
VOID DIALOG_EditUndo(VOID)
{
fprintf(stderr, "EditUndo()\n");
}
VOID DIALOG_EditCut(VOID)
{
fprintf(stderr, "EditCut()\n");
}
VOID DIALOG_EditCopy(VOID)
{
fprintf(stderr, "EditCopy()\n");
}
VOID DIALOG_EditPaste(VOID)
{
fprintf(stderr, "EditPaste()\n");
}
VOID DIALOG_EditDelete(VOID)
{
fprintf(stderr, "EditDelete()\n");
}
VOID DIALOG_EditSelectAll(VOID)
{
fprintf(stderr, "EditSelectAll()\n");
}
VOID DIALOG_EditTimeDate(VOID)
{
DIALOG_TimeDate();
}
VOID DIALOG_EditWrap(VOID)
{
Globals.bWrapLongLines = !Globals.bWrapLongLines;
CheckMenuItem(Globals.hEditMenu, NP_EDIT_WRAP, MF_BYCOMMAND |
(Globals.bWrapLongLines ? MF_CHECKED : MF_UNCHECKED));
}
VOID DIALOG_Search(VOID)
{
FINDREPLACE find;
CHAR szFind[MAX_PATHNAME_LEN];
lstrcpyn(szFind, Globals.szFindText, strlen(Globals.szFindText)+1);
find.lStructSize = sizeof(find);
find.hwndOwner = Globals.hMainWnd;
find.hInstance = Globals.hInstance;
find.lpstrFindWhat = szFind;
find.wFindWhatLen = sizeof(szFind);
find.Flags = 0;
find.lCustData = 0;
find.lpfnHook = 0;
find.lpTemplateName = 0;
if (FindText(&find)) {
lstrcpyn(Globals.szFindText, szFind, strlen(szFind)+1);
}
else
{
// do nothing yet
};
}
VOID DIALOG_SearchNext(VOID)
{
fprintf(stderr, "SearchNext()\n");
}
VOID DIALOG_HelpContents(VOID)
{
WinHelp(Globals.hMainWnd, HELPFILE, HELP_INDEX, 0);
}
VOID DIALOG_HelpSearch(VOID)
{
fprintf(stderr, "HelpSearch()\n");
}
VOID DIALOG_HelpHelp(VOID)
{
WinHelp(Globals.hMainWnd, HELPFILE, HELP_HELPONHELP, 0);
}
VOID DIALOG_HelpLicense(VOID)
{
WineLicense(Globals.hMainWnd, Globals.lpszLanguage);
}
VOID DIALOG_HelpNoWarranty(VOID)
{
WineWarranty(Globals.hMainWnd, Globals.lpszLanguage);
}
VOID DIALOG_HelpAboutWine(VOID)
{
ShellAbout(Globals.hMainWnd, "Notepad", "Notepad\n" WINE_RELEASE_INFO, 0);
}
/***********************************************************************
*
* DIALOG_PageSetup
*/
VOID DIALOG_PageSetup(VOID)
{
WNDPROC lpfnDlg = MakeProcInstance(DIALOG_PAGESETUP_DlgProc, Globals.hInstance);
DialogBox(Globals.hInstance, STRING_PAGESETUP_Xx, Globals.hMainWnd, lpfnDlg);
FreeProcInstance(lpfnDlg);
}
/***********************************************************************
*
* DIALOG_TimeDate
*/
VOID DIALOG_TimeDate(VOID)
{
// uses [KERNEL32.310] (ole2nls.c)
SYSTEMTIME st;
LPSYSTEMTIME lpst = &st;
CHAR szDate[MAX_STRING_LEN];
LPSTR date = szDate;
GetLocalTime(&st);
GetDateFormat(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, lpst, NULL, date, MAX_STRING_LEN);
printf("Date: %s\n", date);
GetDateFormat(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, lpst, NULL, date, MAX_STRING_LEN);
printf("Time: %s\n", date);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* DIALOG_PAGESETUP_DlgProc
*/
static LRESULT DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_COMMAND:
switch (wParam)
{
case IDOK:
EndDialog(hDlg, IDOK);
return TRUE;
case IDCANCEL:
EndDialog(hDlg, IDCANCEL);
return TRUE;
}
}
return FALSE;
}
/* Local Variables: */
/* c-file-style: "GNU" */
/* End: */