source: trunk/dll/input.c@ 1498

Last change on this file since 1498 was 1498, checked in by Gregg Young, 16 years ago

Changes to get FM2 to compile with the latest watcom 1.9 beta (mostly type casts of CHAR CONSTANT * to CHAR *). Changes to get the environment settings working everywhere again (broken by the change that moved commands to the INI); Added an environment size variable (set to 2048 which was the largest I found hard coded). Still need to find everywhere the environment size is set and use this variable.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1
2/***********************************************************************
3
4 $Id: input.c 1498 2010-01-18 00:57:01Z gyoung $
5
6 Input dialog procecedure
7
8 Copyright (c) 1993-98 M. Kimes
9 Copyright (c) 2005, 2010 Steven H. Levine
10
11 28 May 05 SHL Use saymsg
12 14 Jul 06 SHL Use Runtime_Error
13 22 Mar 07 GKY Use QWL_USER
14 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
15 17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
16
17***********************************************************************/
18
19#include <string.h>
20
21#define INCL_DOS
22#define INCL_WIN
23#define INCL_LONGLONG // dircnrs.h
24
25#include "fm3dll.h"
26#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
27#include "input.h"
28#include "fm3dlg.h"
29#include "fm3str.h"
30#include "errutil.h" // Dos_Error...
31#include "strutil.h" // GetPString
32#include "fm3dll.h"
33
34static PSZ pszSrcFile = __FILE__;
35
36MRESULT EXPENTRY InputDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
37{
38 // mp2 points at a structure of type STRINGINPARMS
39 STRINGINPARMS *psip;
40 PCSZ psz;
41
42 switch (msg) {
43 case WM_INITDLG:
44 if (!mp2) {
45 Runtime_Error(pszSrcFile, __LINE__, NULL);
46 WinDismissDlg(hwnd, 0);
47 break;
48 }
49 WinSetWindowPtr(hwnd, 0, (PVOID) mp2);
50 psip = (STRINGINPARMS *) mp2;
51 if (!WinSendDlgItemMsg(hwnd, STR_INPUT, EM_SETTEXTLIMIT,
52 MPFROM2SHORT(psip->inputlen, 0), MPVOID)) {
53 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, "setlimit failed");
54 WinDismissDlg(hwnd, 0);
55 break;
56 }
57 if (psip->prompt && *psip->prompt)
58 WinSetDlgItemText(hwnd, STR_PROMPT, (CHAR *) psip->prompt);
59 if (psip->ret && *psip->ret) {
60 WinSetDlgItemText(hwnd, STR_INPUT, psip->ret);
61 WinSendDlgItemMsg(hwnd, STR_INPUT, EM_SETSEL,
62 MPFROM2SHORT(0, strlen(psip->ret)), MPVOID);
63 }
64 *psip->ret = 0;
65 if (psip->title && *psip->title)
66 WinSetWindowText(hwnd, (CHAR *) psip->title);
67 break;
68
69 case WM_CONTROL: // don't care
70 return 0;
71
72 case WM_COMMAND:
73 switch (SHORT1FROMMP(mp1)) {
74 case DID_OK:
75 psip = WinQueryWindowPtr(hwnd, QWL_USER);
76 WinQueryDlgItemText(hwnd, STR_INPUT, psip->inputlen, psip->ret);
77 WinDismissDlg(hwnd, 1);
78 break;
79
80 case IDM_HELP:
81 psip = WinQueryWindowPtr(hwnd, QWL_USER);
82 psz = psip->help && *psip->help ?
83 psip->help : GetPString(IDS_ENTERTEXTHELPTEXT);
84
85 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, GetPString(IDS_HELPTEXT), psz);
86 break;
87
88 case DID_CANCEL:
89 WinDismissDlg(hwnd, 0);
90 break;
91 }
92 return 0;
93 }
94 return WinDefDlgProc(hwnd, msg, mp1, mp2);
95}
96
97#pragma alloc_text(FMINPUT,InputDlgProc)
Note: See TracBrowser for help on using the repository browser.