source: trunk/dll/command.c@ 1487

Last change on this file since 1487 was 1487, checked in by Gregg Young, 16 years ago

Fixed potential problem with adding duplicate command IDs in new command code

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