source: trunk/dll/input.c@ 1187

Last change on this file since 1187 was 1187, checked in by John Small, 17 years ago

Ticket 187: Draft 2: Move remaining function declarations

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