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
RevLine 
[181]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
[1394]9 Copyright (c) 2005, 2009 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
[1224]24#include "fm3dll.h"
25#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
26#include "input.h"
[2]27#include "fm3dlg.h"
28#include "fm3str.h"
[907]29#include "errutil.h" // Dos_Error...
30#include "strutil.h" // GetPString
31#include "fm3dll.h"
[2]32
[343]33static PSZ pszSrcFile = __FILE__;
34
[551]35MRESULT EXPENTRY InputDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
[181]36{
37 // mp2 points at a structure of type STRINGINPARMS
38 STRINGINPARMS *psip;
[1394]39 PCSZ psz;
[2]40
[551]41 switch (msg) {
42 case WM_INITDLG:
43 if (!mp2) {
44 Runtime_Error(pszSrcFile, __LINE__, "no data");
45 WinDismissDlg(hwnd, 0);
[2]46 break;
[551]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;
[2]67
[551]68 case WM_CONTROL: // don't care
69 return 0;
[2]70
[551]71 case WM_COMMAND:
72 switch (SHORT1FROMMP(mp1)) {
73 case DID_OK:
[574]74 psip = WinQueryWindowPtr(hwnd, QWL_USER);
[551]75 WinQueryDlgItemText(hwnd, STR_INPUT, psip->inputlen, psip->ret);
76 WinDismissDlg(hwnd, 1);
77 break;
[2]78
[551]79 case IDM_HELP:
[574]80 psip = WinQueryWindowPtr(hwnd, QWL_USER);
[551]81 psz = psip->help && *psip->help ?
82 psip->help : GetPString(IDS_ENTERTEXTHELPTEXT);
[2]83
[551]84 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, GetPString(IDS_HELPTEXT), psz);
85 break;
[181]86
[551]87 case DID_CANCEL:
88 WinDismissDlg(hwnd, 0);
89 break;
90 }
91 return 0;
[2]92 }
[551]93 return WinDefDlgProc(hwnd, msg, mp1, mp2);
[2]94}
[793]95
96#pragma alloc_text(FMINPUT,InputDlgProc)
Note: See TracBrowser for help on using the repository browser.