~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Frontier Kernel
Frontier/Common/source/about.c

Version: ~ [ 10.0 ] ~

** Warning: Cannot open xref database.

1 2 /* $Id: about.c,v 1.6 2005/01/12 11:34:26 andreradke Exp $ */ 3 4 /****************************************************************************** 5 6 UserLand Frontier(tm) -- High performance Web content management, 7 object database, system-level and Internet scripting environment, 8 including source code editing and debugging. 9 10 Copyright (C) 1992-2004 UserLand Software, Inc. 11 12 This program is free software; you can redistribute it and/or modify 13 it under the terms of the GNU General Public License as published by 14 the Free Software Foundation; either version 2 of the License, or 15 (at your option) any later version. 16 17 This program is distributed in the hope that it will be useful, 18 but WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 GNU General Public License for more details. 21 22 You should have received a copy of the GNU General Public License 23 along with this program; if not, write to the Free Software 24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 26 ******************************************************************************/ 27 28 /* 29 about.c -- a generic "about" box for any Macintosh program written in Lightspeed C. 30 31 Make sure you have a STR# resource number 128, with exactly six strings in it. 32 33 Not too big, kind of sexy, and certainly better than nothing! 34 */ 35 36 #include "frontier.h" 37 #include "standard.h" 38 39 #include "versions.h" /*9.1b3 JES*/ 40 #include "quickdraw.h" 41 #include "strings.h" 42 #include "bitmaps.h" 43 #include "cursor.h" 44 #include "dialogs.h" 45 #include "icon.h" 46 #include "file.h" 47 #include "font.h" 48 #include "kb.h" 49 #include "memory.h" 50 #include "mouse.h" 51 #include "ops.h" 52 #include "popup.h" 53 #include "resources.h" 54 #include "scrollbar.h" 55 #include "smallicon.h" 56 #include "textedit.h" 57 #include "frontierwindows.h" 58 #include "windowlayout.h" 59 #include "zoom.h" 60 #include "shell.h" 61 #include "shellprivate.h" 62 #include "shellhooks.h" 63 #include "about.h" 64 #include "tablestructure.h" 65 #include "cancoon.h" 66 #include "cancooninternal.h" 67 #include "process.h" 68 #include "processinternal.h" 69 #include "launch.h" 70 71 #ifdef WIN95VERSION 72 #include "Winland.h" 73 #define idfrontiericon IDB_FRONTIER_BITMAP 74 #endif 75 76 #ifdef MACVERSION 77 #define idfrontiericon 128 78 #endif 79 80 81 82 static long aboutopenticks; /*so we can tell how long it's been up*/ 83 84 85 typedef struct tyaboutrecord { 86 87 Rect messagearea; 88 89 Rect aboutarea; 90 91 boolean flbootsplash; 92 93 boolean flbigwindow; 94 95 boolean flextrastats; 96 97 long refcon; 98 } tyaboutrecord, *ptraboutrecord, **hdlaboutrecord; 99 100 101 static hdlaboutrecord aboutdata = nil; 102 103 static WindowPtr aboutwindow = nil; 104 105 static hdlwindowinfo aboutwindowinfo; 106 107 static boolean flsessionstats = false; 108 109 110 static hdlaboutrecord displayedaboutdata = nil; 111 112 static CGrafPtr aboutport = nil; 113 114 static boolean flhavemiscrect = false; 115 116 static Rect miscinforect; 117 118 119 static bigstring bstheadinfo = ""; 120 121 static bigstring bsmiscinfo = ""; 122 123 124 #define agentpopupwidth (popuparrowwidth + 4) 125 126 #define msgtopinset 3 127 128 #define msgbottominset 3 129 130 #define minmsgheight (heightsmallicon + 4) 131 132 #define msgborderpix 5 133 134 #define msgvertgap 4 135 136 #define aboutlineheight 14 137 138 #define aboutlinewidth 250 /*2005-01-12 aradke*/ 139 140 #define aboutvertstart 0 141 142 #define aboutvertinset 6 143 144 #define aboutvertgap 0 145 146 #define abouthorizgap 20 147 148 #define abouthorizinset 12 149 150 #define aboutrowsStats 8 151 152 #define aboutrectheightStats (aboutvertinset * 2 + aboutvertstart + aboutrowsStats * aboutlineheight + aboutvertgap) 153 154 #define aboutrowsNoStats 3 155 156 #define aboutrectheightNoStats (aboutvertinset * 2 + aboutvertstart + aboutrowsNoStats * aboutlineheight + aboutvertgap) 157 158 #define abouticonsize 32 159 160 #define versionwidth 56 161 162 #define minaboutwidth (aboutlinewidth + abouthorizgap + 2 * abouthorizinset + 4 * abouticonsize) /*2005-01-12 aradke*/ 163 164 #define agentmenuhorizgap 10 165 166 static byte * aboutstrings [] = { 167 168 //#ifdef PIKE 169 // "\x2b" "The power of Web publishing on your desktop", /*7.0b1 PBS*/ 170 //#else 171 // "\x2e" "Powerful cross-platform web content management", /*6.1 AR*/ 172 //#endif 173 174 "\x25" "Powerful cross-platform web scripting", /*2005-01-12 aradke: re-enabled*/ 175 176 "\x23" "© 1992-" copyright_year_string " UserLand Software, Inc.", 177 178 #ifdef PIKE 179 "\x26" "http://frontierkernel.sourceforge.net/", /*2005-01-12 aradke*/ 180 #else 181 "\x26" "http://frontierkernel.sourceforge.net/", /*2005-01-12 aradke*/ 182 #endif 183 184 "\x02" "^0", 185 186 "\x12" "Scripts Running: ", 187 188 "\x11" "Current Thread: ", 189 190 #ifdef MACVERSION 191 "\x13" "Available Memory: ", 192 #endif 193 #ifdef WIN95VERSION 194 "\x14" "Handles Allocated: ", 195 #endif 196 197 "", 198 199 "\x10" "Visible Agent: ", 200 201 "\x0f" "Current Time: ", 202 203 #ifdef PIKE 204 "\x05" "Radio", /*2005-01-12 aradke*/ 205 206 "\x0b" "About Radio", /*2005-01-12 aradke*/ 207 #else 208 "\x08" "Frontier", /*2005-01-12 aradke*/ 209 210 "\x0e" "About Frontier", 211 #endif 212 213 "\x02" "^0", 214 }; 215 216 217 enum { /*main window items*/ 218 219 sloganitem, 220 221 copyrightitem, 222 223 urlitem, 224 225 isaitem, 226 227 threadsitem, 228 229 thisthreaditem, 230 231 memoryitem, 232 233 miscinfoitem, 234 235 agentpopupitem, 236 237 datetimeitem, 238 239 frontieritem, 240 241 titleitem, 242 243 versionitem 244 }; 245 246 247 void aboutsegment (void) { 248 249 } /*aboutsegment*/ 250 251 252 static boolean findaboutwindow (hdlwindowinfo *hinfo) { 253 254 WindowPtr w; 255 Handle hdata; 256 257 return (shellfindwindow (idaboutconfig, &w, hinfo, &hdata)); 258 } /*findaboutwindow*/ 259 260 261 boolean aboutstatsshowing (void) { 262 263 return (displayedaboutdata && (**displayedaboutdata).flbigwindow && (**displayedaboutdata).flextrastats); 264 } /*aboutstatsshowing*/ 265 266 267 static long aboutrectheight () { 268 if (aboutstatsshowing()) 269 return (aboutrectheightStats); 270 271 return(aboutrectheightNoStats); 272 } /*aboutrectheight*/ 273 274 275 static void getmessagecontentrect (Rect *rcontent) { 276 277 if (aboutdata == nil) 278 zerorect (rcontent); 279 else 280 *rcontent = (**aboutdata).messagearea; 281 } /*getmessagecontentrect*/ 282 283 284 static void ccdrawfrontiericon (Rect rcicn, boolean flpressed) { 285 286 #if TARGET_API_MAC_CARBON == 1 /*PBS 7.0b53: draw an OS X style icon*/ 287 288 IconRef iconref; 289 tyfilespec programfspec; 290 short label; 291 OSErr ec; 292 Rect r = rcicn; 293 294 getapplicationfilespec (nil, &programfspec); 295 296 if (GetIconRefFromFile (&programfspec, &iconref, &label) == noErr) { 297 298 ec = PlotIconRef (&r, atVerticalCenter + atHorizontalCenter, flpressed? kTransformSelected : 0, kIconServicesNormalUsageFlag, iconref); 299 300 ReleaseIconRef (iconref); 301 } /*if*/ 302 303 if (ec == noErr) 304 return; 305 #endif 306 307 ploticonresource (&rcicn, atVerticalCenter + atHorizontalCenter, flpressed? kTransformSelected : 0, idfrontiericon); 308 309 } /*ccdrawfrontiericon*/ 310 311 312 static boolean ccgettextitemrect (short item, Rect *r) { 313 314 short linewidth = aboutlinewidth; 315 316 if (item == versionitem) { 317 318 *r = (**aboutwindowinfo).contentrect; 319 320 // insetrect (r, msgborderpix, msgborderpix); 321 322 (*r).right -= msgborderpix + getscrollbarwidth (); // leave room for grow icon 323 324 (*r).top = (*r).bottom - aboutlineheight; 325 326 return (true); 327 } 328 329 *r = (**aboutdata).aboutarea; 330 331 linewidth = min (linewidth, ((*r).right - (*r).left - abouthorizgap) / 2); 332 333 (*r).top += aboutvertstart + item * aboutlineheight; 334 335 /*if (false && item > urlitem) { 336 337 if (odd (item)) 338 (*r).left = (*r).right - aboutlinewidth; 339 340 else 341 (*r).right = (*r).left + aboutlinewidth; 342 } 343 else 344 */ 345 if (item != miscinfoitem) 346 (*r).left += 4 * abouticonsize + abouthorizinset; 347 348 if ((*r).top > abouticonsize) 349 (*r).top += aboutvertgap; 350 351 (*r).bottom = (*r).top + aboutlineheight - 1; 352 353 return ((*r).bottom <= (**aboutdata).aboutarea.bottom); 354 } /*ccgettextitemrect*/ 355 356 357 static boolean ccgetagentpopuprect (Rect *rpopup) { 358 359 Rect r = (**aboutdata).messagearea; 360 361 r.left += msgborderpix; 362 363 r.right = r.left + widthsmallicon; 364 365 // r.top += msgborderpix + msgtopinset; 366 r.top = (r.bottom + r.top - heightsmallicon) / 2; 367 368 r.bottom = r.top + heightsmallicon; 369 370 *rpopup = r; 371 372 return (true); 373 } /*ccgetagentpopuprect*/ 374 375 376 static void ccdrawmainwindowtext (short item, short style, ptrstring bs, short just) { 377 378 Rect r; 379 bigstring bsitem; 380 381 if (!ccgettextitemrect (item, &r)) 382 return; 383 384 if (bs == nil) { /*get from string list*/ 385 386 copystring (aboutstrings [item], bsitem); 387 388 bs = bsitem; 389 } 390 391 setglobalfontsizestyle (geneva, 9, style); 392 393 switch (just) { 394 395 case leftjustified: 396 eraserect (r); 397 398 movepento (r.left, r.top + globalfontinfo.ascent); 399 400 break; 401 402 case rightjustified: 403 movepento (r.right - stringpixels (bs), r.top + globalfontinfo.ascent); 404 405 break; 406 407 case fulljustified: 408 break; 409 } 410 411 pendrawstring (bs); 412 } /*ccdrawmainwindowtext*/ 413 414 415 static void pushaboutstyle (void) { 416 417 register hdlwindowinfo hw = aboutwindowinfo; 418 419 if ((**aboutdata).flbigwindow) 420 pushstyle (geneva, 9, normal); 421 else 422 pushstyle ((**hw).defaultfont, (**hw).defaultsize, (**hw).defaultstyle); 423 } /*pushaboutstyle*/ 424 425 426 static short ccgetneededheight (boolean flbigwindow) { 427 428 register short x; 429 430 if ((**aboutdata).flbootsplash) 431 x = 0; 432 433 else { 434 435 pushaboutstyle (); 436 437 x = globalfontinfo.ascent + globalfontinfo.descent; 438 439 popstyle (); 440 441 x = max (x, minmsgheight); 442 443 x += msgtopinset + msgbottominset; 444 } 445 446 if (flbigwindow) 447 x += 2 * msgborderpix + aboutrectheight() + msgvertgap; 448 449 return (x); 450 } /*ccgetneededheight*/ 451 452 453 #if 0 454 455 static boolean ccfindagentvisit (bigstring bsname, hdlhashnode hnode, tyvaluerecord val, ptrvoid refcon) { 456 457 hdltreenode hcode; 458 459 if (!langexternalvaltocode (val, &hcode)) /*not a scipt, or no code*/ 460 return (false); 461 462 if (hcode == (**cancoonglobals).hprimaryagent) 463 return (true); 464 465 return (false); 466 } /*ccfindagentvisit*/ 467 468 #endif 469 470 471 static void ccdrawagentpopup (void) { 472 473 Rect r; 474 475 if (ccgetagentpopuprect (&r)) { 476 477 if (cancoonglobals == nil) 478 eraserect (r); 479 else { 480 ccupdateagentpopup (r); 481 /* 482 Point pt; 483 bigstring bs; 484 485 ccdrawmainwindowtext (agentpopupitem, bold, nil, leftjustified); 486 487 getpenpoint (&pt); 488 489 r.left = pt.h + agentmenuhorizgap; 490 491 r.bottom = r.top + popupheight; 492 493 if (!hashinversesearch (agentstable, &ccfindagentvisit, nil, bs)) 494 setemptystring (bs); 495 496 insertstring ("\x03 ", bs); 497 498 drawpopup (r, bs, true); 499 */ 500 } 501 } 502 } /*ccdrawagentpopup*/ 503 504 505 #if 0 506 507 static void cceraseagentpopup (void) { 508 509 Rect r; 510 511 if (ccgetagentpopuprect (&r)) 512 eraserect (r); 513 } /*cceraseagentpopup*/ 514 515 #endif 516 517 518 static void ccgetmsgrect (Rect *rmsg) { 519 520 /* 521 5.0.2b19 dmb: leave correct room for version string 522 */ 523 524 Rect r; 525 short lineheight = globalfontinfo.ascent + globalfontinfo.descent; 526 527 getmessagecontentrect (rmsg); 528 529 // if ((**aboutdata).flbigwindow) 530 // insetrect (rmsg, 6, 6); 531 532 ccgetagentpopuprect (&r); 533 534 // (*rmsg).top = r.top + 1; 535 536 // (*rmsg).bottom = (*rmsg).top + globalfontinfo.ascent + globalfontinfo.descent; 537 538 (*rmsg).top = ((*rmsg).bottom + (*rmsg).top - lineheight) / 2; 539 540 (*rmsg).bottom = (*rmsg).top + lineheight; 541 542 (*rmsg).left = r.right + 8; 543 544 if (ccgettextitemrect (versionitem, &r) && (*rmsg).bottom > r.top) // overlap 545 (*rmsg).right -= versionwidth; // leave root for version 546 } /*ccgetmsgrect*/ 547 548 549 static boolean ccdrawmsg (void) { 550 551 /* 552 2.1b5 dmb: don't need flbitmapactive logic; openbitmap will return 553 false if one's already open. 554 */ 555 556 register hdlcancoonrecord hc = cancoonglobals; 557 //register hdlwindowinfo hw = aboutwindowinfo; 558 register hdlstring hstring; 559 register boolean flbitmap = false; 560 bigstring bs; 561 Rect r; 562 563 if (hc == nil || aboutdata == nil) 564 return (false); 565 566 pushaboutstyle (); 567 568 ccgetmsgrect (&r); 569 570 flbitmap = openbitmap (r, aboutwindow); 571 572 if (!flbitmap) 573 pushclip (r); 574 575 eraserect (r); 576 577 /* 578 grayframerect (r); 579 */ 580 581 hstring = (**hc).hprimarymsg; 582 583 /* 584 if (hstring == nil) /%no primary message, display file name%/ 585 hstring = (**hw).hfilename; 586 */ 587 588 copyheapstring (hstring, bs); 589 590 // centerstring (r, bs); 591 592 movepento (r.left, r.top + globalfontinfo.ascent); 593 594 pendrawstring (bs); 595 596 popstyle (); 597 598 if (flbitmap) 599 closebitmap (aboutwindow); 600 else 601 popclip (); 602 603 return (true); 604 } /*ccdrawmsg*/ 605 606 607 static void ccdrawtextitem (short item, ptrstring param, short style, short just) { 608 609 bigstring bsitem; 610 611 parsedialogstring (aboutstrings [item], param, nil, nil, nil, bsitem); 612 613 ccdrawmainwindowtext (item, style, bsitem, just); 614 } /*ccdrawtextitem*/ 615 616 617 static boolean ccrunurlscript () { 618 619 bigstring bsscript; 620 621 if (!getsystemtablescript (idopenurlscript, bsscript)) 622 return (false); 623 624 parsedialogstring (bsscript, aboutstrings [urlitem], nil, nil, nil, bsscript); 625 626 return (processrunstring (bsscript)); 627 } /*ccrunurlscript*/ 628 629 630 static void ccdrawurlitem (boolean flpressed) { 631 632 RGBColor rgb = {0, 0, 0}; 633 634 if (flpressed) 635 rgb.red = 0xA000; 636 else 637 rgb.blue = 0xA000; 638 639 pushforecolor (&rgb); 640 641 ccdrawtextitem (urlitem, nil, underline, leftjustified); 642 // ccdrawmainwindowtext (urlitem, underline, nil, leftjustified); 643 644 popforecolor (); 645 } /*ccdrawurlitem*/ 646 647 648 static void ccdrawstatistic (short item, ptrstring value, boolean flbitmap) { 649 650 Rect r; 651 652 if (flbitmap) { 653 654 if (!ccgettextitemrect (item, &r)) 655 return; 656 657 flbitmap = openbitmap (r, aboutwindow); 658 } 659 660 ccdrawmainwindowtext (item, bold, nil, leftjustified); 661 662 ccdrawmainwindowtext (item, normal, value, rightjustified); 663 664 if (flbitmap) 665 closebitmap (aboutwindow); 666 } /*ccdrawstatistic*/ 667 668 669 static void ccupdatestatistics (boolean flbitmap) { 670 671 /* 672 1/20/93 dmb: if fldisableyield is set, we got here in strange circumstances. 673 most likely, it indicates that a script running as a component or fast script 674 put up a dialog. to avoid a system crash, we must not call langrunstringnoerror. 675 */ 676 677 bigstring bs; 678 short threadcount; 679 680 // timedatestring (timenow (), bs); 681 // ccdrawstatistic (datetimeitem, bs, flbitmap); 682 683 if (aboutstatsshowing ()) { 684 685 #ifdef WIN95VERSION 686 extern long handlecounter; 687 688 numbertostring (handlecounter, bs); 689 690 #endif 691 692 #ifdef MACVERSION 693 long freemem = FreeMem () / 1024; 694 695 numbertostring (freemem, bs); 696 697 pushchar ('K', bs); 698 #endif 699 700 ccdrawstatistic (memoryitem, bs, flbitmap); 701 702 threadcount = processthreadcount (); 703 704 numbertostring (threadcount, bs); 705 706 ccdrawstatistic (threadsitem, bs, flbitmap); 707 708 ccdrawstatistic (thisthreaditem, bstheadinfo, flbitmap); 709 710 ccdrawmainwindowtext (miscinfoitem, normal, bsmiscinfo, leftjustified); 711 } 712 713 /* 714 if ((roottable != nil) && (!fldisableyield)) { 715 716 if (langrunstringnoerror ("\puser.name", bs)) { 717 718 ccdrawstatistic (usernameitem, bs, flbitmap); 719 } 720 } 721 */ 722 } /*ccupdatestatistics*/ 723 724 725 static void ccdrawabout (void) { 726 727 /* 728 5.0b9 dmb: user Arial, but just for the frontier(tm) item 729 */ 730 731 Rect rabout = (**aboutdata).aboutarea; 732 bigstring bs; 733 734 /*draw the icon*/ { 735 736 #ifdef WIN95VERSION 737 short tmfont; 738 739 fontgetnumber ("\x05" "Arial", &tmfont); 740 741 if (tmfont != 0) 742 setglobalfontsizestyle (tmfont, 9, bold); 743 else 744 #endif 745 746 setglobalfontsizestyle (geneva, 9, bold); 747 748 rabout.left += abouticonsize; /*2005-01-12 aradke: shorter frontieritem, indent it too*/ 749 750 movepento (rabout.left, rabout.top + abouticonsize + globalfontinfo.ascent); 751 752 pendrawstring (aboutstrings [frontieritem]); 753 754 #ifdef WIN95VERSION 755 if (tmfont != 0) 756 setglobalfontsizestyle (geneva, 9, bold); 757 #endif 758 759 760 //rabout.left += abouticonsize; /*2005-01-12 aradke*/ 761 762 rabout.right = rabout.left + abouticonsize; 763 764 rabout.bottom = rabout.top + abouticonsize; 765 766 ccdrawfrontiericon (rabout, false); 767 } 768 769 ccdrawtextitem (copyrightitem, nil, normal, leftjustified); 770 771 ccdrawurlitem (false); 772 773 #if __powerc 774 775 // ccdrawtextitem (isaitem, "\pPowerPC", normal); 776 parsedialogstring (aboutstrings [isaitem], "\x07" "PowerPC", nil, nil, nil, bs); 777 778 #else 779 780 parsedialogstring (aboutstrings [isaitem], "\x05" "680x0", nil, nil, nil, bs); 781 782 #endif 783 784 // ccdrawmainwindowtext (isaitem, normal, bs, leftjustified); 785 786 // ccdrawtextitem (frontieritem, nil, bold); 787 788 ccdrawtextitem (sloganitem, nil, italic, leftjustified); 789 790 filegetprogramversion (bs); 791 792 #ifdef fltrialsize 793 794 insertstring ("\x06" "Trial ", bs); 795 796 #endif 797 798 ccdrawmainwindowtext (versionitem, normal, bs, rightjustified); 799 800 ccupdatestatistics (false); 801 } /*ccdrawabout*/ 802 803 804 static void ccunblockmsg (void) { 805 806 /* 807 1/9/91 dmb: must set secondary message to nil when it's moved into 808 the primary message 809 */ 810 811 register hdlcancoonrecord hc = cancoonglobals; 812 register hdlstring hs; 813 814 if (hc && (**hc).flbackgroundmsgblocked) { 815 816 (**hc).flbackgroundmsgblocked = false; 817 818 hs = (**hc).hsecondarymsg; 819 820 if (hs != nil) { 821 822 disposehandle ((Handle) (**hc).hprimarymsg); 823 824 (**hc).hprimarymsg = hs; 825 826 (**hc).hsecondarymsg = nil; 827 828 ccdrawmsg (); 829 } 830 } 831 } /*ccunblockmsg*/ 832 833 834 boolean aboutsetthreadstring (hdlprocessthread hp, boolean flin) { 835 836 register hdlcancoonrecord hc = cancoonglobals; 837 hdlthreadglobals hg = (hdlthreadglobals) hp; 838 boolean fl = false; 839 hdlwindowinfo hinfo; 840 841 if (hc == nil) 842 return (false); 843 844 if (!aboutstatsshowing ()) 845 return (false); 846 847 if (!findaboutwindow (&hinfo) || !shellpushglobals ((**hinfo).macwindow)) 848 return (false); 849 850 if (flin) { 851 852 numbertostring ((long) (**hg).idthread, bstheadinfo); 853 854 if ((**hg).hprocess) { 855 856 pushstring ("\x02" " [", bstheadinfo); 857 858 pushstring ((**(**hg).hprocess).bsname, bstheadinfo); 859 860 pushchar (']', bstheadinfo); 861 } 862 } 863 else 864 insertstring ("\x06" "(out) ", bstheadinfo); 865 866 if (aboutdata != nil) 867 ccupdatestatistics (false); 868 869 shellpopglobals (); 870 871 return (fl); 872 } /*aboutsetthreadstring*/ 873 874 875 boolean aboutsetmiscstring (bigstring bsmisc) { 876 877 #ifdef WIN95VERSION 878 extern DWORD ixthreadglobalsgrabcount; // Tls index of counter for nest globals grabbing 879 880 long grabcount = (long) TlsGetValue (ixthreadglobalsgrabcount); 881 #endif 882 883 // register hdlcancoonrecord hc = cancoonglobals; 884 // hdlwindowinfo hinfo; 885 886 copystring (bsmisc, bsmiscinfo); 887 888 // if (!findaboutwindow (&hinfo) || !shellpushglobals ((**hinfo).macwindow)) 889 // return (false); 890 891 #ifdef WIN95VERSION 892 if (grabcount > 0) 893 #endif 894 if (aboutport != nil && flhavemiscrect) { 895 //Code change by Timothy Paustian Monday, August 21, 2000 4:17:36 PM 896 //We cannot just pass a window or dialog ptr to pushport. It's doing 897 //an implicit cast. This will not work on OS X 898 CGrafPtr thePort; 899 #if TARGET_API_MAC_CARBON == 1 900 thePort = GetWindowPort((WindowRef) aboutport); 901 #else 902 thePort = (CGrafPtr)aboutport; 903 #endif 904 pushport(thePort); 905 906 pushclip (miscinforect); 907 908 eraserect (miscinforect); 909 910 movepento (miscinforect.left, miscinforect.top + globalfontinfo.ascent); 911 912 pendrawstring (bsmisc); 913 914 popclip (); 915 916 popport (); 917 } 918 919 // shellpopglobals (); 920 921 return (true); 922 } /*aboutsetmiscstring*/ 923 924 925 boolean ccmsg (bigstring bs, boolean flbackgroundmsg) { 926 927 /* 928 can be called from a script, not as part of a callback sequence. 929 930 if flbackgroundmsg is true the message is coming from an agent. we avoid 931 letting such messages overwrite the non-background message until the user 932 has done something. 933 934 1/9/91: see comment in ccbringtofront 935 936 12/28/91 dmb: always force code match for background message, event if hcode is nil 937 */ 938 939 register hdlcancoonrecord hc = cancoonglobals; 940 boolean fl = false; 941 hdlwindowinfo hinfo; 942 hdlstring hstring; 943 944 if (hc == nil) 945 return (false); 946 947 if (!findaboutwindow (&hinfo) || !shellpushglobals ((**hinfo).macwindow)) 948 hinfo = nil; 949 950 if (!flbackgroundmsg && isemptystring (bs)) { /*empty string unblocks background messages*/ 951 952 ccunblockmsg (); 953 954 goto pop; 955 } 956 957 if (flbackgroundmsg) { 958 959 /* 960 coming from an agent. record the message text in the process record, so 961 we can use the popup to switch between the last message left by any agent. 962 963 the make sure it's the currently-selected agent, or don't display it. 964 */ 965 966 register hdltreenode hcode = (**hc).hprimaryagent; 967 register hdlprocessrecord hp = currentprocess; 968 969 if (hp == nil) /*only agents are allowed to send background messages!*/ 970 goto pop; 971 972 copystring (bs, (**hp).bsmsg); /*store in process record*/ 973 974 if (/*(hcode != nil) &&*/ ((**hp).hcode != hcode)) 975 goto pop; 976 } 977 978 if (!newheapstring (bs, &hstring)) 979 goto pop; 980 981 if (flbackgroundmsg && (**hc).flbackgroundmsgblocked) { 982 983 disposehandle ((Handle) (**hc).hsecondarymsg); 984 985 (**hc).hsecondarymsg = hstring; 986 987 goto pop; 988 } 989 990 disposehandle ((Handle) (**hc).hprimarymsg); 991 992 (**hc).hprimarymsg = hstring; 993 994 if (hinfo != nil) 995 fl = ccdrawmsg (); 996 997 if (!flbackgroundmsg) 998 (**hc).flbackgroundmsgblocked = true; 999 1000 pop: 1001 1002 if (hinfo != nil) 1003 shellpopglobals (); 1004 1005 return (fl); 1006 } /*ccmsg*/ 1007 1008 1009 static void aboutupdate (void) { 1010 1011 /* 1012 1/22/91 dmb: openbitmap moves memory; its result cannot be assigned 1013 into a double-dereferenced handle. (ahem!) 1014 1015 2.1b5 dmb: special case for nil cancoondata (during revert). also, removed 1016 unneeded flbitmapactive logic 1017 */ 1018 1019 register hdlwindowinfo hw = aboutwindowinfo; 1020 Rect r; 1021 1022 displayedaboutdata = aboutdata; 1023 1024 #if TARGET_API_MAC_CARBON 1025 aboutport = GetWindowPort(aboutwindow); 1026 #else 1027 aboutport = (CGrafPtr)aboutwindow; 1028 #endif 1029 1030 flhavemiscrect = false; 1031 1032 if (aboutdata == nil) /*in the middle of a revert*/ 1033 return; 1034 1035 r = (**hw).contentrect; 1036 1037 eraserect (r); 1038 1039 shelldrawgrowicon (hw); 1040 1041 if ((**aboutdata).flbigwindow) { 1042 1043 ccdrawabout (); 1044 1045 // ccgetmsgrect (&r); 1046 getmessagecontentrect (&r); 1047 1048 insetrect (&r, -1, -1); 1049 1050 #if TARGET_API_MAC_CARBON == 1 1051 1052 insetrect (&r, 0, -3); 1053 1054 r.bottom = r.top + 2; 1055 1056 DrawThemeSeparator (&r, kThemeStateActive); 1057 1058 #else 1059 1060 // grayframerect (r); 1061 movepento (r.left, r.top); 1062 1063 pushpen (); 1064 1065 setgraypen (); 1066 1067 pendrawline (r.right, r.top); 1068 1069 poppen (); 1070 1071 #endif 1072 1073 flhavemiscrect = ccgettextitemrect (miscinfoitem, &miscinforect); 1074 } 1075 1076 if (!(**aboutdata).flbootsplash) { 1077 1078 ccdrawagentpopup (); 1079 1080 ccdrawmsg (); 1081 } 1082 } /*aboutupdate*/ 1083 1084 1085 static boolean aboutgettargetdata (short id) { 1086 1087 return (id == -1); /*true if target type is generic -- a shell verb*/ 1088 } /*aboutgettargetdata*/ 1089 1090 1091 static boolean aboutresetrects (hdlwindowinfo hinfo) { 1092 1093 /* 1094 12/28/90 dmb: the resetrects routine is called while the windowinfo is 1095 being created, before any data has been created for it. we can't assume that 1096 cancoondata or aboutwindowinfo are not nil 1097 */ 1098 1099 register hdlwindowinfo hw = hinfo; 1100 hdlaboutrecord ha = (hdlaboutrecord) (**hw).hdata; 1101 Rect rmessage, rabout; 1102 1103 if (ha == nil) 1104 return (false); 1105 1106 rmessage = (**hw).contentrect; 1107 1108 shellcalcgrowiconrect (rmessage, hw); 1109 1110 zerorect (&rabout); 1111 1112 if ((**aboutdata).flbigwindow) { /*divide window into message and about*/ 1113 1114 rabout = rmessage; /*set left, right, bottom*/ 1115 1116 rabout.bottom = rabout.top + aboutrectheight(); 1117 1118 rmessage.top = rabout.bottom + msgvertgap; 1119 1120 // rmessage.bottom -= aboutlineheight; 1121 1122 insetrect (&rabout, abouthorizinset, aboutvertinset); 1123 1124 insetrect (&rmessage, abouthorizinset, aboutvertinset); 1125 } 1126 1127 (**aboutdata).messagearea = rmessage; 1128 1129 (**aboutdata).aboutarea = rabout; 1130 1131 return (true); 1132 } /*aboutresetrects*/ 1133 1134 1135 static boolean attachabout (void) { 1136 1137 hdlwindowinfo hroot; 1138 1139 if (aboutdata == nil) 1140 return (false); 1141 1142 if (!ccfindrootwindow (&hroot)) { 1143 1144 (**aboutwindowinfo).parentwindow = nil; 1145 1146 return (false); 1147 } 1148 1149 (**aboutwindowinfo).parentwindow = hroot; 1150 1151 return (true); 1152 } /*attachabout*/ 1153 1154 1155 static void detachabout (void) { 1156 1157 (**aboutwindowinfo).parentwindow = nil; 1158 } /*detachabout*/ 1159 1160 1161 static void aboutresizeafterfontchange (void) { 1162 1163 register hdlwindowinfo hw = aboutwindowinfo; 1164 register short diff; 1165 Rect r; 1166 1167 // r = (**hw).contentrect; 1168 1169 shellgetglobalwindowrect (hw, &r); /*rwindow is in global coords*/ 1170 1171 diff = ccgetneededheight ((**aboutdata).flbigwindow) - (r.bottom - r.top); 1172 1173 if (diff > 0) { 1174 1175 r.bottom += diff; 1176 1177 moveandsizewindow ((**hw).macwindow, r); 1178 1179 shelladjustaftergrow ((**hw).macwindow); 1180 } 1181 1182 windowinval (aboutwindow); 1183 1184 if (attachabout ()) { 1185 1186 cccopywindowinfo (hw, ixaboutinfo); /*update aboutdata*/ 1187 1188 detachabout (); 1189 } 1190 } /*aboutresizeafterfontchange*/ 1191 1192 static void aboutsetconfigminimum (void) { 1193 1194 short ixaboutconfig; 1195 Rect *rmin; 1196 1197 if (shellfindcallbacks (idaboutconfig, &ixaboutconfig)) { 1198 1199 rmin = &globalsarray [ixaboutconfig].config.rmin; 1200 1201 if ((**aboutdata).flbigwindow) { 1202 1203 (*rmin).bottom = aboutrectheight() + msgvertgap + minmsgheight + 2 * msgborderpix; 1204 1205 (*rmin).right = minaboutwidth; 1206 } 1207 else { 1208 1209 (*rmin).bottom = 26; 1210 1211 (*rmin).right = 260; 1212 } 1213 } 1214 } /*aboutsetconfigminimum*/ 1215 1216 1217 static boolean aboutzoom (hdlwindowinfo hinfo, boolean flgrow) { 1218 1219 1220 hdlaboutrecord ha = aboutdata; 1221 register hdlwindowinfo hw = hinfo; 1222 Rect rwindow; 1223 1224 flgrow = (**ha).flbigwindow = !(**ha).flbigwindow; 1225 1226 shellgetglobalwindowrect (hw, &rwindow); 1227 1228 /* 1229 if (flgrow) 1230 rwindow.bottom += aboutrectheight + msgvertgap; 1231 else 1232 rwindow.bottom -= aboutrectheight + msgvertgap; 1233 */ 1234 rwindow.bottom = rwindow.top + ccgetneededheight ((**aboutdata).flbigwindow); 1235 1236 if (flgrow) 1237 rwindow.right = max (rwindow.right, rwindow.left + minaboutwidth); 1238 1239 moveandsizewindow ((**hw).macwindow, rwindow); 1240 1241 shellinvalcontent (hw); 1242 1243 shelladjustaftergrow ((**hw).macwindow); 1244 1245 if (cancoonglobals != nil) // remember setting with current root 1246 (**cancoonglobals).flbigwindow = (**ha).flbigwindow; 1247 1248 aboutsetconfigminimum (); 1249 1250 shellupdatewindow ((**hw).macwindow); 1251 1252 return (true); 1253 } /*aboutzoom*/ 1254 1255 1256 static boolean aboutsetsize (void) { 1257 1258 register hdlwindowinfo hw = aboutwindowinfo; 1259 1260 (**hw).defaultsize = (**hw).selectioninfo.fontsize; 1261 1262 (**hw).selectioninfo.fldirty = true; 1263 1264 aboutresizeafterfontchange (); 1265 1266 return (true); 1267 } /*aboutsetsize*/ 1268 1269 1270 static boolean aboutsetfont (void) { 1271 1272 register hdlwindowinfo hw = aboutwindowinfo; 1273 1274 (**hw).defaultfont = (**hw).selectioninfo.fontnum; 1275 1276 (**hw).selectioninfo.fldirty = true; 1277 1278 aboutresizeafterfontchange (); 1279 1280 return (true); 1281 } /*aboutsetfont*/ 1282 1283 1284 static boolean aboutsetstyle (void) { 1285 1286 register hdlwindowinfo hw = aboutwindowinfo; 1287 1288 shellsetdefaultstyle (hw); /*sets the defaultstyle field based on selectioninfo*/ 1289 1290 (**hw).selectioninfo.fldirty = true; 1291 1292 aboutresizeafterfontchange (); 1293 1294 return (true); 1295 } /*aboutsetstyle*/ 1296 1297 1298 static boolean aboutmousedown (Point pt, tyclickflags flags) { 1299 1300 /* 1301 1/24/91 dmb: to allow the home window to be dragged with a single click, 1302 even when it's not already the front window, the dontconsumefrontclicks 1303 flag is set in its config. in order to avoid reacting to button clicks 1304 or clicks in the close box or on the flag (which aren't even visiable when 1305 the window is inactive), we test to make sure that the window has been 1306 activated before considering taking any special actions. 1307 */ 1308 1309 hdlaboutrecord hc = aboutdata; 1310 Rect r; 1311 1312 ccunblockmsg (); /*any mouse click re-enables background messages*/ 1313 1314 if ((**hc).flbigwindow) { 1315 1316 if (ccgettextitemrect (urlitem, &r) && pointinrect (pt, r)) { 1317 1318 if (trackicon (r, &ccdrawurlitem)) 1319 if (!ccrunurlscript ()) 1320 sysbeep (); 1321 1322 return (true); 1323 } 1324 } 1325 1326 if (ccgetagentpopuprect (&r)) { /*see if click is in agents popup*/ 1327 1328 if (pointinrect (pt, r)) { /*click in agents popup*/ 1329 1330 --r.top; 1331 1332 if (ccagentpopuphit (r, pt)) 1333 ccdrawagentpopup (); 1334 1335 return (true); 1336 } 1337 } 1338 1339 return (true); 1340 } /*aboutmousedown*/ 1341 1342 1343 static boolean aboutkeystroke (void) { 1344 1345 char chkb = keyboardstatus.chkb; 1346 1347 if (chkb == chenter) 1348 aboutzoom (aboutwindowinfo, true); 1349 1350 return (true); 1351 } /*aboutkeystroke*/ 1352 1353 1354 #ifndef version42orgreater 1355 1356 static void drawtextitem (WindowPtr w, short item, short font, short size, short style) { 1357 1358 Rect ritem; 1359 bigstring bsitem; 1360 1361 getdialogtext ((DialogPtr) w, item, bsitem); 1362 1363 dialoggetobjectrect ((DialogPtr) w, item, &ritem); 1364 1365 edittextbox (bsitem, ritem, font, size, style); 1366 } /*drawtextitem*/ 1367 1368 1369 static boolean runurlscript () { 1370 1371 bigstring bsurl; 1372 bigstring bsscript; 1373 //this is a problem. aboutwindow is a window 1374 getdialogtext ((DialogPtr) aboutwindow, urlitem, bsurl); 1375 1376 if (!getsystemtablescript (idopenurlscript, bsscript)) 1377 return (false); 1378 1379 parsedialogstring (bsscript, bsurl, nil, nil, nil, bsscript); 1380 1381 return (processrunstring (bsscript)); 1382 } /*runurlscript*/ 1383 1384 1385 static void drawurlitem (boolean flpressed) { 1386 1387 RGBColor rgb = {0, 0, 0}; 1388 1389 if (flpressed) 1390 rgb.red = 0xA000; 1391 else 1392 rgb.blue = 0xA000; 1393 1394 pushforecolor (&rgb); 1395 1396 drawtextitem (aboutwindow, urlitem, geneva, 9, underline); 1397 1398 popforecolor (); 1399 } /*drawurlitem*/ 1400 1401 1402 #define aboutresnumber 128 /*the id of the various "about" resources*/ 1403 1404 static void drawabout (WindowPtr w, boolean flliveurl) { 1405 1406 /* 1407 10/18/91 DW: color! 1408 1409 10/18/91 DW: added PICT #128 to shell.¹.rsrc. 1410 1411 12/19/91 dmb: use version resource instead of buildinfo routine 1412 */ 1413 1414 /*draw the icon*/ { 1415 1416 Rect rcicn; 1417 1418 dialoggetobjectrect (w, iconitem, &rcicn); 1419 1420 ploticon (&rcicn, aboutresnumber); 1421 } 1422 1423 drawtextitem (w, userlanditem, systemFont, 12, 0); 1424 1425 drawtextitem (w, sloganitem, helv, 9, 0); 1426 1427 drawtextitem (w, copyrightitem, helv, 9, 0); 1428 1429 if (flliveurl) 1430 drawurlitem (false); 1431 else 1432 drawtextitem (w, urlitem, helv, 9, 0); 1433 1434 #if __powerc 1435 1436 drawtextitem (w, nativeitem, helv, 9, 0); 1437 1438 #else 1439 1440 drawtextitem (w, emulateditem, helv, 9, 0); 1441 1442 #endif 1443 1444 /*draw the version string*/ { 1445 1446 Rect ritem; 1447 1448 bigstring bsbuildinfo; 1449 1450 filegetprogramversion (bsbuildinfo); 1451 1452 setfontsizestyle (geneva, 9, normal); 1453 1454 dialoggetobjectrect (w, versionitem, &ritem); 1455 1456 movepento (ritem.right - stringpixels (bsbuildinfo), ritem.bottom - 6); 1457 1458 pendrawstring (bsbuildinfo); 1459 } 1460 } /*drawabout*/ 1461 1462 1463 static void updateabout (WindowPtr w, boolean flliveurl) { 1464 1465 shellupdatenow (w); 1466 } /*updateabout*/ 1467 1468 1469 static boolean abouteventhook (EventRecord *ev, WindowPtr w) { 1470 1471 if (w != aboutwindow) /*don't hook if not our dialog*/ 1472 return (true); 1473 1474 if ((*ev).what == updateEvt) 1475 updateabout (w, false); 1476 1477 return (false); /*don't process this event any further*/ 1478 } /*abouteventhook*/ 1479 1480 #endif 1481 1482 1483 static boolean aboutsave (ptrfilespec fs, hdlfilenum fnum, short rnum, boolean flsaveas, boolean flrunnable) { 1484 1485 hdlwindowinfo hinfo; 1486 1487 if (ccfindrootwindow (&hinfo)) { 1488 1489 shellpushglobals ((**hinfo).macwindow); 1490 1491 grayownedwindows (shellwindow); 1492 1493 ccsavefile (fs, fnum, rnum, flsaveas, flrunnable); 1494 1495 shellpopglobals (); 1496 } 1497 1498 return (true); 1499 } /*aboutsave*/ 1500 1501 1502 static boolean aboutclose (void) { 1503 1504 if (!(**aboutdata).flbootsplash && (cancoonglobals != nil)) { 1505 1506 attachabout (); 1507 1508 ccsubwindowclose (aboutwindowinfo, ixaboutinfo); 1509 1510 detachabout (); 1511 } 1512 1513 aboutwindow = nil; 1514 1515 return (true); 1516 } /*aboutclose*/ 1517 1518 1519 static boolean aboutdisposerecord (void) { 1520 1521 disposehandle ((Handle) aboutdata); 1522 1523 aboutdata = nil; 1524 1525 displayedaboutdata = nil; 1526 1527 aboutport = nil; 1528 1529 return (true); 1530 } /*aboutdisposerecord*/ 1531 1532 1533 static boolean aboutsetsuperglobals (void) { 1534 1535 hdlwindowinfo hinfo; 1536 1537 if (ccfindrootwindow (&hinfo)) { 1538 1539 shellpushglobals ((**hinfo).macwindow); 1540 1541 ccsetsuperglobals (); 1542 1543 shellpopglobals (); 1544 } 1545 1546 return (true); 1547 } /*aboutsetsuperglobals*/ 1548 1549 1550 static void aboutwindowsetup (void) { 1551 1552 /* 1553 5.0a2 dmb: while we're grabbing out font settings from the root, 1554 also steal the old flbigwindow flag 1555 */ 1556 1557 register hdlwindowinfo hw = aboutwindowinfo; 1558 tycancoonwindowinfo windowinfo; 1559 1560 // get bigwindow setting from current root 1561 (**aboutdata).flbigwindow = (cancoonglobals == nil) || (**cancoonglobals).flbigwindow; 1562 1563 (**aboutdata).flextrastats = flsessionstats; //optionkeydown (); 1564 1565 if (attachabout ()) { 1566 1567 shellpushrootglobals (aboutwindow); 1568 1569 ccgetwindowinfo (ixaboutinfo, &windowinfo); 1570 1571 (**hw).defaultfont = windowinfo.fontnum; 1572 1573 (**hw).defaultsize = windowinfo.fontsize; 1574 1575 windowinfo.w = aboutwindow; 1576 1577 ccsetwindowinfo (ixaboutinfo, windowinfo); 1578 1579 shellpopglobals (); 1580 1581 detachabout (); 1582 } 1583 } /*aboutwindowsetup*/ 1584 1585 1586 static boolean newaboutwindow (boolean flbootsplash) { 1587 1588 /* 1589 5.0.2b20 dmb: don't reset window pos for negative values 1590 */ 1591 1592 WindowPtr w; 1593 hdlwindowinfo hw; 1594 bigstring bstitle; 1595 Rect rzoom, rwindow; 1596 hdlaboutrecord hdata; 1597 short ixaboutconfig; 1598 1599 if (!newclearhandle (sizeof (tyaboutrecord), (Handle *) &hdata)) 1600 return (false); 1601 1602 shellfindcallbacks (idaboutconfig, &ixaboutconfig); 1603 1604 if (flbootsplash) { 1605 1606 globalsarray [ixaboutconfig].config.templateresnum = 131;//config.fldialog 1607 1608 (**hdata).flbootsplash = true; 1609 } 1610 else 1611 globalsarray [ixaboutconfig].config.templateresnum = 129; //restore 1612 1613 // get bigwindow setting with current root 1614 // (**hdata).flbigwindow = (cancoonglobals == nil) || (**cancoonglobals).flbigwindow; 1615 1616 ccgetwindowrect (ixaboutinfo, &rwindow); 1617 1618 // if (rwindow.top <= 0 || rwindow.left <= 0) 1619 // rwindow.top = -1; 1620 1621 getsystemoriginrect (&rzoom); 1622 1623 // getstringlist (aboutlistnumber, abouttitlestring, bstitle); 1624 copystring (aboutstrings [flbootsplash? frontieritem: titleitem], bstitle); 1625 1626 if (!newchildwindow (idaboutconfig, nil, &rwindow, &rzoom, bstitle, &w)) { 1627 1628 disposehandle ((Handle) hdata); 1629 1630 return (false); 1631 } 1632 1633 #if TARGET_API_MAC_CARBON == 1 1634 1635 SetThemeWindowBackground (w, kThemeBrushModelessDialogBackgroundActive, false); 1636 1637 #endif 1638 1639 getwindowinfo (w, &hw); 1640 1641 (**hw).hdata = (Handle) hdata; 1642 1643 shellpushglobals (w); 1644 1645 aboutwindowsetup (); 1646 1647 aboutresetrects (hw); 1648 1649 if (!flbootsplash) { 1650 1651 aboutresizeafterfontchange (); 1652 1653 aboutsetconfigminimum (); 1654 } 1655 1656 shellpopglobals (); 1657 1658 windowzoom (w); 1659 1660 return (true); 1661 } /*newaboutwindow*/ 1662 1663 1664 boolean aboutcommand (void) { 1665 1666 hdlwindowinfo hinfo; 1667 1668 if (findaboutwindow (&hinfo)) { 1669 1670 shellbringtofront (hinfo); 1671 1672 return (true); 1673 } 1674 1675 return (newaboutwindow (false)); 1676 } /*aboutcommand*/ 1677 1678 1679 void aboutsetstatsflag (boolean fl) { 1680 hdlwindowinfo hinfo; 1681 WindowPtr w; 1682 flsessionstats = fl; 1683 1684 if (findaboutwindow (&hinfo)) { 1685 1686 aboutwindowinfo = hinfo; 1687 1688 aboutdata = (hdlaboutrecord)(**aboutwindowinfo).hdata; 1689 1690 if (aboutdata != nil) 1691 (**aboutdata).flextrastats = fl; 1692 1693 w = (**hinfo).macwindow; 1694 1695 aboutresetrects (hinfo); 1696 1697 shellpushglobals (w); 1698 1699 aboutsetsize(); 1700 1701 shellpopglobals (); 1702 } 1703 1704 } /*aboutsetstatsflag*/ 1705 1706 1707 boolean aboutstart (void) { 1708 1709 /* 1710 set up callback routines record, and link our data into the shell's 1711 data structure. 1712 */ 1713 1714 ptrcallbacks aboutcallbacks; 1715 register ptrcallbacks cb; 1716 static boolean aboutstarted = false; 1717 1718 if (aboutstarted) 1719 return (true); 1720 1721 aboutstarted = true; 1722 1723 shellnewcallbacks (&aboutcallbacks); 1724 1725 cb = aboutcallbacks; /*copy into register*/ 1726 1727 loadconfigresource (idaboutconfig, &(*cb).config); 1728 1729 (*cb).configresnum = idaboutconfig; 1730 1731 (*cb).windowholder = &aboutwindow; 1732 1733 (*cb).dataholder = (Handle *) &aboutdata; 1734 1735 (*cb).infoholder = &aboutwindowinfo; 1736 1737 (*cb).setglobalsroutine = &attachabout; 1738 1739 (*cb).saveroutine = &aboutsave; 1740 1741 (*cb).disposerecordroutine = &aboutdisposerecord; 1742 1743 (*cb).closeroutine = &aboutclose; 1744 1745 (*cb).gettargetdataroutine = &aboutgettargetdata; 1746 1747 (*cb).updateroutine = &aboutupdate; 1748 1749 // (*cb).activateroutine = &aboutactivate; 1750 1751 (*cb).mouseroutine = &aboutmousedown; 1752 1753 (*cb).keystrokeroutine = &aboutkeystroke; 1754 1755 // (*cb).adjustcursorroutine = &aboutadjustcursor; 1756 1757 // (*cb).msgroutine = &aboutmsg; 1758 1759 (*cb).resetrectsroutine = &aboutresetrects; 1760 1761 (*cb).fontroutine = &aboutsetfont; 1762 1763 (*cb).sizeroutine = &aboutsetsize; 1764 1765 (*cb).styleroutine = &aboutsetstyle; 1766 1767 (*cb).zoomwindowroutine = &aboutzoom; 1768 1769 (*cb).setsuperglobalsroutine = &aboutsetsuperglobals; 1770 1771 return (true); 1772 } /*aboutstart*/ 1773 1774 1775 boolean openabout (boolean flzoom, long ctreservebytes) { 1776 1777 /* 1778 2.1b5 dmb: added ctreservebytes parameter. of non-zero, caller wants us to 1779 reserve space in the heap below the dialog record (during initialization) 1780 */ 1781 1782 hdlwindowinfo hinfo; 1783 1784 #ifdef MACVERSION 1785 Ptr ptemp = nil; 1786 1787 if (ctreservebytes > 0) 1788 ptemp = NewPtr (ctreservebytes); /*force about window to load high*/ 1789 #endif 1790 1791 aboutstart (); 1792 1793 shellpatchnilroutines (); 1794 1795 // aboutwindow = newmodaldialog (128, -1); 1796 newaboutwindow (true); 1797 1798 if (findaboutwindow (&hinfo)) 1799 { 1800 shellupdatenow ((**hinfo).macwindow); 1801 //Code change by Timothy Paustian 10/5/00 1802 //We need to flush the about window to the screen 1803 //safe because this routine only gets call during init. 1804 #if TARGET_API_MAC_CARBON == 1 1805 QDFlushPortBuffer(GetWindowPort((**hinfo).macwindow), nil); 1806 #endif 1807 } 1808 #ifdef MACVERSION 1809 if (ptemp != nil) 1810 DisposePtr (ptemp); /*restore heap space for remaining code segments*/ 1811 #endif 1812 1813 aboutopenticks = gettickcount (); 1814 1815 return (true); 1816 } /*openabout*/ 1817 1818 1819 void closeabout (boolean flzoom, short minticks) { 1820 1821 hdlwindowinfo hinfo; 1822 1823 if (findaboutwindow (&hinfo)) { 1824 1825 delayticks (aboutopenticks + minticks - gettickcount ()); 1826 1827 shellclose ((**hinfo).macwindow, false); 1828 } 1829 } /*closeabout*/ 1830 1831

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.