1 |
|
---|
2 | /***********************************************************************
|
---|
3 |
|
---|
4 | $Id: command.c 1491 2009-12-28 02:20:57Z gyoung $
|
---|
5 |
|
---|
6 | Custom commands
|
---|
7 |
|
---|
8 | Copyright (c) 1993-98 M. Kimes
|
---|
9 | Copyright (c) 2004, 2008 Steven H. Levine
|
---|
10 |
|
---|
11 | 01 Aug 04 SHL Rework lstrip/rstrip usage
|
---|
12 | 06 Jun 05 SHL Drop unused code
|
---|
13 | 14 Jul 06 SHL Use Runtime_Error
|
---|
14 | 29 Jul 06 SHL Use xfgets_bstripcr
|
---|
15 | 15 Aug 06 SHL Better can't add message
|
---|
16 | 18 Sep 06 GKY Add replace command and update okay to add if changed
|
---|
17 | 17 Feb 07 GKY Move error messages etc to string file
|
---|
18 | 22 Mar 07 GKY Use QWL_USER
|
---|
19 | 23 Mar 07 GKY Replace doesn't change item position
|
---|
20 | 23 Mar 07 GKY Okay fails silently when item not changed
|
---|
21 | 19 Apr 07 SHL Sync with AcceptOneDrop GetOneDrop mods
|
---|
22 | 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
|
---|
23 | 06 Jan 08 GKY Use NormalizeCmdLine to check program strings on entry
|
---|
24 | 29 Feb 08 GKY Changes to enable user settable command line length
|
---|
25 | 29 Feb 08 GKY Use xfree where appropriate
|
---|
26 | 18 Jul 08 SHL Add Fortify support
|
---|
27 | 19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory and use BldFullPathName
|
---|
28 | 24 Aug 08 GKY Warn full drive on save of .DAT file; prevent loss of existing file
|
---|
29 | 15 Oct 08 GKY Prevent asking to add %a on NormalizeCmdLine abort
|
---|
30 | 21 Dec 09 GKY Fix the environment so it can be saved, deleted and used consistently.
|
---|
31 | 21 Dec 09 GKY Allow command menu reorder without changing the "ID" or hot key for a command.
|
---|
32 | Added load_inicommand to load the IDs from the ini file.
|
---|
33 | 21 Dec 09 GKY Added 20 new hot keys for commands.
|
---|
34 | 21 Dec 09 GKY Added CheckExecutibleFlags to streamline code in command.c assoc.c & cmdline.c
|
---|
35 | 27 Dec 09 GKY Moved Commands to the INI file this makes commands.dat obsolete
|
---|
36 | 27 Dec 09 GKY Added QueryCommandSettings to streamline code
|
---|
37 |
|
---|
38 | ***********************************************************************/
|
---|
39 |
|
---|
40 | #include <stdlib.h>
|
---|
41 | #include <string.h>
|
---|
42 | #include <share.h>
|
---|
43 |
|
---|
44 | #define INCL_DOS
|
---|
45 | #define INCL_WIN
|
---|
46 | #define INCL_LONGLONG // dircnrs.h
|
---|
47 |
|
---|
48 | #include "fm3dll.h"
|
---|
49 | #include "fm3dll2.h" // #define's for UM_*, control id's, etc.
|
---|
50 | #include "notebook.h" // Data declaration(s)
|
---|
51 | #include "init.h" // Data declaration(s)
|
---|
52 | #include "mainwnd.h" // Data declaration(s)
|
---|
53 | #include "newview.h" // Data declarations
|
---|
54 | #include "fm3dlg.h"
|
---|
55 | #include "fm3str.h"
|
---|
56 | #include "tools.h"
|
---|
57 | #include "arccnrs.h" // BldQuotedFileName
|
---|
58 | #include "errutil.h" // Dos_Error...
|
---|
59 | #include "strutil.h" // GetPString
|
---|
60 | #include "droplist.h" // AcceptOneDrop, DropHelp, GetOneDrop
|
---|
61 | #include "misc.h" // DrawTargetEmphasis
|
---|
62 | #include "systemf.h" // ExecOnList
|
---|
63 | #include "getnames.h" // insert_filename
|
---|
64 | #include "wrappers.h" // xfgets
|
---|
65 | #include "pathutil.h" // NormalizeCmdLine
|
---|
66 | #include "command.h"
|
---|
67 | #include "strips.h" // bstrip
|
---|
68 | #include "dirs.h" // save_dir2
|
---|
69 | #include "fortify.h"
|
---|
70 |
|
---|
71 | VOID load_inicommands(VOID);
|
---|
72 |
|
---|
73 | typedef struct
|
---|
74 | {
|
---|
75 | PSZ pszCmdLine;
|
---|
76 | CHAR title[100];
|
---|
77 | CHAR env[1002];
|
---|
78 | ULONG flags;
|
---|
79 | ULONG ID;
|
---|
80 | ULONG HotKeyID;
|
---|
81 | }
|
---|
82 | COMMAND;
|
---|
83 |
|
---|
84 | BOOL QueryCommandSettings(HWND hwnd, COMMAND *temp);
|
---|
85 | VOID save_commands(VOID);
|
---|
86 |
|
---|
87 | // Data defintions
|
---|
88 | #pragma data_seg(DATA1)
|
---|
89 |
|
---|
90 | static PSZ pszSrcFile = __FILE__;
|
---|
91 | static LINKCMDS *cmdtail;
|
---|
92 | static BOOL UsedCommandIDs[300];
|
---|
93 | static BOOL UsedHotKeyIDs[40];
|
---|
94 | static PSZ pszCommandsList;
|
---|
95 | static ULONG ulSizeCommandsList = 10000;
|
---|
96 | static BOOL fLoadCommandsFromINI = FALSE;
|
---|
97 |
|
---|
98 | #pragma data_seg(GLOBAL2)
|
---|
99 | LINKCMDS *cmdhead;
|
---|
100 | BOOL cmdloaded;
|
---|
101 |
|
---|
102 | MRESULT EXPENTRY CommandTextProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
103 | {
|
---|
104 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
105 | static BOOL emphasized = FALSE;
|
---|
106 |
|
---|
107 | switch (msg) {
|
---|
108 | case DM_DRAGOVER:
|
---|
109 | if (!emphasized) {
|
---|
110 | emphasized = TRUE;
|
---|
111 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
112 | }
|
---|
113 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
---|
114 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
---|
115 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
---|
116 |
|
---|
117 | case DM_DRAGLEAVE:
|
---|
118 | if (emphasized) {
|
---|
119 | emphasized = FALSE;
|
---|
120 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
121 | }
|
---|
122 | break;
|
---|
123 |
|
---|
124 | case DM_DROPHELP:
|
---|
125 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_DROPCMDHELPTEXT));
|
---|
126 | return 0;
|
---|
127 |
|
---|
128 | case DM_DROP:
|
---|
129 | {
|
---|
130 | char szFrom[CCHMAXPATH + 5];
|
---|
131 |
|
---|
132 | if (emphasized) {
|
---|
133 | emphasized = FALSE;
|
---|
134 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
135 | }
|
---|
136 | if (GetOneDrop(hwnd, mp1, mp2, szFrom, CCHMAXPATH)) {
|
---|
137 | strcat(szFrom, " %a");
|
---|
138 | WinSetWindowText(hwnd, szFrom);
|
---|
139 | }
|
---|
140 | }
|
---|
141 | return 0;
|
---|
142 | }
|
---|
143 | return (oldproc) ? oldproc(hwnd, msg, mp1, mp2) :
|
---|
144 | WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
145 | }
|
---|
146 |
|
---|
147 | MRESULT EXPENTRY ReOrderProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
148 | {
|
---|
149 | switch (msg) {
|
---|
150 | case WM_INITDLG:
|
---|
151 | if (!cmdhead) {
|
---|
152 | WinDismissDlg(hwnd, 0);
|
---|
153 | break;
|
---|
154 | }
|
---|
155 | {
|
---|
156 | LINKCMDS *info;
|
---|
157 | SHORT x;
|
---|
158 |
|
---|
159 | info = cmdhead;
|
---|
160 | while (info) {
|
---|
161 | x = (SHORT) WinSendDlgItemMsg(hwnd, RE_ADDLISTBOX, LM_INSERTITEM,
|
---|
162 | MPFROMSHORT(LIT_END),
|
---|
163 | MPFROMP(info->title));
|
---|
164 | if (x < 0) {
|
---|
165 | Runtime_Error(pszSrcFile, __LINE__, "no cmd");
|
---|
166 | WinDismissDlg(hwnd, 0);
|
---|
167 | }
|
---|
168 | else {
|
---|
169 | WinSendDlgItemMsg(hwnd, RE_ADDLISTBOX, LM_SETITEMHANDLE,
|
---|
170 | MPFROMSHORT(x), MPFROMP(info));
|
---|
171 | }
|
---|
172 | info = info->next;
|
---|
173 | }
|
---|
174 | }
|
---|
175 | break;
|
---|
176 |
|
---|
177 | case WM_CONTROL:
|
---|
178 | return 0;
|
---|
179 |
|
---|
180 | case WM_COMMAND:
|
---|
181 | switch (SHORT1FROMMP(mp1)) {
|
---|
182 | case DID_CANCEL:
|
---|
183 | WinDismissDlg(hwnd, 0);
|
---|
184 | break;
|
---|
185 |
|
---|
186 | case DID_OK:
|
---|
187 | {
|
---|
188 | LINKCMDS *temphead = NULL, *info, *last = NULL, *temptail = NULL;
|
---|
189 | SHORT sSelect, numitems;
|
---|
190 |
|
---|
191 | sSelect = 0;
|
---|
192 | numitems = (SHORT) WinSendDlgItemMsg(hwnd, RE_REMOVELISTBOX,
|
---|
193 | LM_QUERYITEMCOUNT,
|
---|
194 | MPVOID, MPVOID);
|
---|
195 | while (numitems) {
|
---|
196 | info = (LINKCMDS *) WinSendDlgItemMsg(hwnd, RE_REMOVELISTBOX,
|
---|
197 | LM_QUERYITEMHANDLE,
|
---|
198 | MPFROMSHORT(sSelect++),
|
---|
199 | MPVOID);
|
---|
200 | if (info) {
|
---|
201 | if (!temphead) {
|
---|
202 | temphead = info;
|
---|
203 | info->prev = NULL;
|
---|
204 | }
|
---|
205 | else {
|
---|
206 | last->next = info;
|
---|
207 | info->prev = last;
|
---|
208 | }
|
---|
209 | temptail = info;
|
---|
210 | last = info;
|
---|
211 | info->next = NULL;
|
---|
212 | }
|
---|
213 | numitems--;
|
---|
214 | }
|
---|
215 | sSelect = 0;
|
---|
216 | numitems = (SHORT) WinSendDlgItemMsg(hwnd, RE_ADDLISTBOX,
|
---|
217 | LM_QUERYITEMCOUNT,
|
---|
218 | MPVOID, MPVOID);
|
---|
219 | while (numitems) {
|
---|
220 | info = (LINKCMDS *) WinSendDlgItemMsg(hwnd, RE_ADDLISTBOX,
|
---|
221 | LM_QUERYITEMHANDLE,
|
---|
222 | MPFROMSHORT(sSelect++),
|
---|
223 | MPVOID);
|
---|
224 | if (info) {
|
---|
225 | if (!temphead) {
|
---|
226 | temphead = info;
|
---|
227 | info->prev = NULL;
|
---|
228 | }
|
---|
229 | else {
|
---|
230 | last->next = info;
|
---|
231 | info->prev = last;
|
---|
232 | }
|
---|
233 | temptail = info;
|
---|
234 | last = info;
|
---|
235 | info->next = NULL;
|
---|
236 | }
|
---|
237 | numitems--;
|
---|
238 | }
|
---|
239 | cmdhead = temphead;
|
---|
240 | cmdtail = temptail;
|
---|
241 | }
|
---|
242 | WinDismissDlg(hwnd, 1);
|
---|
243 | break;
|
---|
244 |
|
---|
245 | case IDM_HELP:
|
---|
246 | if (hwndHelp)
|
---|
247 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
248 | MPFROM2SHORT(HELP_REORDERCOMMANDS, 0),
|
---|
249 | MPFROMSHORT(HM_RESOURCEID));
|
---|
250 | break;
|
---|
251 |
|
---|
252 | case RE_ADD:
|
---|
253 | {
|
---|
254 | SHORT sSelect, x;
|
---|
255 | LINKCMDS *info;
|
---|
256 |
|
---|
257 | sSelect = (SHORT) WinSendDlgItemMsg(hwnd, RE_ADDLISTBOX,
|
---|
258 | LM_QUERYSELECTION,
|
---|
259 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
260 | while (sSelect >= 0) {
|
---|
261 | info = (LINKCMDS *) WinSendDlgItemMsg(hwnd, RE_ADDLISTBOX,
|
---|
262 | LM_QUERYITEMHANDLE,
|
---|
263 | MPFROMSHORT(sSelect), MPVOID);
|
---|
264 | if (info) {
|
---|
265 | x = (SHORT) WinSendDlgItemMsg(hwnd, RE_REMOVELISTBOX,
|
---|
266 | LM_INSERTITEM,
|
---|
267 | MPFROM2SHORT(LIT_END, 0),
|
---|
268 | MPFROMP(info->title));
|
---|
269 | if (x >= 0) {
|
---|
270 | WinSendDlgItemMsg(hwnd, RE_REMOVELISTBOX,
|
---|
271 | LM_SETITEMHANDLE,
|
---|
272 | MPFROMSHORT(x), MPFROMP(info));
|
---|
273 | WinSendDlgItemMsg(hwnd, RE_ADDLISTBOX, LM_DELETEITEM,
|
---|
274 | MPFROMSHORT(sSelect), MPVOID);
|
---|
275 | }
|
---|
276 | }
|
---|
277 | else
|
---|
278 | WinSendDlgItemMsg(hwnd, RE_ADDLISTBOX, LM_SELECTITEM,
|
---|
279 | MPFROMSHORT(sSelect), MPFROMSHORT(FALSE));
|
---|
280 | sSelect = (USHORT) WinSendDlgItemMsg(hwnd, RE_ADDLISTBOX,
|
---|
281 | LM_QUERYSELECTION,
|
---|
282 | MPFROMSHORT(LIT_FIRST),
|
---|
283 | MPVOID);
|
---|
284 | }
|
---|
285 | }
|
---|
286 | break;
|
---|
287 |
|
---|
288 | case RE_REMOVE:
|
---|
289 | {
|
---|
290 | SHORT sSelect, x;
|
---|
291 | LINKCMDS *info;
|
---|
292 |
|
---|
293 | sSelect = (SHORT) WinSendDlgItemMsg(hwnd, RE_REMOVELISTBOX,
|
---|
294 | LM_QUERYSELECTION,
|
---|
295 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
296 | while (sSelect >= 0) {
|
---|
297 | info = (LINKCMDS *) WinSendDlgItemMsg(hwnd, RE_REMOVELISTBOX,
|
---|
298 | LM_QUERYITEMHANDLE,
|
---|
299 | MPFROMSHORT(sSelect), MPVOID);
|
---|
300 | if (info) {
|
---|
301 | x = (SHORT) WinSendDlgItemMsg(hwnd, RE_ADDLISTBOX,
|
---|
302 | LM_INSERTITEM,
|
---|
303 | MPFROM2SHORT(LIT_END, 0),
|
---|
304 | MPFROMP(info->title));
|
---|
305 | if (x >= 0) {
|
---|
306 | WinSendDlgItemMsg(hwnd, RE_ADDLISTBOX,
|
---|
307 | LM_SETITEMHANDLE,
|
---|
308 | MPFROMSHORT(x), MPFROMP(info));
|
---|
309 | WinSendDlgItemMsg(hwnd, RE_REMOVELISTBOX, LM_DELETEITEM,
|
---|
310 | MPFROMSHORT(sSelect), MPVOID);
|
---|
311 | }
|
---|
312 | }
|
---|
313 | else
|
---|
314 | WinSendDlgItemMsg(hwnd, RE_REMOVELISTBOX, LM_SELECTITEM,
|
---|
315 | MPFROMSHORT(sSelect), MPFROMSHORT(FALSE));
|
---|
316 | sSelect = (USHORT) WinSendDlgItemMsg(hwnd, RE_REMOVELISTBOX,
|
---|
317 | LM_QUERYSELECTION,
|
---|
318 | MPFROMSHORT(LIT_FIRST),
|
---|
319 | MPVOID);
|
---|
320 | }
|
---|
321 | }
|
---|
322 | break;
|
---|
323 | }
|
---|
324 | return 0;
|
---|
325 | }
|
---|
326 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
327 | }
|
---|
328 |
|
---|
329 | CHAR *command_title(INT cx)
|
---|
330 | {
|
---|
331 | static CHAR duh[] = "???";
|
---|
332 | LINKCMDS *info;
|
---|
333 | INT x = 0;
|
---|
334 |
|
---|
335 | if (!cmdloaded)
|
---|
336 | load_commands();
|
---|
337 | info = cmdhead;
|
---|
338 | while (info) {
|
---|
339 | if (x == cx)
|
---|
340 | return info->title;
|
---|
341 | info = info->next;
|
---|
342 | }
|
---|
343 | return duh;
|
---|
344 | }
|
---|
345 |
|
---|
346 | VOID free_commands(VOID)
|
---|
347 | {
|
---|
348 | LINKCMDS *info, *next;
|
---|
349 |
|
---|
350 | info = cmdhead;
|
---|
351 | while (info) {
|
---|
352 | next = info->next;
|
---|
353 | xfree(info->title, pszSrcFile, __LINE__);
|
---|
354 | xfree(info->pszCmdLine, pszSrcFile, __LINE__);
|
---|
355 | xfree(info->env, pszSrcFile, __LINE__);
|
---|
356 | free(info);
|
---|
357 | info = next;
|
---|
358 | }
|
---|
359 | free(pszCommandsList);
|
---|
360 | cmdhead = cmdtail = NULL;
|
---|
361 | }
|
---|
362 |
|
---|
363 | VOID load_commands(VOID)
|
---|
364 | {
|
---|
365 | FILE *fp;
|
---|
366 | LINKCMDS *info;
|
---|
367 | PSZ pszCmdLine;
|
---|
368 | CHAR title[100];
|
---|
369 | CHAR flags[34];
|
---|
370 | //CHAR *p;
|
---|
371 | ULONG size;
|
---|
372 |
|
---|
373 |
|
---|
374 | size = sizeof(BOOL) * 300;
|
---|
375 | PrfQueryProfileData(fmprof, FM3Str, "COMMANDS.UsedCommandIDs", &UsedCommandIDs,
|
---|
376 | &size);
|
---|
377 | size = sizeof(BOOL) * 40;
|
---|
378 | PrfQueryProfileData(fmprof, FM3Str, "COMMANDS.UsedHotKeyIDs", &UsedHotKeyIDs,
|
---|
379 | &size); size = sizeof(BOOL);
|
---|
380 | PrfQueryProfileData(fmprof, FM3Str, "COMMANDS.LoadCommandsFromINI",
|
---|
381 | &fLoadCommandsFromINI, &size);
|
---|
382 | if (!fLoadCommandsFromINI) {
|
---|
383 | if (cmdhead)
|
---|
384 | free_commands();
|
---|
385 | cmdloaded = TRUE;
|
---|
386 | pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
387 | pszCommandsList = xmallocz(ulSizeCommandsList, pszSrcFile, __LINE__);
|
---|
388 | if (pszCmdLine) {
|
---|
389 | BldFullPathName(pszCmdLine, pFM2SaveDirectory, PCSZ_COMMANDSDAT);
|
---|
390 | fp = _fsopen(pszCmdLine, "r", SH_DENYWR);
|
---|
391 | if (fp) {
|
---|
392 | while (!feof(fp)) {
|
---|
393 | if (!xfgets_bstripcr(title, sizeof(title), fp, pszSrcFile, __LINE__))
|
---|
394 | break;
|
---|
395 | if (!*title || *title == ';')
|
---|
396 | continue;
|
---|
397 | if (!xfgets_bstripcr(pszCmdLine, MaxComLineStrg, fp, pszSrcFile, __LINE__))
|
---|
398 | break; /* error! */
|
---|
399 | if (!xfgets_bstripcr(flags, sizeof(flags), fp, pszSrcFile, __LINE__))
|
---|
400 | break;
|
---|
401 | flags[34] = 0;
|
---|
402 | if (!pszCmdLine)
|
---|
403 | continue;
|
---|
404 | info = xmallocz(sizeof(LINKCMDS), pszSrcFile, __LINE__);
|
---|
405 | if (info) {
|
---|
406 | # ifdef FORTIFY
|
---|
407 | Fortify_SetOwner(info, 1);
|
---|
408 | Fortify_SetScope(info, 1);
|
---|
409 | # endif
|
---|
410 | info->pszCmdLine = xstrdup(pszCmdLine, pszSrcFile, __LINE__);
|
---|
411 |
|
---|
412 | if (pszCommandsList) {
|
---|
413 | strcpy(pszCommandsList + strlen(pszCommandsList), title);
|
---|
414 | strcpy(pszCommandsList + strlen(pszCommandsList), ";");
|
---|
415 | }
|
---|
416 | info->title = xstrdup(title, pszSrcFile, __LINE__);
|
---|
417 | info->flags = atol(flags);
|
---|
418 | if (!info->pszCmdLine || !info->title) {
|
---|
419 | xfree(info->pszCmdLine, pszSrcFile, __LINE__);
|
---|
420 | xfree(info->title, pszSrcFile, __LINE__);
|
---|
421 | free(info);
|
---|
422 | break;
|
---|
423 | }
|
---|
424 | # ifdef FORTIFY
|
---|
425 | Fortify_SetOwner(info->pszCmdLine, 1);
|
---|
426 | Fortify_SetScope(info->pszCmdLine, 1);
|
---|
427 | Fortify_SetOwner(info->title, 1);
|
---|
428 | Fortify_SetScope(info->title, 1);
|
---|
429 | # endif
|
---|
430 | if (!cmdhead)
|
---|
431 | cmdhead = info;
|
---|
432 | else {
|
---|
433 | cmdtail->next = info;
|
---|
434 | info->prev = cmdtail;
|
---|
435 | }
|
---|
436 | cmdtail = info;
|
---|
437 | }
|
---|
438 | }
|
---|
439 | free(pszCmdLine);
|
---|
440 | fclose(fp);
|
---|
441 | if (pszCommandsList) {
|
---|
442 | ulSizeCommandsList = strlen(pszCommandsList) + 1;
|
---|
443 | }
|
---|
444 | }
|
---|
445 | }
|
---|
446 | }
|
---|
447 | load_inicommands();
|
---|
448 | }
|
---|
449 |
|
---|
450 | /**
|
---|
451 | * load_inicommand loads the data from the ini file into an info struct
|
---|
452 | * after COMMANDS.DAT has been loaded; It generates new IDs where necessary
|
---|
453 | * it saves the environment from the old ini key and deletes it as needed
|
---|
454 | **/
|
---|
455 |
|
---|
456 | VOID load_inicommands(VOID)
|
---|
457 | {
|
---|
458 | LINKCMDS *info;;
|
---|
459 | INT x = 0;
|
---|
460 | INT y = 0;
|
---|
461 | ULONG ID = 0;
|
---|
462 | ULONG HotKeyID = 0;
|
---|
463 | CHAR env[1002];
|
---|
464 | CHAR key[120];
|
---|
465 | CHAR szTitle[100];
|
---|
466 | ULONG size;
|
---|
467 | CHAR *p, *pp;
|
---|
468 | PSZ pszCmdLine;
|
---|
469 | ULONG flags;
|
---|
470 |
|
---|
471 | # ifdef FORTIFY
|
---|
472 | Fortify_EnterScope();
|
---|
473 | # endif
|
---|
474 | pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
475 | if (pszCmdLine) {
|
---|
476 | if (fLoadCommandsFromINI) {
|
---|
477 | if (cmdhead)
|
---|
478 | free_commands();
|
---|
479 | cmdloaded = TRUE;
|
---|
480 | size = sizeof(ULONG);
|
---|
481 | PrfQueryProfileData(fmprof, FM3Str, "COMMANDS.SizeSortOrder",
|
---|
482 | &ulSizeCommandsList, &size);
|
---|
483 | pszCommandsList = xmallocz(ulSizeCommandsList, pszSrcFile, __LINE__);
|
---|
484 | if (pszCommandsList)
|
---|
485 | PrfQueryProfileString(fmprof, FM3Str, "COMMANDS.SortOrder",
|
---|
486 | NullStr, pszCommandsList, ulSizeCommandsList);
|
---|
487 | p = pszCommandsList;
|
---|
488 | while (*p == ';')
|
---|
489 | p++;
|
---|
490 | while (*p) {
|
---|
491 | *szTitle = 0;
|
---|
492 | pp = szTitle;
|
---|
493 | while (*p && *p != ';')
|
---|
494 | *pp++ = *p++;
|
---|
495 | *pp = 0;
|
---|
496 | while (*p == ';')
|
---|
497 | p++;
|
---|
498 | if (*szTitle) {
|
---|
499 | bstripcr(szTitle);
|
---|
500 | sprintf(key, "COMMAND.%sID", szTitle);
|
---|
501 | size = sizeof(ULONG);
|
---|
502 | PrfQueryProfileData(fmprof, FM3Str, key, &ID, &size);
|
---|
503 | sprintf(key, "COMMAND.%sHotKeyID", szTitle);
|
---|
504 | size = sizeof(ULONG);
|
---|
505 | PrfQueryProfileData(fmprof, FM3Str, key, &HotKeyID, &size);
|
---|
506 | sprintf(key, "COMMAND.%sflags", szTitle);
|
---|
507 | size = sizeof(ULONG);
|
---|
508 | PrfQueryProfileData(fmprof, FM3Str, key, &flags, &size);
|
---|
509 | sprintf(key, "COMMAND.%senv", szTitle);
|
---|
510 | PrfQueryProfileString(fmprof, FM3Str, key, NullStr, env, sizeof(env));
|
---|
511 | sprintf(key, "COMMAND.%sCmdLine", szTitle);
|
---|
512 | PrfQueryProfileString(fmprof, FM3Str, key, NullStr, pszCmdLine, MaxComLineStrg);
|
---|
513 | }
|
---|
514 | info = xmallocz(sizeof(LINKCMDS), pszSrcFile, __LINE__);
|
---|
515 | if (info) {
|
---|
516 | # ifdef FORTIFY
|
---|
517 | Fortify_SetOwner(info, 1);
|
---|
518 | Fortify_SetScope(info, 1);
|
---|
519 | # endif
|
---|
520 | info->pszCmdLine = xstrdup(pszCmdLine, pszSrcFile, __LINE__);
|
---|
521 | info->title = xstrdup(szTitle, pszSrcFile, __LINE__);
|
---|
522 | info->flags = flags;
|
---|
523 | if (env != NullStr)
|
---|
524 | info->env = xstrdup(env, pszSrcFile, __LINE__);
|
---|
525 | info->ID = ID;
|
---|
526 | info->HotKeyID = HotKeyID;
|
---|
527 | if (!info->pszCmdLine || !info->title) {
|
---|
528 | xfree(info->pszCmdLine, pszSrcFile, __LINE__);
|
---|
529 | xfree(info->title, pszSrcFile, __LINE__);
|
---|
530 | xfree(info->env, pszSrcFile, __LINE__);
|
---|
531 | free(info);
|
---|
532 | break;
|
---|
533 | }
|
---|
534 | if (!cmdhead)
|
---|
535 | cmdhead = info;
|
---|
536 | else {
|
---|
537 | cmdtail->next = info;
|
---|
538 | info->prev = cmdtail;
|
---|
539 | }
|
---|
540 | cmdtail = info;
|
---|
541 | }
|
---|
542 | }
|
---|
543 | }
|
---|
544 | }
|
---|
545 | else {
|
---|
546 | info = cmdhead;
|
---|
547 | while (info) {
|
---|
548 | bstripcr(info->title);
|
---|
549 | sprintf(key, "COMMAND.%sID", info->title);
|
---|
550 | size = sizeof(ULONG);
|
---|
551 | PrfQueryProfileData(fmprof, FM3Str, key, &ID, &size);
|
---|
552 | sprintf(key, "COMMAND.%sHotKeyID", info->title);
|
---|
553 | size = sizeof(ULONG);
|
---|
554 | PrfQueryProfileData(fmprof, FM3Str, key, &HotKeyID, &size);
|
---|
555 | sprintf(key, "COMMAND.%senv", info->title);
|
---|
556 | PrfQueryProfileString(fmprof, FM3Str, key, NullStr, env, sizeof(env));
|
---|
557 | if (ID != 0) {
|
---|
558 | if (env != NullStr)
|
---|
559 | info->env = xstrdup(env, pszSrcFile, __LINE__);
|
---|
560 | info->ID = ID;
|
---|
561 | info->HotKeyID = HotKeyID;
|
---|
562 | }
|
---|
563 | //This updates the old commands.dat file to the new format
|
---|
564 | //assigning the IDs based on file order or on next available ID if
|
---|
565 | //COMMAND.DAT is hand edited.
|
---|
566 | else {
|
---|
567 | for (x = 0; x < 300; x++) {
|
---|
568 | if (!UsedCommandIDs[x]) {
|
---|
569 | ID = info->ID = IDM_COMMANDSTART + x;
|
---|
570 | UsedCommandIDs[x] = TRUE;
|
---|
571 | for (y = 0; y < 40; y++) {
|
---|
572 | if (!UsedHotKeyIDs[y]) {
|
---|
573 | HotKeyID = info->HotKeyID = IDM_COMMANDNUM0 + y;
|
---|
574 | UsedHotKeyIDs[y] = TRUE;
|
---|
575 | break;
|
---|
576 | }
|
---|
577 | }
|
---|
578 | break;
|
---|
579 | }
|
---|
580 | if (x == 299)
|
---|
581 | saymsg(MB_OK | MB_ICONEXCLAMATION , HWND_DESKTOP,
|
---|
582 | GetPString(IDS_COMMANDSLIMITTITLETEXT),
|
---|
583 | GetPString(IDS_COMMANDSLIMITREACHEDTEXT ));
|
---|
584 | }
|
---|
585 | PrfQueryProfileString(fmprof, FM3Str, info->pszCmdLine, NullStr, env, sizeof(env));
|
---|
586 | info->env = xstrdup(env, pszSrcFile, __LINE__);
|
---|
587 | }
|
---|
588 | ID = 0;
|
---|
589 | HotKeyID = 0;
|
---|
590 | info = info->next;
|
---|
591 | }
|
---|
592 | fLoadCommandsFromINI = TRUE;
|
---|
593 | save_commands();
|
---|
594 | }
|
---|
595 | free(pszCmdLine);
|
---|
596 | }
|
---|
597 | }
|
---|
598 |
|
---|
599 | VOID save_commands(VOID)
|
---|
600 | {
|
---|
601 | LINKCMDS *info;
|
---|
602 | CHAR key[120];
|
---|
603 |
|
---|
604 | if (!cmdloaded || !cmdhead)
|
---|
605 | return;
|
---|
606 |
|
---|
607 | info = cmdhead;
|
---|
608 | pszCommandsList[0] = 0;
|
---|
609 | while (info) {
|
---|
610 | sprintf(key, "COMMAND.%sflags", info->title);
|
---|
611 | PrfWriteProfileData(fmprof, FM3Str, key, &info->flags, sizeof(ULONG));
|
---|
612 | sprintf(key, "COMMAND.%sCmdLine", info->title);
|
---|
613 | PrfWriteProfileString(fmprof, FM3Str, key, info->pszCmdLine);
|
---|
614 | bstripcr(info->title);
|
---|
615 | sprintf(key, "COMMAND.%sID", info->title);
|
---|
616 | PrfWriteProfileData(fmprof, FM3Str, key, &info->ID, sizeof(INT));
|
---|
617 | sprintf(key, "COMMAND.%sHotKeyID", info->title);
|
---|
618 | PrfWriteProfileData(fmprof, FM3Str, key, &info->HotKeyID, sizeof(INT));
|
---|
619 | if (info->env != NullStr) {
|
---|
620 | sprintf(key, "COMMAND.%senv", info->title);
|
---|
621 | PrfWriteProfileString(fmprof, FM3Str, key, info->env);
|
---|
622 | }
|
---|
623 | if ((strlen(pszCommandsList) + strlen(info->title) + 1) > ulSizeCommandsList)
|
---|
624 | pszCommandsList = xrealloc(pszCommandsList,
|
---|
625 | ulSizeCommandsList + strlen(info->title) + 1,
|
---|
626 | pszSrcFile, __LINE__);
|
---|
627 | strcpy(pszCommandsList + strlen(pszCommandsList), info->title);
|
---|
628 | strcpy(pszCommandsList + strlen(pszCommandsList), ";");
|
---|
629 | info = info->next;
|
---|
630 | } // while info
|
---|
631 | PrfWriteProfileData(fmprof, FM3Str, "COMMANDS.UsedCommandIDs", &UsedCommandIDs,
|
---|
632 | sizeof(BOOL) * 300);
|
---|
633 | PrfWriteProfileData(fmprof, FM3Str, "COMMANDS.UsedHotKeyIDs", &UsedHotKeyIDs,
|
---|
634 | sizeof(BOOL) * 40);
|
---|
635 | ulSizeCommandsList = strlen(pszCommandsList) + 1;
|
---|
636 | PrfWriteProfileData(fmprof, FM3Str, "COMMANDS.SizeSortOrder",
|
---|
637 | &ulSizeCommandsList, sizeof(ULONG));
|
---|
638 | PrfWriteProfileString(fmprof, FM3Str, "COMMANDS.SortOrder", pszCommandsList);
|
---|
639 | PrfWriteProfileData(fmprof, FM3Str, "COMMANDS.LoadCommandsFromINI",
|
---|
640 | &fLoadCommandsFromINI, sizeof(BOOL));
|
---|
641 | }
|
---|
642 |
|
---|
643 | //== add_command() Add command to list ==
|
---|
644 |
|
---|
645 | LINKCMDS *add_command(COMMAND *addme, BOOL fDontCheckHotKey)
|
---|
646 | {
|
---|
647 | LINKCMDS *info;
|
---|
648 | INT x;
|
---|
649 | INT y;
|
---|
650 | APIRET ret;
|
---|
651 |
|
---|
652 | if (!addme || !*addme->pszCmdLine || !*addme->title)
|
---|
653 | return NULL; // No data
|
---|
654 | # ifdef FORTIFY
|
---|
655 | Fortify_EnterScope();
|
---|
656 | # endif
|
---|
657 | info = cmdhead;
|
---|
658 | while (info) {
|
---|
659 | if (!stricmp(info->title, addme->title))
|
---|
660 | return NULL; // Got a dup
|
---|
661 | info = info->next;
|
---|
662 | }
|
---|
663 | if (!fDontCheckHotKey && UsedHotKeyIDs[addme->HotKeyID - IDM_COMMANDNUM0]) {
|
---|
664 | info = cmdhead;
|
---|
665 | while (info) {
|
---|
666 | if (info->HotKeyID == addme->HotKeyID) { //avoid assigning hot key to multiple commands
|
---|
667 | ret = saymsg(MB_YESNOCANCEL, HWND_DESKTOP, NullStr,
|
---|
668 | GetPString(IDS_DUPLICATEHOTKEYTEXT));
|
---|
669 | if (ret == MBID_YES) {
|
---|
670 | info->HotKeyID = 0;
|
---|
671 | UsedHotKeyIDs[addme->HotKeyID - IDM_COMMANDNUM0] = FALSE;
|
---|
672 | break;
|
---|
673 | }
|
---|
674 | else if (ret == MBID_NO) {
|
---|
675 | addme->HotKeyID = 0;
|
---|
676 | break;
|
---|
677 | }
|
---|
678 | else
|
---|
679 | return NULL;
|
---|
680 | }
|
---|
681 | info = info->next;
|
---|
682 | }
|
---|
683 | }
|
---|
684 | info = xmallocz(sizeof(LINKCMDS), pszSrcFile, __LINE__);
|
---|
685 | if (!info)
|
---|
686 | return NULL;
|
---|
687 | info->pszCmdLine = xstrdup(addme->pszCmdLine, pszSrcFile, __LINE__);
|
---|
688 | info->title = xstrdup(addme->title, pszSrcFile, __LINE__);
|
---|
689 | info->HotKeyID = addme->HotKeyID;
|
---|
690 | info->ID = addme->ID;
|
---|
691 | if (info->HotKeyID >= IDM_COMMANDNUM0 && info->HotKeyID <= IDM_COMMANDNUM39) {
|
---|
692 | UsedHotKeyIDs[info->HotKeyID - IDM_COMMANDNUM0] = TRUE;
|
---|
693 | }
|
---|
694 | else
|
---|
695 | info->HotKeyID = 0;
|
---|
696 | if (!info->ID) {
|
---|
697 | //profile updated by save_commands
|
---|
698 | for (x = 0; x < 300; x++) {
|
---|
699 | if (!UsedCommandIDs[x]) {
|
---|
700 | info->ID = IDM_COMMANDSTART + x;
|
---|
701 | UsedCommandIDs[x] = TRUE;
|
---|
702 | if (!info->HotKeyID && !fDontCheckHotKey) {
|
---|
703 | for (y = 0; y < 40; y++) {
|
---|
704 | if (!UsedHotKeyIDs[y]) {
|
---|
705 | info->HotKeyID = IDM_COMMANDNUM0 + y;
|
---|
706 | UsedHotKeyIDs[y] = TRUE;
|
---|
707 | break;
|
---|
708 | }
|
---|
709 | }
|
---|
710 | }
|
---|
711 | break;
|
---|
712 | }
|
---|
713 | if (x == 299)
|
---|
714 | saymsg(MB_OK | MB_ICONEXCLAMATION , HWND_DESKTOP,
|
---|
715 | GetPString(IDS_COMMANDSLIMITTITLETEXT),
|
---|
716 | GetPString(IDS_COMMANDSLIMITREACHEDTEXT ));
|
---|
717 | }
|
---|
718 | }
|
---|
719 | if (addme->flags)
|
---|
720 | info->flags = addme->flags;
|
---|
721 | if (addme->env)
|
---|
722 | info->env = xstrdup(addme->env, pszSrcFile, __LINE__);
|
---|
723 | if (!info->pszCmdLine || !info->title || !info->ID) {
|
---|
724 | xfree(info->pszCmdLine, pszSrcFile, __LINE__);
|
---|
725 | xfree(info->title, pszSrcFile, __LINE__);
|
---|
726 | xfree(info->env, pszSrcFile, __LINE__);
|
---|
727 | free(info);
|
---|
728 | return NULL;
|
---|
729 | }
|
---|
730 | if (!cmdhead) /* only item in list */
|
---|
731 | cmdhead = cmdtail = info;
|
---|
732 | else {
|
---|
733 | /* place at tail */
|
---|
734 | cmdtail->next = info;
|
---|
735 | info->prev = cmdtail;
|
---|
736 | cmdtail = info;
|
---|
737 | }
|
---|
738 | pszCommandsList = xrealloc(pszCommandsList, ulSizeCommandsList + strlen(info->title) + 1,
|
---|
739 | pszSrcFile, __LINE__);
|
---|
740 | if (pszCommandsList) {
|
---|
741 | strcpy(pszCommandsList + strlen(pszCommandsList), info->title);
|
---|
742 | strcpy(pszCommandsList + strlen(pszCommandsList), ";");
|
---|
743 | ulSizeCommandsList = ulSizeCommandsList + strlen(info->title) + 1;
|
---|
744 | }
|
---|
745 | else {
|
---|
746 | pszCommandsList = xmallocz(ulSizeCommandsList, pszSrcFile, __LINE__);
|
---|
747 | if (pszCommandsList)
|
---|
748 | PrfQueryProfileString(fmprof, FM3Str, "COMMANDS.SortOrder",
|
---|
749 | NullStr, pszCommandsList, ulSizeCommandsList);
|
---|
750 | return 0;
|
---|
751 | }
|
---|
752 | return info;
|
---|
753 | }
|
---|
754 |
|
---|
755 | BOOL kill_command(CHAR * killme)
|
---|
756 | {
|
---|
757 | LINKCMDS *info;
|
---|
758 |
|
---|
759 | if (killme && *killme) {
|
---|
760 | info = cmdhead;
|
---|
761 | while (info) {
|
---|
762 | if (!stricmp(info->title, killme)) {
|
---|
763 | UsedCommandIDs[info->ID - IDM_COMMANDSTART] = FALSE;
|
---|
764 | if (info->HotKeyID)
|
---|
765 | UsedHotKeyIDs[info->HotKeyID - IDM_COMMANDNUM0] = FALSE;
|
---|
766 | if (info == cmdhead) {
|
---|
767 | cmdhead = info->next;
|
---|
768 | if (info == cmdtail)
|
---|
769 | cmdtail = info->prev;
|
---|
770 | }
|
---|
771 | else {
|
---|
772 | if (info->next)
|
---|
773 | (info->next)->prev = info->prev;
|
---|
774 | if (info->prev)
|
---|
775 | (info->prev)->next = info->next;
|
---|
776 | if (info == cmdtail)
|
---|
777 | cmdtail = info->prev;
|
---|
778 | }
|
---|
779 | xfree(info->pszCmdLine, pszSrcFile, __LINE__);
|
---|
780 | xfree(info->title, pszSrcFile, __LINE__);
|
---|
781 | xfree(info->env, pszSrcFile, __LINE__);
|
---|
782 | free(info);
|
---|
783 | return TRUE;
|
---|
784 | }
|
---|
785 | info = info->next;
|
---|
786 | }
|
---|
787 | }
|
---|
788 | # ifdef FORTIFY
|
---|
789 | Fortify_LeaveScope();
|
---|
790 | # endif
|
---|
791 | return FALSE;
|
---|
792 | }
|
---|
793 |
|
---|
794 | BOOL QueryCommandSettings(HWND hwnd, COMMAND *temp)
|
---|
795 | {
|
---|
796 | PSZ pszWorkBuf;
|
---|
797 | APIRET ret;
|
---|
798 | CHAR env[1002];
|
---|
799 | INT x;
|
---|
800 |
|
---|
801 | pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
802 | if (!pszWorkBuf) {
|
---|
803 | return FALSE; //already complained
|
---|
804 | }
|
---|
805 | WinQueryDlgItemText(hwnd, CMD_CL, MaxComLineStrg, temp->pszCmdLine);
|
---|
806 | NormalizeCmdLine(pszWorkBuf, temp->pszCmdLine);
|
---|
807 | memcpy(temp->pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1);
|
---|
808 | free(pszWorkBuf);
|
---|
809 | if (fCancelAction) {
|
---|
810 | fCancelAction = FALSE;
|
---|
811 | return FALSE;
|
---|
812 | }
|
---|
813 | if (!strchr(temp->pszCmdLine, '%')) {
|
---|
814 | ret = saymsg(MB_YESNO,
|
---|
815 | HWND_DESKTOP,
|
---|
816 | NullStr,
|
---|
817 | GetPString(IDS_TOACTONSELECTEDTEXT));
|
---|
818 | if (ret == MBID_YES)
|
---|
819 | strcat(temp->pszCmdLine, " %a");
|
---|
820 | }
|
---|
821 | WinQueryDlgItemText(hwnd, CMD_TITLE, sizeof(temp->title), temp->title);
|
---|
822 | bstripcr(temp->title);
|
---|
823 | temp->flags = CheckExecutibleFlags(hwnd, 3);
|
---|
824 | *env = 0;
|
---|
825 | WinQueryDlgItemText(hwnd, CMD_ENVIRON, 1000, env);
|
---|
826 | bstripcr(env);
|
---|
827 | if (*env)
|
---|
828 | strcpy(temp->env, env);
|
---|
829 | x = (SHORT) WinSendDlgItemMsg(hwnd, CMD_HOTKEY,
|
---|
830 | LM_QUERYSELECTION,
|
---|
831 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
832 | if (x < 40)
|
---|
833 | temp->HotKeyID = x + IDM_COMMANDNUM0;
|
---|
834 | else
|
---|
835 | temp->HotKeyID = 0;
|
---|
836 | DbgMsg(pszSrcFile, __LINE__, "info %i", temp->HotKeyID);
|
---|
837 | return TRUE;
|
---|
838 | }
|
---|
839 |
|
---|
840 | MRESULT EXPENTRY CommandDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
841 | {
|
---|
842 | SHORT x, y;
|
---|
843 | LINKCMDS *info;
|
---|
844 |
|
---|
845 | # ifdef FORTIFY
|
---|
846 | Fortify_EnterScope();
|
---|
847 | # endif
|
---|
848 | switch (msg) {
|
---|
849 | case WM_INITDLG:
|
---|
850 | WinSendDlgItemMsg(hwnd, CMD_LISTBOX, LM_DELETEALL, MPVOID, MPVOID);
|
---|
851 | WinSendDlgItemMsg(hwnd, CMD_CL, EM_SETTEXTLIMIT,
|
---|
852 | MPFROM2SHORT(MaxComLineStrg - 1, 0), MPVOID);
|
---|
853 | WinSendDlgItemMsg(hwnd, CMD_TITLE, EM_SETTEXTLIMIT,
|
---|
854 | MPFROM2SHORT(99, 0), MPVOID);
|
---|
855 | WinSetDlgItemText(hwnd, CMD_CL, NullStr);
|
---|
856 | WinSetDlgItemText(hwnd, CMD_TITLE, NullStr);
|
---|
857 | WinCheckButton(hwnd, CMD_DEFAULT, TRUE);
|
---|
858 | WinCheckButton(hwnd, CMD_PROMPT, FALSE);
|
---|
859 | WinCheckButton(hwnd, CMD_ONCE, FALSE);
|
---|
860 | info = cmdhead;
|
---|
861 | while (info) {
|
---|
862 | x = (SHORT) WinSendDlgItemMsg(hwnd, CMD_LISTBOX, LM_INSERTITEM,
|
---|
863 | MPFROM2SHORT(LIT_END, 0),
|
---|
864 | MPFROMP(info->title));
|
---|
865 | if (x >= 0)
|
---|
866 | WinSendDlgItemMsg(hwnd, CMD_LISTBOX, LM_SETITEMHANDLE,
|
---|
867 | MPFROMSHORT(x), MPFROMP(info));
|
---|
868 | info = info->next;
|
---|
869 | }
|
---|
870 | WinSendDlgItemMsg(hwnd, CMD_LISTBOX, LM_SELECTITEM,
|
---|
871 | MPFROMSHORT(0), MPFROMSHORT(TRUE));
|
---|
872 | {
|
---|
873 | PFNWP oldproc;
|
---|
874 |
|
---|
875 | oldproc = WinSubclassWindow(WinWindowFromID(hwnd, CMD_CL),
|
---|
876 | (PFNWP) CommandTextProc);
|
---|
877 | if (oldproc)
|
---|
878 | WinSetWindowPtr(WinWindowFromID(hwnd, CMD_CL), QWL_USER, (PVOID) oldproc);
|
---|
879 | }
|
---|
880 | break;
|
---|
881 |
|
---|
882 | case WM_CONTROL:
|
---|
883 | if (SHORT1FROMMP(mp1) == CMD_LISTBOX) {
|
---|
884 | switch (SHORT2FROMMP(mp1)) {
|
---|
885 | case LN_ENTER:
|
---|
886 | case LN_SELECT:
|
---|
887 | x = (SHORT) WinSendDlgItemMsg(hwnd, CMD_LISTBOX,
|
---|
888 | LM_QUERYSELECTION,
|
---|
889 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
890 | if (x >= 0) {
|
---|
891 | info = (LINKCMDS *) WinSendDlgItemMsg(hwnd, CMD_LISTBOX,
|
---|
892 | LM_QUERYITEMHANDLE,
|
---|
893 | MPFROMSHORT(x), MPVOID);
|
---|
894 | if (!info) {
|
---|
895 | Runtime_Error(pszSrcFile, __LINE__, "LM_QUERYITEMHANDLE");
|
---|
896 | break;
|
---|
897 | }
|
---|
898 | WinSetDlgItemText(hwnd, CMD_CL, info->pszCmdLine);
|
---|
899 | if (!(info->flags & 1023))
|
---|
900 | WinCheckButton(hwnd, CMD_DEFAULT, TRUE);
|
---|
901 | else {
|
---|
902 | if (info->flags & FULLSCREEN)
|
---|
903 | WinCheckButton(hwnd, CMD_FULLSCREEN, TRUE);
|
---|
904 | else if (info->flags & MINIMIZED)
|
---|
905 | WinCheckButton(hwnd, CMD_MINIMIZED, TRUE);
|
---|
906 | else if (info->flags & MAXIMIZED)
|
---|
907 | WinCheckButton(hwnd, CMD_MAXIMIZED, TRUE);
|
---|
908 | else if (info->flags & INVISIBLE)
|
---|
909 | WinCheckButton(hwnd, CMD_INVISIBLE, TRUE);
|
---|
910 | }
|
---|
911 | WinCheckButton(hwnd, CMD_PROMPT, ((info->flags & PROMPT) != 0));
|
---|
912 | WinCheckButton(hwnd, CMD_KEEP, ((info->flags & KEEP) != 0));
|
---|
913 | WinCheckButton(hwnd, CMD_ONCE, ((info->flags & ONCE) != 0));
|
---|
914 | WinSetDlgItemText(hwnd, CMD_TITLE, info->title);
|
---|
915 | if (info->env)
|
---|
916 | WinSetDlgItemText(hwnd, CMD_ENVIRON, info->env);
|
---|
917 | else
|
---|
918 | WinSetDlgItemText(hwnd, CMD_ENVIRON, NullStr);
|
---|
919 | for (x = 0; x < 40; x++) {
|
---|
920 | CHAR s[CCHMAXPATH + 24];
|
---|
921 |
|
---|
922 | sprintf(s, "%s%s%s",
|
---|
923 | x < IDM_COMMANDNUM20 - IDM_COMMANDNUM0 ? "Ctrl+" : NullStr,
|
---|
924 | x > IDM_COMMANDNUM19 - IDM_COMMANDNUM0 ? "Alt+" : NullStr,
|
---|
925 | (x > IDM_COMMANDNUM9 - IDM_COMMANDNUM0 &&
|
---|
926 | x < IDM_COMMANDNUM20 - IDM_COMMANDNUM0) ||
|
---|
927 | x > IDM_COMMANDNUM29 - IDM_COMMANDNUM0 ? "Shift+" : NullStr);
|
---|
928 | sprintf(&s[strlen(s)], "%d", (x % 10) + 1 == 10 ? 0 : (x % 10) + 1);
|
---|
929 | sprintf(&s[strlen(s)], " %s", UsedHotKeyIDs[x] ? "(in use)" : NullStr);
|
---|
930 | WinSendMsg(WinWindowFromID(hwnd, CMD_HOTKEY), LM_INSERTITEM,
|
---|
931 | MPFROM2SHORT(LIT_END, 0), MPFROMP(s));
|
---|
932 | if (x == 39)
|
---|
933 | WinSendMsg(WinWindowFromID(hwnd, CMD_HOTKEY), LM_INSERTITEM,
|
---|
934 | MPFROM2SHORT(LIT_END, 0), MPFROMP("none"));
|
---|
935 | if (info->HotKeyID == x + IDM_COMMANDNUM0)
|
---|
936 | WinSendMsg(WinWindowFromID(hwnd, CMD_HOTKEY), LM_SELECTITEM,
|
---|
937 | MPFROM2SHORT(x, 0), MPFROMLONG(TRUE));
|
---|
938 | if (x == 39 && info->HotKeyID == 0)
|
---|
939 | WinSendMsg(WinWindowFromID(hwnd, CMD_HOTKEY), LM_SELECTITEM,
|
---|
940 | MPFROM2SHORT(x + 1, 0), MPFROMLONG(TRUE));
|
---|
941 | } // for
|
---|
942 | }
|
---|
943 | break;
|
---|
944 | }
|
---|
945 | }
|
---|
946 | return 0;
|
---|
947 |
|
---|
948 | case WM_COMMAND:
|
---|
949 | switch (SHORT1FROMMP(mp1)) {
|
---|
950 | case CMD_FIND:
|
---|
951 | {
|
---|
952 | CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
|
---|
953 |
|
---|
954 | *filename = 0;
|
---|
955 | if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
|
---|
956 | BldQuotedFileName(szfilename, filename);
|
---|
957 | WinSetDlgItemText(hwnd, CMD_CL, szfilename);
|
---|
958 | }
|
---|
959 | }
|
---|
960 | break;
|
---|
961 |
|
---|
962 | case CMD_REORDER:
|
---|
963 | if (!cmdhead || !cmdhead->next) {
|
---|
964 | Runtime_Error(pszSrcFile, __LINE__, "no cmd");
|
---|
965 | break;
|
---|
966 | }
|
---|
967 | if (WinDlgBox(HWND_DESKTOP, hwnd, ReOrderProc, FM3ModHandle,
|
---|
968 | RE_FRAME, MPVOID)) {
|
---|
969 | WinSendDlgItemMsg(hwnd, CMD_LISTBOX, LM_DELETEALL, MPVOID, MPVOID);
|
---|
970 | WinSetDlgItemText(hwnd, CMD_CL, NullStr);
|
---|
971 | WinSetDlgItemText(hwnd, CMD_TITLE, NullStr);
|
---|
972 | info = cmdhead;
|
---|
973 | while (info) {
|
---|
974 | x = (SHORT) WinSendDlgItemMsg(hwnd,
|
---|
975 | CMD_LISTBOX,
|
---|
976 | LM_INSERTITEM,
|
---|
977 | MPFROM2SHORT(LIT_END, 0),
|
---|
978 | MPFROMP(info->title));
|
---|
979 | if (x >= 0)
|
---|
980 | WinSendDlgItemMsg(hwnd,
|
---|
981 | CMD_LISTBOX,
|
---|
982 | LM_SETITEMHANDLE,
|
---|
983 | MPFROMSHORT(x), MPFROMP(info));
|
---|
984 | info = info->next;
|
---|
985 | }
|
---|
986 | WinSendDlgItemMsg(hwnd,
|
---|
987 | CMD_LISTBOX,
|
---|
988 | LM_SELECTITEM, MPFROMSHORT(0), MPFROMSHORT(TRUE));
|
---|
989 | WinCheckButton(hwnd, CMD_DEFAULT, TRUE);
|
---|
990 | WinCheckButton(hwnd, CMD_PROMPT, FALSE);
|
---|
991 | WinCheckButton(hwnd, CMD_ONCE, FALSE);
|
---|
992 | save_commands();
|
---|
993 | }
|
---|
994 | break;
|
---|
995 |
|
---|
996 | case DID_OK:
|
---|
997 | {
|
---|
998 | COMMAND *temp;
|
---|
999 | BOOL fDontCheckHotKey = FALSE;
|
---|
1000 |
|
---|
1001 | temp = xmallocz(sizeof(COMMAND), pszSrcFile, __LINE__);
|
---|
1002 | if (!temp)
|
---|
1003 | break; //already complained
|
---|
1004 | temp->pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
1005 | if (!temp->pszCmdLine) {
|
---|
1006 | free (temp);
|
---|
1007 | break; //already complained
|
---|
1008 | }
|
---|
1009 | if (QueryCommandSettings(hwnd, temp)){
|
---|
1010 | if (temp->HotKeyID == 0)
|
---|
1011 | fDontCheckHotKey = TRUE;
|
---|
1012 | info = add_command(temp, fDontCheckHotKey);
|
---|
1013 | }
|
---|
1014 | else {
|
---|
1015 | free(temp->pszCmdLine);
|
---|
1016 | free(temp);
|
---|
1017 | break;
|
---|
1018 | }
|
---|
1019 | free(temp->pszCmdLine);
|
---|
1020 | free(temp);
|
---|
1021 | save_commands();
|
---|
1022 | WinDismissDlg(hwnd, 0);
|
---|
1023 | break;
|
---|
1024 | }
|
---|
1025 |
|
---|
1026 | case DID_CANCEL:
|
---|
1027 | WinDismissDlg(hwnd, 0);
|
---|
1028 | break;
|
---|
1029 |
|
---|
1030 | case IDM_HELP:
|
---|
1031 | if (hwndHelp)
|
---|
1032 | WinSendMsg(hwndHelp,
|
---|
1033 | HM_DISPLAY_HELP,
|
---|
1034 | MPFROM2SHORT(HELP_COMMAND, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
1035 | break;
|
---|
1036 |
|
---|
1037 | case CMD_ADD:
|
---|
1038 | {
|
---|
1039 | COMMAND *temp;
|
---|
1040 | BOOL fDontCheckHotKey = FALSE;
|
---|
1041 |
|
---|
1042 | temp = xmallocz(sizeof(COMMAND), pszSrcFile, __LINE__);
|
---|
1043 | if (!temp)
|
---|
1044 | break; //already complained
|
---|
1045 | temp->pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
1046 | if (!temp->pszCmdLine) {
|
---|
1047 | free (temp);
|
---|
1048 | break; //already complained
|
---|
1049 | }
|
---|
1050 | if (!QueryCommandSettings(hwnd, temp)) {
|
---|
1051 | free(temp->pszCmdLine);
|
---|
1052 | free(temp);
|
---|
1053 | break;
|
---|
1054 | }
|
---|
1055 | else {
|
---|
1056 | if (temp->HotKeyID == 0)
|
---|
1057 | fDontCheckHotKey = TRUE;
|
---|
1058 | info = add_command(temp, fDontCheckHotKey);
|
---|
1059 | if (!info) {
|
---|
1060 | saymsg(MB_ENTER, hwnd, GetPString(IDS_ERRORTEXT),
|
---|
1061 | GetPString(IDS_CANTADDCOMMANDTEXTDUP), temp->title);
|
---|
1062 | free(temp->pszCmdLine);
|
---|
1063 | free(temp);
|
---|
1064 | break;
|
---|
1065 | }
|
---|
1066 | x = (SHORT) WinSendDlgItemMsg(hwnd,
|
---|
1067 | CMD_LISTBOX,
|
---|
1068 | LM_INSERTITEM,
|
---|
1069 | MPFROM2SHORT(LIT_END, 0),
|
---|
1070 | MPFROMP(temp->title));
|
---|
1071 | if (x >= 0) {
|
---|
1072 | WinSendDlgItemMsg(hwnd,
|
---|
1073 | CMD_LISTBOX,
|
---|
1074 | LM_SETITEMHANDLE,
|
---|
1075 | MPFROMSHORT(x), MPFROMP(info));
|
---|
1076 | WinSendDlgItemMsg(hwnd,
|
---|
1077 | CMD_LISTBOX,
|
---|
1078 | LM_SELECTITEM,
|
---|
1079 | MPFROMSHORT(x), MPFROMSHORT(TRUE));
|
---|
1080 | }
|
---|
1081 | save_commands();
|
---|
1082 | }
|
---|
1083 | free(temp->pszCmdLine);
|
---|
1084 | free(temp);
|
---|
1085 | break;
|
---|
1086 | }
|
---|
1087 |
|
---|
1088 | case CMD_DELETE:
|
---|
1089 | {
|
---|
1090 | CHAR temp[100];
|
---|
1091 | CHAR keyID[120];
|
---|
1092 | CHAR keyHotKeyID[120];
|
---|
1093 | CHAR keyenv[120];
|
---|
1094 |
|
---|
1095 | WinQueryDlgItemText(hwnd, CMD_TITLE, 100, temp);
|
---|
1096 | bstripcr(temp);
|
---|
1097 | if (!kill_command(temp))
|
---|
1098 | Runtime_Error(pszSrcFile, __LINE__, "kill_command");
|
---|
1099 | else {
|
---|
1100 | sprintf(keyID, "COMMAND.%sID", temp);
|
---|
1101 | sprintf(keyHotKeyID, "COMMAND.%sHotKeyID", temp);
|
---|
1102 | sprintf(keyenv, "COMMAND.%senv", temp);
|
---|
1103 | PrfWriteProfileData(fmprof, FM3Str, keyID, NULL, 0);
|
---|
1104 | PrfWriteProfileData(fmprof, FM3Str, keyHotKeyID, NULL, 0);
|
---|
1105 | PrfWriteProfileString(fmprof, FM3Str, keyenv, NULL);
|
---|
1106 | x = (SHORT) WinSendDlgItemMsg(hwnd,
|
---|
1107 | CMD_LISTBOX,
|
---|
1108 | LM_QUERYSELECTION,
|
---|
1109 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
1110 | if (x >= 0) {
|
---|
1111 | WinSendDlgItemMsg(hwnd,
|
---|
1112 | CMD_LISTBOX,
|
---|
1113 | LM_DELETEITEM, MPFROMSHORT(x), MPVOID);
|
---|
1114 | WinSendDlgItemMsg(hwnd,
|
---|
1115 | CMD_LISTBOX,
|
---|
1116 | LM_SELECTITEM,
|
---|
1117 | MPFROMSHORT(0), MPFROMSHORT(TRUE));
|
---|
1118 | }
|
---|
1119 | save_commands();
|
---|
1120 | }
|
---|
1121 | }
|
---|
1122 | break;
|
---|
1123 |
|
---|
1124 | case CMD_REPLACE:
|
---|
1125 | {
|
---|
1126 | COMMAND *temp;
|
---|
1127 | CHAR keyID[120];
|
---|
1128 | CHAR keyHotKeyID[120];
|
---|
1129 | CHAR keyenv[120];
|
---|
1130 | INT ID = 0;
|
---|
1131 | INT HotKeyID = 0;
|
---|
1132 | ULONG size;
|
---|
1133 | BOOL fDontCheckHotKey = FALSE;
|
---|
1134 |
|
---|
1135 | // Query the dialog
|
---|
1136 | temp = xmallocz(sizeof(COMMAND), pszSrcFile, __LINE__);
|
---|
1137 | if (!temp)
|
---|
1138 | break; //already complained
|
---|
1139 | temp->pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
|
---|
1140 | if (!temp->pszCmdLine) {
|
---|
1141 | free (temp);
|
---|
1142 | break; //already complained
|
---|
1143 | }
|
---|
1144 | if (!QueryCommandSettings(hwnd, temp)) {
|
---|
1145 | free(temp->pszCmdLine);
|
---|
1146 | free(temp);
|
---|
1147 | break;
|
---|
1148 | }
|
---|
1149 | //remember item location in the list
|
---|
1150 | y = (SHORT) WinSendDlgItemMsg(hwnd,
|
---|
1151 | CMD_LISTBOX,
|
---|
1152 | LM_QUERYSELECTION,
|
---|
1153 | MPFROMSHORT(LIT_CURSOR), MPVOID);
|
---|
1154 | //Delete
|
---|
1155 | sprintf(keyID, "COMMAND.%sID", temp->title);
|
---|
1156 | sprintf(keyHotKeyID, "COMMAND.%sHotKeyID", temp->title);
|
---|
1157 | sprintf(keyenv, "COMMAND.%senv", temp->title);
|
---|
1158 | PrfQueryProfileData(fmprof, FM3Str, keyID, &ID, &size);
|
---|
1159 | PrfQueryProfileData(fmprof, FM3Str, keyHotKeyID, &HotKeyID, &size);
|
---|
1160 | temp->ID = ID;
|
---|
1161 | if (temp->HotKeyID == HotKeyID || temp->HotKeyID == 0)
|
---|
1162 | fDontCheckHotKey = TRUE;
|
---|
1163 | if (kill_command(temp->title)) {
|
---|
1164 | PrfWriteProfileData(fmprof, FM3Str, keyID, NULL, 0);
|
---|
1165 | PrfWriteProfileData(fmprof, FM3Str, keyHotKeyID, NULL, 0);
|
---|
1166 | PrfWriteProfileString(fmprof, FM3Str, keyenv, NULL);
|
---|
1167 | x = (SHORT) WinSendDlgItemMsg(hwnd,
|
---|
1168 | CMD_LISTBOX,
|
---|
1169 | LM_QUERYSELECTION,
|
---|
1170 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
1171 | if (x >= 0) {
|
---|
1172 | WinSendDlgItemMsg(hwnd,
|
---|
1173 | CMD_LISTBOX,
|
---|
1174 | LM_DELETEITEM, MPFROMSHORT(x), MPVOID);
|
---|
1175 | WinSendDlgItemMsg(hwnd,
|
---|
1176 | CMD_LISTBOX,
|
---|
1177 | LM_SELECTITEM,
|
---|
1178 | MPFROMSHORT(LIT_NONE), MPFROMSHORT(FALSE));
|
---|
1179 | }
|
---|
1180 | } // then do an add
|
---|
1181 | info = add_command(temp, fDontCheckHotKey);
|
---|
1182 | if (!info) {
|
---|
1183 | saymsg(MB_ENTER, hwnd, GetPString(IDS_ERRORTEXT),
|
---|
1184 | GetPString(IDS_CANTADDCOMMANDTEXT),
|
---|
1185 | temp->title);
|
---|
1186 | }
|
---|
1187 | else {
|
---|
1188 | //put item back in original place
|
---|
1189 | x = (SHORT) WinSendDlgItemMsg(hwnd,
|
---|
1190 | CMD_LISTBOX,
|
---|
1191 | LM_INSERTITEM,
|
---|
1192 | MPFROM2SHORT(y, 0),
|
---|
1193 | MPFROMP(temp->title));
|
---|
1194 | if (x >= 0) {
|
---|
1195 | LINKCMDS *temphead = NULL,*last = NULL, *temptail = NULL;
|
---|
1196 | SHORT numitems, sSelect = 0;
|
---|
1197 |
|
---|
1198 | WinSendDlgItemMsg(hwnd,
|
---|
1199 | CMD_LISTBOX,
|
---|
1200 | LM_SETITEMHANDLE,
|
---|
1201 | MPFROMSHORT(x), MPFROMP(info));
|
---|
1202 | WinSendDlgItemMsg(hwnd,
|
---|
1203 | CMD_LISTBOX,
|
---|
1204 | LM_SELECTITEM,
|
---|
1205 | MPFROMSHORT(x), MPFROMSHORT(TRUE));
|
---|
1206 | //then reorder
|
---|
1207 | numitems = (SHORT) WinSendDlgItemMsg(hwnd, CMD_LISTBOX,
|
---|
1208 | LM_QUERYITEMCOUNT,
|
---|
1209 | MPVOID, MPVOID);
|
---|
1210 |
|
---|
1211 | while (numitems) {
|
---|
1212 |
|
---|
1213 |
|
---|
1214 | info = (LINKCMDS *) WinSendDlgItemMsg(hwnd, CMD_LISTBOX,
|
---|
1215 | LM_QUERYITEMHANDLE,
|
---|
1216 | MPFROMSHORT(sSelect++),
|
---|
1217 | MPVOID);
|
---|
1218 | if (info) {
|
---|
1219 | if (!temphead) {
|
---|
1220 | temphead = info;
|
---|
1221 | info->prev = NULL;
|
---|
1222 | }
|
---|
1223 | else {
|
---|
1224 | last->next = info;
|
---|
1225 | info->prev = last;
|
---|
1226 | }
|
---|
1227 | temptail = info;
|
---|
1228 | last = info;
|
---|
1229 | info->next = NULL;
|
---|
1230 | }
|
---|
1231 | numitems--;
|
---|
1232 | }
|
---|
1233 | cmdhead = temphead;
|
---|
1234 | cmdtail = temptail;
|
---|
1235 | save_commands();
|
---|
1236 | }
|
---|
1237 | }
|
---|
1238 | xfree(temp->pszCmdLine, pszSrcFile, __LINE__);
|
---|
1239 | xfree(temp, pszSrcFile, __LINE__);
|
---|
1240 | }
|
---|
1241 | break;
|
---|
1242 | }
|
---|
1243 | return 0;
|
---|
1244 | }
|
---|
1245 | # ifdef FORTIFY
|
---|
1246 | Fortify_LeaveScope();
|
---|
1247 | # endif
|
---|
1248 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
1249 | }
|
---|
1250 |
|
---|
1251 | VOID RunCommand(HWND hwnd, INT cx)
|
---|
1252 | {
|
---|
1253 | INT x;
|
---|
1254 | CHAR **list;
|
---|
1255 | LINKCMDS *info;
|
---|
1256 |
|
---|
1257 | list = BuildList(hwnd);
|
---|
1258 | x = 0;
|
---|
1259 | info = cmdhead;
|
---|
1260 | while (info) {
|
---|
1261 | if (cx < 4300) {
|
---|
1262 | if (info->ID == cx)
|
---|
1263 | break;
|
---|
1264 | }
|
---|
1265 | else {
|
---|
1266 | if (info->HotKeyID == cx)
|
---|
1267 | break;
|
---|
1268 | }
|
---|
1269 | info = info->next;
|
---|
1270 | }
|
---|
1271 | if (info) {
|
---|
1272 |
|
---|
1273 | INT flags;
|
---|
1274 |
|
---|
1275 | x--;
|
---|
1276 | flags = info->flags;
|
---|
1277 | if (!(flags & FULLSCREEN))
|
---|
1278 | flags |= WINDOWED;
|
---|
1279 | if (flags & KEEP)
|
---|
1280 | flags |= SEPARATEKEEP;
|
---|
1281 | else
|
---|
1282 | flags |= SEPARATE;
|
---|
1283 | flags &= ~(KEEP | DIEAFTER);
|
---|
1284 | if (!strchr(info->pszCmdLine, '%')) {
|
---|
1285 | CHAR *fakelist[2];
|
---|
1286 |
|
---|
1287 | *fakelist = "C";
|
---|
1288 | fakelist[1] = NULL;
|
---|
1289 | ExecOnList(hwnd,
|
---|
1290 | info->pszCmdLine,
|
---|
1291 | flags, info->env != NullStr ? info->env : NULL,
|
---|
1292 | fakelist, GetPString(IDS_EXECCMDTITLETEXT),
|
---|
1293 | pszSrcFile, __LINE__);
|
---|
1294 | }
|
---|
1295 | else if ((flags & ONCE) && list && list[0]) {
|
---|
1296 |
|
---|
1297 | CHAR *fakelist[2];
|
---|
1298 | INT cntr;
|
---|
1299 |
|
---|
1300 | flags &= (~ONCE);
|
---|
1301 | for (cntr = 0; list[cntr]; cntr++) {
|
---|
1302 | *fakelist = list[cntr];
|
---|
1303 | fakelist[1] = NULL;
|
---|
1304 | ExecOnList(hwnd,
|
---|
1305 | info->pszCmdLine,
|
---|
1306 | flags, info->env != NullStr ? info->env : NULL,
|
---|
1307 | fakelist, GetPString(IDS_EXECCMDTITLETEXT),
|
---|
1308 | pszSrcFile, __LINE__);
|
---|
1309 | }
|
---|
1310 | }
|
---|
1311 | else if (list && list[0])
|
---|
1312 | ExecOnList(hwnd,
|
---|
1313 | info->pszCmdLine,
|
---|
1314 | flags, info->env != NullStr ? info->env : NULL,
|
---|
1315 | list, GetPString(IDS_EXECCMDTITLETEXT),
|
---|
1316 | pszSrcFile, __LINE__);
|
---|
1317 | else
|
---|
1318 | return;
|
---|
1319 | }
|
---|
1320 | FreeList(list);
|
---|
1321 | DosPostEventSem(CompactSem);
|
---|
1322 | }
|
---|
1323 |
|
---|
1324 | VOID EditCommands(HWND hwnd)
|
---|
1325 | {
|
---|
1326 | static CHAR stop = 0;
|
---|
1327 |
|
---|
1328 | if (stop)
|
---|
1329 | return;
|
---|
1330 | stop++;
|
---|
1331 | if (!cmdloaded)
|
---|
1332 | load_commands();
|
---|
1333 | WinDlgBox(HWND_DESKTOP,
|
---|
1334 | hwnd, CommandDlgProc, FM3ModHandle, CMD_FRAME, MPFROMP(&hwnd));
|
---|
1335 | stop = 0;
|
---|
1336 | }
|
---|
1337 |
|
---|
1338 | #pragma alloc_text(COMMAND,command_title,free_commands,add_command,kill_command)
|
---|
1339 | #pragma alloc_text(COMMAND,CommandDlgProc,EditCommands,ReOrderProc,CommandTextProc)
|
---|