Changeset 906 for trunk/dll/notebook.c
- Timestamp:
- Jan 6, 2008, 5:21:14 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/notebook.c
r898 r906 198 198 PrfWriteProfileString(fmprof, appname, "DefArc", szDefArc); 199 199 { 200 CHAR szBuf[CCHMAXPATH], buf[10] = "\"%-/";200 CHAR szBuf[CCHMAXPATH], *psz; 201 201 202 202 WinQueryDlgItemText(hwnd, CFGA_VIRUS, CCHMAXPATH, szBuf); 203 203 szBuf[CCHMAXPATH - 1] = 0; 204 if (strcmp(szBuf, virus)){ 205 psz = CheckApp_QuoteAddExe(szBuf); 206 memcpy(virus, psz, strlen(psz) + 1); 207 if (!strchr(virus, '%') && strlen(virus) > 3) 208 strcat(virus, " %p"); 209 } 210 if (!*virus) 211 strcpy(virus, "OS2SCAN.EXE %p /SUB /A"); 212 WinQueryDlgItemText(hwnd, CFGA_EXTRACTPATH, CCHMAXPATH, szBuf); 213 szBuf[CCHMAXPATH - 1] = 0; 204 214 bstrip(szBuf); 205 if (!strcspn(szBuf, buf)) 206 BldQuotedFileName(virus, szBuf); 207 else 208 memcpy(virus, szBuf, strlen(szBuf) + 1); 209 if (!strchr(virus, '%') && strlen(virus) > 3) 210 strcat(virus, " %p"); 211 } 212 if (!*virus) 213 strcpy(virus, "OS2SCAN.EXE %p /SUB /A"); 214 WinQueryDlgItemText(hwnd, CFGA_EXTRACTPATH, CCHMAXPATH, extractpath); 215 extractpath[CCHMAXPATH - 1] = 0; 216 bstrip(extractpath); 217 if (*extractpath) { 218 if (strcmp(extractpath, "*")) { 219 220 MakeFullName(extractpath); 221 if (IsFile(extractpath)) { 222 ulResult = saymsg(MB_YESNOCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1, HWND_DESKTOP, 223 GetPString(IDS_WARNINGTEXT), 224 GetPString(IDS_EXTPATHNOTVALIDTEXT), 225 extractpath); 226 if (ulResult == MBID_YES) 227 *extractpath = 0; 228 if (ulResult == MBID_CANCEL){ 229 WinDlgBox(HWND_DESKTOP, 230 hwnd, CfgDlgProc, 231 FM3ModHandle, CFG_FRAME, 232 (PVOID) "Archive"); 233 break; 215 216 if (strcmp(extractpath, szBuf)) { 217 memcpy(extractpath, szBuf, strlen(szBuf) + 1); 218 if (*extractpath){ 219 MakeFullName(extractpath); 220 if (IsFile(extractpath)) { 221 ulResult = saymsg(MB_YESNOCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1, HWND_DESKTOP, 222 GetPString(IDS_WARNINGTEXT), 223 GetPString(IDS_EXTPATHNOTVALIDTEXT), 224 extractpath); 225 if (ulResult == MBID_YES) 226 *extractpath = 0; 227 if (ulResult == MBID_CANCEL){ 228 WinDlgBox(HWND_DESKTOP, 229 hwnd, CfgDlgProc, 230 FM3ModHandle, CFG_FRAME, 231 MPFROMP("Archive")); 232 break; 233 } 234 234 } 235 235 } 236 236 } 237 237 } … … 239 239 PrfWriteProfileString(fmprof, appname, "ExtractPath", extractpath); 240 240 break; 241 } 242 if (fCancelAction){ 243 fCancelAction = FALSE; 244 WinDlgBox(HWND_DESKTOP, 245 hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMP("Archive")); 241 246 } 242 247 return WinDefDlgProc(hwnd, msg, mp1, mp2); … … 450 455 case WM_CLOSE: 451 456 { 452 CHAR szBuf[CCHMAXPATH], buf[10] = "\"%-/";457 CHAR szBuf[CCHMAXPATH], *psz; 453 458 454 459 WinQueryDlgItemText(hwnd, CFGV_VIEWER, CCHMAXPATH, szBuf); 455 460 szBuf[CCHMAXPATH - 1] = 0; 456 bstrip(szBuf); 457 if (!strcspn(szBuf, buf)) 458 BldQuotedFileName(viewer, szBuf); 459 else 460 memcpy(viewer, szBuf, strlen(szBuf) + 1); 461 if (!strchr(viewer, '%') && strlen(viewer) > 3) 462 strcat(viewer, " %a"); 461 if (strcmp(szBuf, viewer)){ 462 psz = CheckApp_QuoteAddExe(szBuf); 463 memcpy(viewer, psz, strlen(psz) + 1); 464 if (!strchr(viewer, '%') && strlen(viewer) > 3) 465 strcat(viewer, " %a"); 466 } 463 467 WinQueryDlgItemText(hwnd, CFGV_EDITOR, CCHMAXPATH, szBuf); 464 468 szBuf[CCHMAXPATH - 1] = 0; 465 bstrip(szBuf); 466 if (!strcspn(szBuf, buf)) 467 BldQuotedFileName(editor, szBuf); 468 else 469 memcpy(editor, szBuf, strlen(szBuf) + 1); 470 if (!strchr(editor, '%') && strlen(editor) > 3) 471 strcat(editor, " %a"); 469 if (strcmp(szBuf, editor)){ 470 psz = CheckApp_QuoteAddExe(szBuf); 471 memcpy(editor, psz, strlen(psz) + 1); 472 if (!strchr(editor, '%') && strlen(editor) > 3) 473 strcat(editor, " %a"); 474 } 472 475 WinQueryDlgItemText(hwnd, CFGV_BINVIEW, CCHMAXPATH, szBuf); 473 476 szBuf[CCHMAXPATH - 1] = 0; 474 bstrip(szBuf); 475 if (!strcspn(szBuf, buf)) 476 BldQuotedFileName(binview, szBuf); 477 else 478 memcpy(binview, szBuf, strlen(szBuf) + 1); 479 if (!strchr(binview, '%') && strlen(binview) > 3) 480 strcat(binview, " %a"); 477 if (strcmp(szBuf, binview)){ 478 psz = CheckApp_QuoteAddExe(szBuf); 479 memcpy(binview, psz, strlen(psz) + 1); 480 if (!strchr(binview, '%') && strlen(binview) > 3) 481 strcat(binview, " %a"); 482 } 481 483 WinQueryDlgItemText(hwnd, CFGV_BINED, CCHMAXPATH, szBuf); 482 484 szBuf[CCHMAXPATH - 1] = 0; 483 bstrip(szBuf); 484 if (!strcspn(szBuf, buf)) 485 BldQuotedFileName(bined, szBuf); 486 else 487 memcpy(bined, szBuf, strlen(szBuf) + 1); 488 if (!strchr(bined, '%') && strlen(bined) > 3) 489 strcat(bined, " %a"); 490 else 491 memcpy(bined, szBuf, strlen(szBuf) + 1); 485 if (strcmp(szBuf, bined)){ 486 psz = CheckApp_QuoteAddExe(szBuf); 487 memcpy(bined, psz, strlen(psz) + 1); 488 if (!strchr(bined, '%') && strlen(bined) > 3) 489 strcat(bined, " %a"); 490 } 492 491 PrfWriteProfileString(fmprof, appname, "Viewer", viewer); 493 492 PrfWriteProfileString(fmprof, appname, "Editor", editor); … … 508 507 break; 509 508 } 509 } 510 if (fCancelAction){ 511 fCancelAction = FALSE; 512 WinDlgBox(HWND_DESKTOP, 513 hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMP("Viewer1")); 510 514 } 511 515 return WinDefDlgProc(hwnd, msg, mp1, mp2); … … 637 641 638 642 case WM_CLOSE: 639 { 640 CHAR szBuf[CCHMAXPATH], buf[10] = "\"%-/"; 643 { // fixme these strings can be longer than CCHMAXPATH since 644 // they contain args. 645 CHAR szBuf[CCHMAXPATH], *psz; 641 646 642 647 WinQueryDlgItemText(hwnd, CFGH_RUNHTTPWORKDIR, CCHMAXPATH, szBuf); 643 648 szBuf[CCHMAXPATH - 1] = 0; 644 649 bstrip(szBuf); 645 if (!strcspn(szBuf, buf)) 646 BldQuotedFileName(httprundir, szBuf); 647 else 648 memcpy(httprundir, szBuf, strlen(szBuf) + 1); 650 memcpy(httprundir, szBuf, strlen(szBuf) + 1); 649 651 WinQueryDlgItemText(hwnd, CFGH_RUNFTPWORKDIR, CCHMAXPATH, szBuf); 650 652 szBuf[CCHMAXPATH - 1] = 0; 651 653 bstrip(szBuf); 652 if (!strcspn(szBuf, buf)) 653 BldQuotedFileName(ftprundir, szBuf); 654 else 655 memcpy(ftprundir, szBuf, strlen(szBuf) + 1); 654 memcpy(ftprundir, szBuf, strlen(szBuf) + 1); 656 655 WinQueryDlgItemText(hwnd, CFGH_RUNMAILWORKDIR, CCHMAXPATH, szBuf); 657 656 szBuf[CCHMAXPATH - 1] = 0; 658 657 bstrip(szBuf); 659 if (!strcspn(szBuf, buf)) 660 BldQuotedFileName(mailrundir, szBuf); 661 else 662 memcpy(mailrundir, szBuf, strlen(szBuf) + 1); 658 memcpy(mailrundir, szBuf, strlen(szBuf) + 1); 663 659 WinQueryDlgItemText(hwnd, CFGH_FTPRUN, CCHMAXPATH, szBuf); 664 660 szBuf[CCHMAXPATH - 1] = 0; 665 bstrip(szBuf); 666 if (!strchr(szBuf, '"')) 667 BldQuotedFileName(ftprun, szBuf); 668 else 669 memcpy(ftprun, szBuf, strlen(szBuf) + 1); 661 if (strcmp(szBuf, ftprun)){ 662 psz = CheckApp_QuoteAddExe(szBuf); 663 memcpy(ftprun, psz, strlen(psz) + 1); 664 } 670 665 WinQueryDlgItemText(hwnd, CFGH_HTTPRUN, CCHMAXPATH, szBuf); 671 666 szBuf[CCHMAXPATH - 1] = 0; 672 bstrip(szBuf); 673 if (!strchr(szBuf, '"')) 674 BldQuotedFileName(httprun, szBuf); 675 else 676 memcpy(httprun, szBuf, strlen(szBuf) + 1); 667 if (strcmp(szBuf, httprun)){ 668 psz = CheckApp_QuoteAddExe(szBuf); 669 memcpy(httprun, psz, strlen(psz) + 1); 670 } 677 671 WinQueryDlgItemText(hwnd, CFGH_MAILRUN, CCHMAXPATH, szBuf); 678 672 szBuf[CCHMAXPATH - 1] = 0; 679 bstrip(szBuf); 680 if (!strcspn(szBuf, buf)) 681 BldQuotedFileName(mailrun, szBuf); 682 else 683 memcpy(mailrun, szBuf, strlen(szBuf) + 1); 673 if (strcmp(szBuf, mailrun)){ 674 psz = CheckApp_QuoteAddExe(szBuf); 675 memcpy(mailrun, psz, strlen(psz) + 1); 676 } 684 677 PrfWriteProfileString(fmprof, appname, "HttpRunDir", httprundir); 685 678 PrfWriteProfileString(fmprof, appname, "FtpRunDir", ftprundir); … … 708 701 break; 709 702 } 703 } 704 if (fCancelAction){ 705 fCancelAction = FALSE; 706 WinDlgBox(HWND_DESKTOP, 707 hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMP("Viewer2")); 710 708 } 711 709 return WinDefDlgProc(hwnd, msg, mp1, mp2); … … 1249 1247 case WM_CLOSE: 1250 1248 { 1251 CHAR szBuf[CCHMAXPATH], buf[10] = "\"%-/";1249 CHAR szBuf[CCHMAXPATH], *psz; 1252 1250 1253 1251 WinQueryDlgItemText(hwnd, CFGC_DIRCOMPARE, CCHMAXPATH, szBuf); 1254 1252 szBuf[CCHMAXPATH - 1] = 0; 1255 bstrip(szBuf); 1256 if (!strcspn(szBuf, buf)) 1257 BldQuotedFileName(dircompare, szBuf); 1258 else 1259 memcpy(dircompare, szBuf, strlen(szBuf) + 1); 1260 if (!strchr(dircompare, '%') && strlen(dircompare) > 3) 1261 strcat(dircompare, " %a"); 1253 if (strcmp(szBuf, dircompare)){ 1254 psz = CheckApp_QuoteAddExe(szBuf); 1255 memcpy(dircompare, psz, strlen(psz) + 1); 1256 if (!strchr(dircompare, '%') && strlen(dircompare) > 3) 1257 strcat(dircompare, " %a"); 1258 } 1262 1259 PrfWriteProfileString(fmprof, appname, "DirCompare", dircompare); 1263 1260 WinQueryDlgItemText(hwnd, CFGC_COMPARE, CCHMAXPATH, szBuf); 1264 1261 szBuf[CCHMAXPATH - 1] = 0; 1265 bstrip(szBuf); 1266 if (!strcspn(szBuf, buf)) 1267 BldQuotedFileName(compare, szBuf); 1268 else 1269 memcpy(compare, szBuf, strlen(szBuf) + 1); 1270 if (!strchr(compare, '%') && strlen(compare) > 3) 1271 strcat(compare, " %a"); 1262 if (strcmp(szBuf, compare)){ 1263 psz = CheckApp_QuoteAddExe(szBuf); 1264 memcpy(compare, psz, strlen(psz) + 1); 1265 if (!strchr(compare, '%') && strlen(compare) > 3) 1266 strcat(compare, " %a"); 1267 } 1272 1268 PrfWriteProfileString(fmprof, appname, "Compare", compare); 1273 1269 break; 1274 1270 } 1271 } 1272 if (fCancelAction){ 1273 fCancelAction = FALSE; 1274 WinDlgBox(HWND_DESKTOP, 1275 hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMP("Compare")); 1275 1276 } 1276 1277 return WinDefDlgProc(hwnd, msg, mp1, mp2); … … 3111 3112 } 3112 3113 } 3114 if (mp2 && !strcmp((CHAR *) mp2, "Viewer2")) 3115 PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK), 3116 BKM_TURNTOPAGE, MPFROMLONG(np[9].pageID), MPVOID); 3117 else if (mp2 && !strcmp((CHAR *) mp2, "Viewer1")) 3118 PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK), 3119 BKM_TURNTOPAGE, MPFROMLONG(np[8].pageID), MPVOID); 3120 else if (mp2 && !strcmp((CHAR *) mp2, "Compare")) 3121 PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK), 3122 BKM_TURNTOPAGE, MPFROMLONG(np[10].pageID), MPVOID); 3123 else if (mp2 && !strcmp((CHAR *) mp2, "Archive")) 3124 PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK), 3125 BKM_TURNTOPAGE, MPFROMLONG(np[5].pageID), MPVOID); 3126 else if (mp2 && !strcmp((CHAR *) mp2, "Tree")) 3127 PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK), 3128 BKM_TURNTOPAGE, MPFROMLONG(np[6].pageID), MPVOID); 3129 else if (mp2 && !strcmp((CHAR *) mp2, "Collector")) 3130 PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK), 3131 BKM_TURNTOPAGE, MPFROMLONG(np[3].pageID), MPVOID); 3113 3132 /* see if we've been asked to display quick cfg page */ 3114 if (!mp2 || 3115 strcmp((CHAR *) mp2, "First Time") || 3116 !x || !np[x - 1].hwnd || !np[x - 1].pageID) { 3117 PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK), 3118 BKM_TURNTOPAGE, MPFROMLONG(np[0].pageID), MPVOID); 3119 } 3133 else if (!mp2 || strcmp((CHAR *) mp2, "First Time") || 3134 !x || !np[x - 1].hwnd || !np[x - 1].pageID) 3135 PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK), 3136 BKM_TURNTOPAGE, MPFROMLONG(np[0].pageID), MPVOID); 3120 3137 else { 3121 3138 PostMsg(MainObjectHwnd, UM_SETDIR, MPFROMLONG(1L), MPVOID); 3122 3139 PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK), 3123 3140 BKM_TURNTOPAGE, MPFROMLONG(np[x - 1].pageID), MPVOID); 3124 3141 PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(np[x - 1].hwnd), MPVOID); 3125 3142 PostMsg(np[x - 1].hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HELP, 0), MPVOID); 3126 3143 } 3127 break; 3144 3145 break; 3128 3146 3129 3147 case UM_FOCUSME:
Note:
See TracChangeset
for help on using the changeset viewer.