source: trunk/dll/input.c@ 551

Last change on this file since 551 was 551, checked in by Gregg Young, 18 years ago

Indentation cleanup

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