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
RevLine 
[181]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
[574]9 Copyright (c) 2005, 2007 Steven H. Levine
[181]10
11 28 May 05 SHL Use saymsg
[342]12 14 Jul 06 SHL Use Runtime_Error
[574]13 22 Mar 07 GKY Use QWL_USER
[793]14 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
[181]15
16***********************************************************************/
17
[907]18#include <string.h>
19
[2]20#define INCL_DOS
21#define INCL_WIN
[907]22#define INCL_LONGLONG // dircnrs.h
[2]23
24#include "fm3dlg.h"
25#include "fm3str.h"
[907]26#include "errutil.h" // Dos_Error...
27#include "strutil.h" // GetPString
[1187]28#include "input.h"
[907]29#include "fm3dll.h"
[2]30
[343]31static PSZ pszSrcFile = __FILE__;
32
[551]33MRESULT EXPENTRY InputDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
[181]34{
35 // mp2 points at a structure of type STRINGINPARMS
36 STRINGINPARMS *psip;
37 PSZ psz;
[2]38
[551]39 switch (msg) {
40 case WM_INITDLG:
41 if (!mp2) {
42 Runtime_Error(pszSrcFile, __LINE__, "no data");
43 WinDismissDlg(hwnd, 0);
[2]44 break;
[551]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;
[2]65
[551]66 case WM_CONTROL: // don't care
67 return 0;
[2]68
[551]69 case WM_COMMAND:
70 switch (SHORT1FROMMP(mp1)) {
71 case DID_OK:
[574]72 psip = WinQueryWindowPtr(hwnd, QWL_USER);
[551]73 WinQueryDlgItemText(hwnd, STR_INPUT, psip->inputlen, psip->ret);
74 WinDismissDlg(hwnd, 1);
75 break;
[2]76
[551]77 case IDM_HELP:
[574]78 psip = WinQueryWindowPtr(hwnd, QWL_USER);
[551]79 psz = psip->help && *psip->help ?
80 psip->help : GetPString(IDS_ENTERTEXTHELPTEXT);
[2]81
[551]82 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, GetPString(IDS_HELPTEXT), psz);
83 break;
[181]84
[551]85 case DID_CANCEL:
86 WinDismissDlg(hwnd, 0);
87 break;
88 }
89 return 0;
[2]90 }
[551]91 return WinDefDlgProc(hwnd, msg, mp1, mp2);
[2]92}
[793]93
94#pragma alloc_text(FMINPUT,InputDlgProc)
Note: See TracBrowser for help on using the repository browser.