Changeset 1335 for trunk/dll/newview.c
- Timestamp:
- Dec 13, 2008, 12:49:02 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/newview.c
r1225 r1335 32 32 29 Feb 08 GKY Refactor global command line variables to notebook.h 33 33 20 Jul 08 GKY Change ListToClipboardHab call to match changes made to function 34 10 Dec 08 SHL Integrate exception handler support 34 35 35 36 ***********************************************************************/ … … 37 38 #include <stdlib.h> 38 39 #include <string.h> 39 #include <process.h> 40 // #include <process.h> // 10 Dec 08 SHL 40 41 #include <limits.h> 41 42 #include <share.h> … … 70 71 #include "newview.h" 71 72 #include "strips.h" // chop_at_crnl, convert_nl_to_nul 72 73 73 // remove_first_occurence_of_character 74 // strip_lead_char, strip_trail_char 74 75 #include "common.h" // CommonTextButton, CommonTextProc, DecrThreadUsage 75 76 // IncrThreadUsage 76 77 #include "systemf.h" // ExecOnList 77 78 #include "input.h" // InputDlgProc … … 86 87 #include "misc.h" // PaintRecessedWindow 87 88 #include "fortify.h" 89 #include "excputil.h" // xbeginthread 88 90 89 91 // Data definitions … … 226 228 pszCharCounter = pszSrc; 227 229 while (*pszCharCounter && *pszCharCounter != ' ' && *pszCharCounter != '\r' && 228 230 *pszCharCounter != '\n' && *pszCharCounter != '\"') 229 231 pszCharCounter++; 230 232 *pszCharCounter = 0; … … 288 290 MPFROM2SHORT(LIT_END, 0), MPFROMP(urld->url)); 289 291 p++; 290 292 } 291 293 } 292 294 while (p && *p && p < e); 293 295 p = urld->line; 294 296 if (mailstr(p, "@", e - p)) { 295 296 297 298 297 pp = mailstr(p, "@", e - p); 298 strcpy(urld->url, pp); 299 WinSendDlgItemMsg(hwnd, URL_LISTBOX, LM_INSERTITEM, 300 MPFROM2SHORT(LIT_END, 0), MPFROMP(urld->url)); 299 301 } 300 302 *urld->url = 0; … … 361 363 break; 362 364 } 363 364 365 } 366 else if (strchr(urld->url, '@')) { 365 367 WinDismissDlg(hwnd, 3); 366 368 break; 367 369 } 368 370 } 369 371 } … … 444 446 while (*e != '\r' && *e != '\n' && e < ad->text + ad->textsize) 445 447 e++; 446 447 448 449 448 /* fixme to be gone? 449 if((*e == '\r' || *e == '\n') && e > p) 450 e--; 451 */ 450 452 width = e - p; 451 453 } … … 830 832 GpiSetColor(hps, standardcolors[ad->colors[COLORS_HTTPFORE]]); 831 833 GpiSetBackColor(hps, standardcolors[ad->colors[COLORS_HTTPBACK]]); 832 833 834 834 } 835 836 if (ad->mailin && whichline != ad->cursored - 1 835 837 && (!ad->markedlines 836 838 || !(ad->markedlines[whichline] & (VF_SELECTED | VF_FOUND))) … … 894 896 GpiSetColor(hps, standardcolors[ad->colors[COLORS_HTTPFORE]]); 895 897 GpiSetBackColor(hps, standardcolors[ad->colors[COLORS_HTTPBACK]]); 896 897 898 898 } 899 900 if (ad->mailin && whichline != ad->cursored - 1 899 901 && (!ad->markedlines 900 902 || !(ad->markedlines[whichline] & (VF_SELECTED | VF_FOUND))) … … 1376 1378 ad->selected = 0; 1377 1379 } 1378 1379 1380 if ((*ftprun || fFtpRunWPSDefault) && !ad->ignoreftp && 1381 strstr(ad->text, "ftp://")) 1380 1382 ad->ftpin = TRUE; 1381 1382 1383 1384 1385 1383 if ((*httprun || fHttpRunWPSDefault) && !ad->ignorehttp && 1384 strstr(ad->text, "http://")) 1385 ad->httpin = TRUE; 1386 if (*mailrun && !ad->ignoremail && strstr(ad->text, "@")) 1387 ad->mailin = TRUE; 1386 1388 } 1387 1389 } … … 1500 1502 } 1501 1503 if (ad->textsize) { 1502 if (_beginthread 1503 (ReLineThread, NULL, 524288, (PVOID) hwnd) == -1) 1504 Runtime_Error(pszSrcFile, __LINE__, 1505 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 1506 else 1504 if (xbeginthread(ReLineThread, 1505 524288, 1506 (PVOID)hwnd, 1507 pszSrcFile, 1508 __LINE__) != -1) 1509 { 1507 1510 error = FALSE; 1511 } 1508 1512 } 1509 1513 } … … 1956 1960 WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc); 1957 1961 ad->hps = InitWindow(hwnd); 1958 if (_beginthread(LoadFileThread, NULL, 524288, (PVOID) hwnd) == -1) 1959 Runtime_Error(pszSrcFile, __LINE__, 1960 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 1961 else { 1962 if (xbeginthread(LoadFileThread, 1963 524288, 1964 (PVOID)hwnd, 1965 pszSrcFile, 1966 __LINE__) != -1) 1967 { 1962 1968 WinSendMsg(hwnd, UM_SETUP5, MPVOID, MPVOID); 1963 1969 DosSleep(16); //05 Aug 07 GKY 32 … … 2070 2076 ad->oldwidth = newwidth; 2071 2077 if (!ad->relining) { 2072 if (_beginthread(ReLineThread, NULL, 524288, (PVOID) hwnd) == -1) { 2073 Runtime_Error(pszSrcFile, __LINE__, 2074 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2078 if (xbeginthread(ReLineThread, 2079 524288, 2080 (PVOID)hwnd, 2081 pszSrcFile, 2082 __LINE__) == -1) 2083 { 2075 2084 DosReleaseMutexSem(ad->ScanSem); 2076 2085 WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT)); … … 2424 2433 width = e - p; 2425 2434 if (!width) 2426 2435 goto NoAdd; 2427 2436 2428 2437 if ((ad->httpin && (*httprun || fHttpRunWPSDefault) && 2429 2438 strnstr(ad->lines[whichline], "http://", width)) || 2430 2439 (ad->ftpin && (*ftprun || fFtpRunWPSDefault) && 2431 2432 2440 strnstr(ad->lines[whichline], "ftp://", width)) || 2441 (ad->mailin && *mailrun && mailstr(ad->lines[whichline], "@", width))) { 2433 2442 2434 2443 USHORT ret; … … 2444 2453 switch (ret) { 2445 2454 case 0: 2446 2455 free(urld); 2447 2456 goto NoAdd; 2448 2457 case 1: 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2458 if (*urld->url) { 2459 if (fHttpRunWPSDefault) { 2460 CHAR WPSDefaultHttpRun[CCHMAXPATH], WPSDefaultHttpRunDir[CCHMAXPATH]; 2461 2462 size = sizeof(WPSDefaultHttpRun); 2463 PrfQueryProfileData(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", 2464 "DefaultBrowserExe", WPSDefaultHttpRun, &size); 2465 size = sizeof(WPSDefaultHttpRunDir); 2466 PrfQueryProfileData(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", 2467 "DefaultWorkingDir", WPSDefaultHttpRunDir, &size); 2468 runemf2(SEPARATE | WINDOWED, 2469 hwnd, pszSrcFile, __LINE__, 2470 WPSDefaultHttpRunDir, 2471 fLibPathStrictHttpRun ? "SET LIBPATHSTRICT=TRUE" : NULL, 2472 "%s %s", WPSDefaultHttpRun, urld->url); 2473 } 2474 else 2475 runemf2(SEPARATE | WINDOWED, 2476 hwnd, pszSrcFile, __LINE__, 2477 httprundir, 2478 fLibPathStrictHttpRun ? "SET LIBPATHSTRICT=TRUE" : NULL, 2479 "%s %s", httprun, urld->url); 2480 } 2472 2481 free(urld); 2473 2482 goto NoAdd; 2474 2483 case 2: 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2484 if (*urld->url){ 2485 if (fFtpRunWPSDefault) { 2486 CHAR WPSDefaultFtpRun[CCHMAXPATH], WPSDefaultFtpRunDir[CCHMAXPATH]; 2487 2488 size = sizeof(WPSDefaultFtpRun); 2489 PrfQueryProfileData(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", 2490 "DefaultBrowserExe", WPSDefaultFtpRun, &size); 2491 size = sizeof(WPSDefaultFtpRunDir); 2492 PrfQueryProfileData(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", 2493 "DefaultWorkingDir", WPSDefaultFtpRunDir, &size); 2494 runemf2(SEPARATE | WINDOWED, 2495 hwnd, pszSrcFile, __LINE__, 2496 WPSDefaultFtpRunDir, 2497 fLibPathStrictFtpRun ? "SET LIBPATHSTRICT=TRUE" : NULL, 2498 "%s %s", WPSDefaultFtpRun, urld->url); 2499 } 2500 else 2501 runemf2(SEPARATE | WINDOWED, 2502 hwnd, pszSrcFile, __LINE__, 2503 ftprundir, 2504 fLibPathStrictFtpRun ? "SET LIBPATHSTRICT=TRUE" : NULL, 2505 "%s %s", ftprun, urld->url); 2506 } 2507 free(urld); 2499 2508 goto NoAdd; 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2509 case 3: 2510 if (*urld->url){ 2511 runemf2(SEPARATE | WINDOWED, 2512 hwnd, pszSrcFile, __LINE__, 2513 mailrundir, 2514 fLibPathStrictMailRun ? "SET LIBPATHSTRICT=TRUE" : NULL, 2515 "%s %s", mailrun, urld->url); 2516 } 2517 free(urld); 2518 goto NoAdd; 2510 2519 default: 2511 2520 break; 2512 2521 } 2513 2522 free(urld); 2514 2523 } 2515 2524 } 2516 2517 2525 } 2526 //Move line to selection box at top of viewer 2518 2527 numsels = (SHORT) WinSendDlgItemMsg(ad->hwndFrame, NEWVIEW_LISTBOX, 2519 2528 LM_QUERYITEMCOUNT, MPVOID, … … 2552 2561 2553 2562 width = ad->textsize - (whichline * 16); 2554 2555 2563 width = min(width, 16); //standard hexx line length 2564 //use 80 as width * 5 gives inconsistent format on short lines 2556 2565 s = xmalloc(80, pszSrcFile, __LINE__); 2557 2566 if (!s) … … 3324 3333 dummy[0] = ad->filename; 3325 3334 dummy[1] = NULL; 3326 3327 3335 ExecOnList(hwnd, editor, WINDOWED | SEPARATE, NULL, dummy, NULL, 3336 pszSrcFile, __LINE__); 3328 3337 } 3329 3338 else … … 3337 3346 ad->ftpin = FALSE; 3338 3347 if (ad->text && (*ftprun || fFtpRunWPSDefault) && 3339 3348 !ad->ignoreftp && strstr(ad->text, "ftp://")) 3340 3349 ad->ftpin = TRUE; 3341 3350 IgnoreFTP = ad->ignoreftp; … … 3544 3553 "Viewer.Searchtext", 3545 3554 (PVOID) ad->searchtext); 3546 if (_beginthread(SearchThread, NULL, 524288, (PVOID) hwnd) == 3547 -1) 3548 Runtime_Error(pszSrcFile, __LINE__, 3549 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 3555 xbeginthread(SearchThread, 3556 524288, 3557 (PVOID)hwnd, 3558 pszSrcFile, 3559 __LINE__); 3550 3560 } 3551 3561 } … … 3781 3791 if (!ad->busy) { 3782 3792 ad->cliptype = SHORT1FROMMP(mp1); 3783 if (_beginthread(ClipboardThread, NULL, 524288, (PVOID) hwnd) == 3784 -1) 3785 Runtime_Error(pszSrcFile, __LINE__, 3786 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 3793 xbeginthread(ClipboardThread, 3794 524288, 3795 (PVOID)hwnd, 3796 pszSrcFile, 3797 __LINE__); 3787 3798 } 3788 3799 DosReleaseMutexSem(ad->ScanSem); … … 4108 4119 size = sizeof(BOOL); 4109 4120 PrfQueryProfileData(fmprof, appname, "Viewer.IgnoreHTTP", 4110 4111 4121 (PVOID) & IgnoreHTTP, &size); 4122 size = sizeof(BOOL); 4112 4123 PrfQueryProfileData(fmprof, appname, "Viewer.IgnoreMail", 4113 4124 (PVOID) & IgnoreMail, &size);
Note:
See TracChangeset
for help on using the changeset viewer.