Changeset 487
- Timestamp:
- Sep 7, 2006, 7:10:39 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/tools.c
r440 r487 14 14 29 Jul 06 SHL Use xfgets, xfgets_bstripcr 15 15 18 Aug 06 SHL Report more runtime errors 16 05 Sep 06 SHL docopyf filename args must be variables 17 05 Sep 06 SHL Sync with standard source formattting 16 18 17 19 ***********************************************************************/ … … 90 92 CHAR s[CCHMAXPATH + 14]; 91 93 92 if (!quicktool[0])94 if (!quicktool[0]) 93 95 return; 94 96 save_dir2(s); 95 if (s[strlen(s) - 1] != '\\')97 if (s[strlen(s) - 1] != '\\') 96 98 strcat(s,"\\"); 97 99 strcat(s,"QUICKTLS.DAT"); 98 100 fp = xfopen(s,"w",pszSrcFile,__LINE__); 99 101 if (fp) { 100 for (x = 0;quicktool[x] && x < 50;x++)102 for (x = 0;quicktool[x] && x < 50;x++) 101 103 fprintf(fp,"%s\n",quicktool[x]); 102 104 fclose(fp); … … 113 115 TOOL *info; 114 116 115 if (!fToolbar) {117 if (!fToolbar) { 116 118 toolhead = free_tools(); 117 119 return toolhead; 118 120 } 119 if (!filename ||121 if (!filename || 120 122 !*filename) 121 123 filename = (*lasttoolbox) ? lasttoolbox : "CMDS.TLS"; 122 if (*filename)124 if (*filename) 123 125 fname = searchpath(filename); 124 if (!fname ||126 if (!fname || 125 127 !*fname) 126 128 fname = "FM3TOOLS.DAT"; 127 if (fname &&129 if (fname && 128 130 *fname) { 129 131 filename = fname; … … 132 134 if (fp) { 133 135 toolhead = free_tools(); 134 while (!feof(fp)) {136 while (!feof(fp)) { 135 137 do { 136 if (!xfgets(help,sizeof(help),fp,pszSrcFile,__LINE__))138 if (!xfgets(help,sizeof(help),fp,pszSrcFile,__LINE__)) 137 139 break; 138 } while (*help == ';' && !feof(fp));140 } while (*help == ';' && !feof(fp)); 139 141 stripcr(help); 140 if (!xfgets(text,sizeof(text),fp,pszSrcFile,__LINE__))142 if (!xfgets(text,sizeof(text),fp,pszSrcFile,__LINE__)) 141 143 break; 142 144 stripcr(text); 143 if (!xfgets(flagstr,sizeof(flagstr),fp,pszSrcFile,__LINE__))144 break; 145 if (!xfgets(idstr,sizeof(idstr),fp,pszSrcFile,__LINE__))146 break; 147 if (!(USHORT)atoi(idstr))145 if (!xfgets(flagstr,sizeof(flagstr),fp,pszSrcFile,__LINE__)) 146 break; 147 if (!xfgets(idstr,sizeof(idstr),fp,pszSrcFile,__LINE__)) 148 break; 149 if (!(USHORT)atoi(idstr)) 148 150 continue; 149 151 info = xmallocz(sizeof(TOOL),pszSrcFile,__LINE__); 150 152 if (info) { 151 if (*help) {153 if (*help) { 152 154 literal(help); 153 if (*help)155 if (*help) 154 156 info->help = xstrdup(help,pszSrcFile,__LINE__); 155 157 } 156 if (*text)158 if (*text) 157 159 info->text = xstrdup(text,pszSrcFile,__LINE__); 158 160 info->flags = (atoi(flagstr) & (~(T_TEXT | T_EMPHASIZED))); … … 176 178 TOOL *info; 177 179 178 if (!filename)180 if (!filename) 179 181 filename = lasttoolbox; 180 if (*filename)182 if (*filename) 181 183 fname = searchpath(filename); 182 if (fname && *fname)184 if (fname && *fname) 183 185 filename = fname; 184 186 else { 185 if (*lasttoolbox)187 if (*lasttoolbox) 186 188 filename = lasttoolbox; 187 189 else 188 190 filename = "FM3TOOLS.TLS"; 189 191 fname = searchpath(filename); 190 if (fname && *fname)192 if (fname && *fname) 191 193 filename = fname; 192 194 } 193 195 194 if (stristr(filename,"FM3TOOLS.DAT"))196 if (stristr(filename,"FM3TOOLS.DAT")) 195 197 filename = "FM3TOOLS.TLS"; 196 if (toolhead && filename && *filename) {198 if (toolhead && filename && *filename) { 197 199 strcpy(lasttoolbox,filename); 198 PrfWriteProfileString(fmprof, 199 FM3Str, 200 "LastToolBox", 201 filename); 202 } 203 if(!toolhead) { 200 PrfWriteProfileString(fmprof,FM3Str,"LastToolBox",filename); 201 } 202 if (!toolhead) { 204 203 unlinkf("%s",filename); 205 204 return; … … 209 208 fprintf(fp,GetPString(IDS_TOOLFILETEXT),filename); 210 209 info = toolhead; 211 while (info) {210 while (info) { 212 211 fprintf(fp, 213 212 "%s\n%s\n%u\n%u\n;\n", … … 221 220 fToolsChanged = FALSE; 222 221 } 223 if(hwndMain) 224 PostMsg(hwndMain, 225 UM_FILLBUTTONLIST, 226 MPVOID, 227 MPVOID); 222 if (hwndMain) 223 PostMsg(hwndMain,UM_FILLBUTTONLIST,MPVOID,MPVOID); 228 224 } 229 225 … … 233 229 TOOL *info; 234 230 235 if (tool) {231 if (tool) { 236 232 info = toolhead; 237 if (info) {238 while (info->next)233 if (info) { 234 while (info->next) 239 235 info = info->next; 240 236 } 241 if (info)237 if (info) 242 238 info->next = tool; 243 239 else … … 251 247 TOOL *insert_tool(TOOL *tool,TOOL *after) 252 248 { 253 if (tool) {254 if (!toolhead)249 if (tool) { 250 if (!toolhead) 255 251 return add_tool(tool); 256 if (!after) {252 if (!after) { 257 253 tool->next = toolhead; 258 254 toolhead = tool; … … 273 269 TOOL *info,*prev = NULL; 274 270 275 if (tool) {271 if (tool) { 276 272 info = toolhead; 277 while (info) {278 if (info == tool) {279 if (info == toolhead)273 while (info) { 274 if (info == tool) { 275 if (info == toolhead) 280 276 toolhead = info->next; 281 if (prev)277 if (prev) 282 278 prev->next = info->next; 283 if (info->help)279 if (info->help) 284 280 free(info->help); 285 if (info->text)281 if (info->text) 286 282 free(info->text); 287 283 free(info); … … 301 297 TOOL *tool; 302 298 303 if (id) {299 if (id) { 304 300 tool = toolhead; 305 while (tool) {306 if (id && tool->id == id)301 while (tool) { 302 if (id && tool->id == id) 307 303 return tool; 308 304 tool = tool->next; … … 315 311 TOOL *next_tool(TOOL *tool,BOOL skipinvisible) 316 312 { 317 while (tool) {318 if (tool->next && (skipinvisible && (tool->next->flags & T_INVISIBLE)))313 while (tool) { 314 if (tool->next && (skipinvisible && (tool->next->flags & T_INVISIBLE))) 319 315 tool = tool->next; 320 316 else … … 330 326 331 327 Again: 332 while (tool) {328 while (tool) { 333 329 info = toolhead; 334 while (info) {335 if (info->next == tool) {336 if (skipinvisible && (info->flags & T_INVISIBLE)) {330 while (info) { 331 if (info->next == tool) { 332 if (skipinvisible && (info->flags & T_INVISIBLE)) { 337 333 tool = info; 338 334 goto Again; … … 340 336 return info; 341 337 } 342 if (!info->next && tool == toolhead)338 if (!info->next && tool == toolhead) 343 339 return info; 344 340 info = info->next; … … 354 350 TOOL *prev1 = NULL,*prev2 = NULL,*info; 355 351 356 if (tool1 && tool2 && tool1 != tool2) {352 if (tool1 && tool2 && tool1 != tool2) { 357 353 info = toolhead; 358 while (info && !prev1 && !prev2) {359 if (info->next == tool1)354 while (info && !prev1 && !prev2) { 355 if (info->next == tool1) 360 356 prev1 = info; 361 else if (info->next == tool2)357 else if (info->next == tool2) 362 358 prev2 = info; 363 359 info = info->next; … … 367 363 tool1 = info; 368 364 info = tool2->next; 369 if (prev1)365 if (prev1) 370 366 prev1->next = tool2; 371 if (prev2)367 if (prev2) 372 368 prev2->next = tool1; 373 369 tool2->next = tool1->next; … … 384 380 385 381 tool = toolhead; 386 while (tool) {382 while (tool) { 387 383 next = tool->next; 388 if (tool->help)384 if (tool->help) 389 385 free(tool->help); 390 if (tool->text)386 if (tool->text) 391 387 free(tool->text); 392 388 free(tool); … … 398 394 399 395 400 MRESULT EXPENTRY ReOrderToolsProc(HWND hwnd,ULONG msg,MPARAM mp1, 401 MPARAM mp2) 402 { 403 switch(msg) { 396 MRESULT EXPENTRY ReOrderToolsProc(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 397 { 398 switch (msg) { 404 399 case WM_INITDLG: 405 if (!toolhead || !toolhead->next)400 if (!toolhead || !toolhead->next) 406 401 WinDismissDlg(hwnd,0); 407 WinSetWindowText(hwnd, 408 GetPString(IDS_RETOOLTEXT)); 402 WinSetWindowText(hwnd,GetPString(IDS_RETOOLTEXT)); 409 403 { 410 404 TOOL *tool; … … 413 407 414 408 tool = toolhead; 415 while (tool) {409 while (tool) { 416 410 sprintf(s, 417 411 "%-5u %s", … … 423 417 MPFROMSHORT(LIT_END), 424 418 MPFROMP(s)); 425 if (sSelect >= 0)419 if (sSelect >= 0) 426 420 WinSendDlgItemMsg(hwnd, 427 421 RE_ADDLISTBOX, … … 438 432 439 433 case WM_COMMAND: 440 switch (SHORT1FROMMP(mp1)) {434 switch (SHORT1FROMMP(mp1)) { 441 435 case DID_CANCEL: 442 436 WinDismissDlg(hwnd,0); … … 451 445 LM_QUERYITEMCOUNT, 452 446 MPVOID,MPVOID); 453 while (numitems) {447 while (numitems) { 454 448 tool = (TOOL *)WinSendDlgItemMsg(hwnd,RE_REMOVELISTBOX, 455 449 LM_QUERYITEMHANDLE, 456 450 MPFROMSHORT(sSelect++),MPVOID); 457 if (tool) {458 if (!thead)451 if (tool) { 452 if (!thead) 459 453 thead = tool; 460 454 else … … 468 462 LM_QUERYITEMCOUNT, 469 463 MPVOID,MPVOID); 470 while (numitems) {464 while (numitems) { 471 465 tool = (TOOL *)WinSendDlgItemMsg(hwnd,RE_ADDLISTBOX, 472 466 LM_QUERYITEMHANDLE, 473 467 MPFROMSHORT(sSelect++), 474 468 MPVOID); 475 if (tool) {476 if (!thead)469 if (tool) { 470 if (!thead) 477 471 thead = tool; 478 472 else … … 482 476 numitems--; 483 477 } 484 if (last)478 if (last) 485 479 last->next = NULL; 486 480 toolhead = thead; … … 491 485 492 486 case IDM_HELP: 493 if (hwndHelp)487 if (hwndHelp) 494 488 WinSendMsg(hwndHelp,HM_DISPLAY_HELP, 495 489 MPFROM2SHORT(HELP_REORDERBUTTONS,0), … … 508 502 MPFROMSHORT(LIT_FIRST), 509 503 MPVOID); 510 while (sSelect >= 0) {504 while (sSelect >= 0) { 511 505 tool = (TOOL *)WinSendDlgItemMsg(hwnd, 512 506 RE_ADDLISTBOX, … … 514 508 MPFROMSHORT(sSelect), 515 509 MPVOID); 516 if (tool) {510 if (tool) { 517 511 sprintf(s, 518 512 "%-5u %s", … … 524 518 MPFROM2SHORT(LIT_END,0), 525 519 MPFROMP(s)); 526 if (sSelect2 >= 0)520 if (sSelect2 >= 0) 527 521 WinSendDlgItemMsg(hwnd, 528 522 RE_REMOVELISTBOX, … … 562 556 MPFROMSHORT(LIT_FIRST), 563 557 MPVOID); 564 while (sSelect >= 0) {558 while (sSelect >= 0) { 565 559 tool = (TOOL *)WinSendDlgItemMsg(hwnd, 566 560 RE_REMOVELISTBOX, … … 568 562 MPFROMSHORT(sSelect), 569 563 MPVOID); 570 if (tool) {564 if (tool) { 571 565 sprintf(s, 572 566 "%-5u %s", … … 578 572 MPFROM2SHORT(LIT_END,0), 579 573 MPFROMP(s)); 580 if (sSelect2 >= 0)574 if (sSelect2 >= 0) 581 575 WinSendDlgItemMsg(hwnd, 582 576 RE_ADDLISTBOX, … … 613 607 MRESULT EXPENTRY AddToolProc(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 614 608 { 615 switch (msg) {609 switch (msg) { 616 610 case WM_INITDLG: 617 611 WinSetWindowPtr(hwnd,QWL_USER,mp2); 618 if (mp2) {612 if (mp2) { 619 613 WinSetWindowText(hwnd,GetPString(IDS_EDITTOOLTEXT)); 620 614 WinSendDlgItemMsg(hwnd,ADDBTN_ID,EM_SETREADONLY, … … 627 621 WinSendDlgItemMsg(hwnd,ADDBTN_ID,EM_SETTEXTLIMIT, 628 622 MPFROM2SHORT(5,0),MPVOID); 629 if (!mp2)623 if (!mp2) 630 624 WinCheckButton(hwnd,ADDBTN_VISIBLE,TRUE); 631 625 else { … … 633 627 CHAR s[33]; 634 628 635 if (tool->help)629 if (tool->help) 636 630 WinSetDlgItemText(hwnd,ADDBTN_HELP,tool->help); 637 if (tool->text)631 if (tool->text) 638 632 WinSetDlgItemText(hwnd,ADDBTN_TEXT,tool->text); 639 if (tool->flags & T_MYICON)633 if (tool->flags & T_MYICON) 640 634 WinCheckButton(hwnd,ADDBTN_MYICON,TRUE); 641 635 else 642 636 WinEnableWindow(WinWindowFromID(hwnd,ADDBTN_EDITBMP),FALSE); 643 if (tool->flags & T_DROPABLE)637 if (tool->flags & T_DROPABLE) 644 638 WinCheckButton(hwnd,ADDBTN_DROPABLE,TRUE); 645 if (!(tool->flags & T_INVISIBLE))639 if (!(tool->flags & T_INVISIBLE)) 646 640 WinCheckButton(hwnd,ADDBTN_VISIBLE,TRUE); 647 if (tool->flags & T_SEPARATOR)641 if (tool->flags & T_SEPARATOR) 648 642 WinCheckButton(hwnd,ADDBTN_SEPARATOR,TRUE); 649 if (tool->flags & T_TEXT)643 if (tool->flags & T_TEXT) 650 644 WinCheckButton(hwnd,ADDBTN_SHOWTEXT,TRUE); 651 sprintf(s, 652 "%u", 653 tool->id); 654 WinSetDlgItemText(hwnd, 655 ADDBTN_ID, 656 s); 657 WinEnableWindow(WinWindowFromID(hwnd,ADDBTN_SHOWTEXT), 658 FALSE); 659 } 660 WinShowWindow(WinWindowFromID(hwnd,ADDBTN_SHOWTEXT), 661 FALSE); 662 PostMsg(hwnd, 663 UM_SETUP, 664 MPVOID, 665 MPVOID); 645 sprintf(s,"%u",tool->id); 646 WinSetDlgItemText(hwnd,ADDBTN_ID,s); 647 WinEnableWindow(WinWindowFromID(hwnd,ADDBTN_SHOWTEXT),FALSE); 648 } 649 WinShowWindow(WinWindowFromID(hwnd,ADDBTN_SHOWTEXT),FALSE); 650 PostMsg(hwnd,UM_SETUP,MPVOID,MPVOID); 666 651 break; 667 652 … … 687 672 WinQueryDlgItemText(hwnd,ADDBTN_ID,6,idstr); 688 673 id = atoi(idstr); 689 if (id) {674 if (id) { 690 675 hps = WinGetPS(WinWindowFromID(hwnd,ADDBTN_BMP)); 691 if (!WinQueryButtonCheckstate(hwnd,ADDBTN_MYICON))676 if (!WinQueryButtonCheckstate(hwnd,ADDBTN_MYICON)) 692 677 hbm = GpiLoadBitmap(hps,0,id,28,28); 693 if (!hbm)678 if (!hbm) 694 679 hbm = LoadBitmapFromFileNum(id); 695 if (hbm) {680 if (hbm) { 696 681 hbmd = (HBITMAP)WinSendDlgItemMsg(hwnd,ADDBTN_BMP,SM_QUERYHANDLE, 697 682 MPVOID,MPVOID); 698 683 hbmdd = (HBITMAP)WinSendDlgItemMsg(hwnd,ADDBTN_BMP,SM_SETHANDLE, 699 684 MPFROMLONG(hbm),MPVOID); 700 if (hbmdd && hbmd && hbmd != hbmdd)685 if (hbmdd && hbmd && hbmd != hbmdd) 701 686 GpiDeleteBitmap(hbmd); 702 687 } … … 706 691 707 692 case WM_CONTROL: 708 switch (SHORT1FROMMP(mp1)) {693 switch (SHORT1FROMMP(mp1)) { 709 694 case ADDBTN_HELP: 710 if(SHORT2FROMMP(mp1) == EN_KILLFOCUS) 711 WinSetDlgItemText(hwnd, 712 ADDBTN_HELPME, 713 NullStr); 714 if(SHORT2FROMMP(mp1) == EN_SETFOCUS) 695 if (SHORT2FROMMP(mp1) == EN_KILLFOCUS) 696 WinSetDlgItemText(hwnd,ADDBTN_HELPME,NullStr); 697 if (SHORT2FROMMP(mp1) == EN_SETFOCUS) 715 698 WinSetDlgItemText(hwnd,ADDBTN_HELPME, 716 699 GetPString(IDS_ADDTOOLQUICKHELPTEXT)); … … 718 701 719 702 case ADDBTN_TEXT: 720 if(SHORT2FROMMP(mp1) == EN_KILLFOCUS) 721 WinSetDlgItemText(hwnd, 722 ADDBTN_HELPME, 723 NullStr); 724 if(SHORT2FROMMP(mp1) == EN_SETFOCUS) 703 if (SHORT2FROMMP(mp1) == EN_KILLFOCUS) 704 WinSetDlgItemText(hwnd,ADDBTN_HELPME,NullStr); 705 if (SHORT2FROMMP(mp1) == EN_SETFOCUS) 725 706 WinSetDlgItemText(hwnd,ADDBTN_HELPME, 726 707 GetPString(IDS_ADDTOOLBUTTONTEXT)); … … 728 709 729 710 case ADDBTN_ID: 730 if(SHORT2FROMMP(mp1) == EN_KILLFOCUS) { 731 WinSetDlgItemText(hwnd, 732 ADDBTN_HELPME, 733 NullStr); 734 PostMsg(hwnd, 735 UM_SETUP, 736 MPVOID, 737 MPVOID); 738 } 739 if(SHORT2FROMMP(mp1) == EN_SETFOCUS) 711 if (SHORT2FROMMP(mp1) == EN_KILLFOCUS) { 712 WinSetDlgItemText(hwnd,ADDBTN_HELPME,NullStr); 713 PostMsg(hwnd,UM_SETUP,MPVOID,MPVOID); 714 } 715 if (SHORT2FROMMP(mp1) == EN_SETFOCUS) 740 716 WinSetDlgItemText(hwnd, 741 717 ADDBTN_HELPME, … … 752 728 753 729 case WM_COMMAND: 754 switch (SHORT1FROMMP(mp1)) {730 switch (SHORT1FROMMP(mp1)) { 755 731 case DID_OK: 756 732 { … … 761 737 WinQueryDlgItemText(hwnd,ADDBTN_HELP,80,help); 762 738 WinQueryDlgItemText(hwnd,ADDBTN_TEXT,80,text); 763 if (WinQueryButtonCheckstate(hwnd,ADDBTN_DROPABLE))739 if (WinQueryButtonCheckstate(hwnd,ADDBTN_DROPABLE)) 764 740 dropable = TRUE; 765 741 else 766 742 dropable = FALSE; 767 743 myicon = WinQueryButtonCheckstate(hwnd,ADDBTN_MYICON); 768 if (WinQueryButtonCheckstate(hwnd,ADDBTN_VISIBLE))744 if (WinQueryButtonCheckstate(hwnd,ADDBTN_VISIBLE)) 769 745 invisible = FALSE; 770 746 else 771 747 invisible = TRUE; 772 if (WinQueryButtonCheckstate(hwnd,ADDBTN_SEPARATOR))748 if (WinQueryButtonCheckstate(hwnd,ADDBTN_SEPARATOR)) 773 749 separator = TRUE; 774 750 else 775 751 separator = FALSE; 776 if (WinQueryButtonCheckstate(hwnd,ADDBTN_SHOWTEXT))752 if (WinQueryButtonCheckstate(hwnd,ADDBTN_SHOWTEXT)) 777 753 istext = TRUE; 778 754 else 779 755 istext = FALSE; 780 756 tool = INSTDATA(hwnd); 781 if (tool) { /* just editing strings... */757 if (tool) { /* just editing strings... */ 782 758 istext = ((tool->flags & T_TEXT) != 0); 783 if (tool->help)759 if (tool->help) 784 760 free(tool->help); 785 761 tool->help = NULL; 786 if (tool->text)762 if (tool->text) 787 763 free(tool->text); 788 764 tool->text = NULL; 789 if (*help)765 if (*help) 790 766 tool->help = xstrdup(help,pszSrcFile,__LINE__); 791 if (*text)767 if (*text) 792 768 tool->text = xstrdup(text,pszSrcFile,__LINE__); 793 769 tool->flags = (((dropable) ? T_DROPABLE : 0) | … … 802 778 *idstr = 0; 803 779 WinQueryDlgItemText(hwnd,ADDBTN_ID,6,idstr); 804 if (!(USHORT)atoi(idstr)) {780 if (!(USHORT)atoi(idstr)) { 805 781 DosBeep(250,100); 806 782 break; 807 783 } 808 784 tool = toolhead; 809 while (tool) {810 if (tool->id == (USHORT)atoi(idstr) && tool != tool) {785 while (tool) { 786 if (tool->id == (USHORT)atoi(idstr) && tool != tool) { 811 787 saymsg(MB_ENTER, 812 788 hwnd, 813 789 GetPString(IDS_DUPLICATETEXT), 814 790 GetPString(IDS_TOOLIDEXISTS)); 815 WinSetDlgItemText(hwnd, 816 ADDBTN_ID, 817 NullStr); 818 WinSetFocus(HWND_DESKTOP, 819 WinWindowFromID(hwnd,ADDBTN_ID)); 791 WinSetDlgItemText(hwnd,ADDBTN_ID,NullStr); 792 WinSetFocus(HWND_DESKTOP,WinWindowFromID(hwnd,ADDBTN_ID)); 820 793 break; 821 794 } … … 824 797 tool = xmallocz(sizeof(TOOL),pszSrcFile,__LINE__); 825 798 if (tool) { 826 if (*help)799 if (*help) 827 800 tool->help = xstrdup(help,pszSrcFile,__LINE__); 828 if (*text)801 if (*text) 829 802 tool->text = xstrdup(text,pszSrcFile,__LINE__); 830 803 tool->id = (USHORT)atoi(idstr); … … 850 823 *idstr = 0; 851 824 WinQueryDlgItemText(hwnd,ADDBTN_ID,6,idstr); 852 if (!(USHORT)atoi(idstr)) {825 if (!(USHORT)atoi(idstr)) { 853 826 DosBeep(250,100); 854 827 break; 855 828 } 856 sprintf(filename, 857 "%u.BMP", 858 atoi(idstr)); 859 if(IsFile(filename) != 1) 860 docopyf(COPY, 861 "EMPTY.BMP", 862 filename); 829 sprintf(filename,"%u.BMP",atoi(idstr)); 830 if (IsFile(filename) != 1) { 831 CHAR s[CCHMAXPATH] = "EMPTY.BMP"; 832 docopyf(COPY, s, filename); 833 } 863 834 runemf2(SEPARATE | WINDOWED, 864 835 hwnd, … … 871 842 872 843 case IDM_HELP: 873 if (hwndHelp) {874 if (INSTDATA(hwnd))844 if (hwndHelp) { 845 if (INSTDATA(hwnd)) 875 846 WinSendMsg(hwndHelp,HM_DISPLAY_HELP, 876 847 MPFROM2SHORT(HELP_CHANGEBUTTON,0), … … 891 862 MRESULT EXPENTRY PickToolProc(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 892 863 { 893 switch (msg) {864 switch (msg) { 894 865 case WM_INITDLG: 895 if (mp2) {866 if (mp2) { 896 867 CHAR s[133]; 897 868 … … 906 877 907 878 tool = toolhead; 908 while (tool) {879 while (tool) { 909 880 sprintf(s, 910 881 "%-5u %s", … … 922 893 923 894 case WM_CONTROL: 924 if (SHORT1FROMMP(mp1) == PICKBTN_LISTBOX) {925 switch (SHORT2FROMMP(mp1)) {895 if (SHORT1FROMMP(mp1) == PICKBTN_LISTBOX) { 896 switch (SHORT2FROMMP(mp1)) { 926 897 case LN_ENTER: 927 898 PostMsg(hwnd,WM_COMMAND,MPFROM2SHORT(DID_OK,0),MPVOID); … … 932 903 933 904 case WM_COMMAND: 934 switch (SHORT1FROMMP(mp1)) {905 switch (SHORT1FROMMP(mp1)) { 935 906 case DID_CANCEL: 936 907 WinDismissDlg(hwnd,0); … … 945 916 MPFROMSHORT(LIT_FIRST), 946 917 MPVOID); 947 if (sSelect >= 0) {918 if (sSelect >= 0) { 948 919 *s = 0; 949 920 WinSendDlgItemMsg(hwnd,PICKBTN_LISTBOX,LM_QUERYITEMTEXT, 950 921 MPFROM2SHORT(sSelect,32),MPFROMP(s)); 951 if (*s)922 if (*s) 952 923 WinDismissDlg(hwnd,(USHORT)atoi(s)); 953 924 } … … 963 934 MRESULT EXPENTRY ToolIODlgProc(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 964 935 { 965 switch (msg) {936 switch (msg) { 966 937 case WM_INITDLG: 967 if (mp2)938 if (mp2) 968 939 WinSetWindowULong(hwnd,QWL_USER,TRUE); 969 940 else { … … 983 954 CHAR *masks[] = {"*.TLS","FM3TOOLS.DAT",NULL}; 984 955 985 if (mp2)956 if (mp2) 986 957 masks[1] = NULL; 987 while (masks[x]) {958 while (masks[x]) { 988 959 hDir = HDIR_CREATE; 989 960 ulSearchCount = 1L; 990 961 DosError(FERR_DISABLEHARDERR); 991 if (!DosFindFirst(masks[x],962 if (!DosFindFirst(masks[x], 992 963 &hDir, 993 964 FILE_ARCHIVED, … … 1004 975 MPFROMP(findbuf.achName)); 1005 976 ulSearchCount = 1L; 1006 } while (!DosFindNext(hDir,977 } while (!DosFindNext(hDir, 1007 978 &findbuf, 1008 979 sizeof(FILEFINDBUF3), … … 1015 986 DosError(FERR_DISABLEHARDERR); 1016 987 } 1017 if (!WinSendDlgItemMsg(hwnd,988 if (!WinSendDlgItemMsg(hwnd, 1018 989 SVBTN_LISTBOX, 1019 990 LM_QUERYITEMCOUNT, 1020 991 MPVOID, 1021 992 MPVOID)) { 1022 WinEnableWindow(WinWindowFromID(hwnd, 1023 SVBTN_LISTBOX), 993 WinEnableWindow(WinWindowFromID(hwnd,SVBTN_LISTBOX), 1024 994 FALSE); 1025 PostMsg(hwnd, 1026 UM_SETUP, 1027 MPVOID, 1028 MPVOID); 995 PostMsg(hwnd,UM_SETUP,MPVOID,MPVOID); 1029 996 } 1030 997 WinSetDlgItemText(hwnd, … … 1040 1007 1041 1008 case WM_CONTROL: 1042 if (SHORT1FROMMP(mp1) == SVBTN_LISTBOX) {1009 if (SHORT1FROMMP(mp1) == SVBTN_LISTBOX) { 1043 1010 SHORT sSelect; 1044 1011 CHAR szBuffer[CCHMAXPATH]; 1045 1012 1046 switch (SHORT2FROMMP(mp1)) {1013 switch (SHORT2FROMMP(mp1)) { 1047 1014 case LN_SELECT: 1048 1015 sSelect = (SHORT)WinSendDlgItemMsg(hwnd,SVBTN_LISTBOX, … … 1050 1017 MPFROMSHORT(LIT_FIRST), 1051 1018 MPVOID); 1052 if (sSelect >= 0) {1019 if (sSelect >= 0) { 1053 1020 *szBuffer = 0; 1054 1021 WinSendDlgItemMsg(hwnd,SVBTN_LISTBOX,LM_QUERYITEMTEXT, 1055 1022 MPFROM2SHORT(sSelect,CCHMAXPATH), 1056 1023 MPFROMP(szBuffer)); 1057 if (*szBuffer)1024 if (*szBuffer) 1058 1025 WinSetDlgItemText(hwnd,SVBTN_ENTRY,szBuffer); 1059 1026 } … … 1068 1035 1069 1036 case WM_COMMAND: 1070 switch (SHORT1FROMMP(mp1)) {1037 switch (SHORT1FROMMP(mp1)) { 1071 1038 case IDM_HELP: 1072 if (hwndHelp) {1073 if (INSTDATA(hwnd))1039 if (hwndHelp) { 1040 if (INSTDATA(hwnd)) 1074 1041 WinSendMsg(hwndHelp,HM_DISPLAY_HELP, 1075 1042 MPFROM2SHORT(HELP_SAVETOOLS,0), … … 1092 1059 1093 1060 strcpy(temptools,lasttoolbox); 1094 if (fToolsChanged)1061 if (fToolsChanged) 1095 1062 save_tools(NULL); 1096 1063 WinQueryDlgItemText(hwnd, … … 1098 1065 sizeof(lasttoolbox), 1099 1066 lasttoolbox); 1100 if (*lasttoolbox) {1101 if (!strchr(lasttoolbox,'.'))1067 if (*lasttoolbox) { 1068 if (!strchr(lasttoolbox,'.')) 1102 1069 strcat(lasttoolbox,".TLS"); 1103 1070 } 1104 if (saving && *lasttoolbox)1071 if (saving && *lasttoolbox) 1105 1072 save_tools(NULL); 1106 1073 else { 1107 if (!load_tools(NULL)) {1074 if (!load_tools(NULL)) { 1108 1075 strcpy(lasttoolbox,temptools); 1109 if (!load_tools(NULL)) {1076 if (!load_tools(NULL)) { 1110 1077 *lasttoolbox = 0; 1111 1078 load_tools(NULL);
Note:
See TracChangeset
for help on using the changeset viewer.