source: trunk/dll/input.c@ 1398

Last change on this file since 1398 was 1398, checked in by Gregg Young, 17 years ago

Move embeded strings to PCSZ variables or string table; Eliminate Error2 functions Runtime_Error with NULL format string returns "No data" error. Change declares from PSZ to PCSZ in functions where the variable isn't changed. Added btm as an executable file type in several additional places. Use fProtectOnly to prevent attempt to execute Dos and Win programs on "Protect only" installs in several additional places.

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