source: trunk/dll/input.c@ 1394

Last change on this file since 1394 was 1394, checked in by Steven Levine, 17 years ago

Ticket 340: Convert GetPString to use STRINGTABLE.

Drop fm3dll.str and mkstr.exe from makefiles and wpi builders

Convert many functions to expect PCSZ arguments.
Correct walk, compare and dirsizes dialog setups to ignore saved dialog size
Drop copyright.c logic from makefile

  • 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 1394 2009-02-05 04:17:25Z stevenhl $
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__, "no data");
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.