about.c

Go to the documentation of this file.
00001 
00002 /*  $Id: about.c 1311 2006-04-19 08:28:14Z hasseily $    */
00003 
00004 /******************************************************************************
00005 
00006     UserLand Frontier(tm) -- High performance Web content management,
00007     object database, system-level and Internet scripting environment,
00008     including source code editing and debugging.
00009 
00010     Copyright (C) 1992-2004 UserLand Software, Inc.
00011 
00012     This program is free software; you can redistribute it and/or modify
00013     it under the terms of the GNU General Public License as published by
00014     the Free Software Foundation; either version 2 of the License, or
00015     (at your option) any later version.
00016 
00017     This program is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020     GNU General Public License for more details.
00021 
00022     You should have received a copy of the GNU General Public License
00023     along with this program; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 
00026 ******************************************************************************/
00027 
00028 /*
00029 about.c -- a generic "about" box for any Macintosh program written in Lightspeed C.
00030 
00031 Make sure you have a STR# resource number 128, with exactly six strings in it.
00032 
00033 Not too big, kind of sexy, and certainly better than nothing!
00034 */ 
00035 
00036 #include "frontier.h"
00037 #include "standard.h"
00038 
00039 #include "versions.h" /*9.1b3 JES*/
00040 #include "quickdraw.h"
00041 #include "strings.h"
00042 #include "bitmaps.h"
00043 #include "cursor.h"
00044 #include "dialogs.h"
00045 #include "icon.h"
00046 #include "file.h"
00047 #include "font.h"
00048 #include "kb.h"
00049 #include "memory.h"
00050 #include "mouse.h"
00051 #include "ops.h"
00052 #include "popup.h"
00053 #include "resources.h"
00054 #include "scrollbar.h"
00055 #include "smallicon.h"
00056 #include "textedit.h"
00057 #include "frontierwindows.h"
00058 #include "windowlayout.h"
00059 #include "zoom.h"
00060 #include "shell.h"
00061 #include "shellprivate.h"
00062 #include "shellhooks.h"
00063 #include "about.h"
00064 #include "tablestructure.h"
00065 #include "cancoon.h"
00066 #include "cancooninternal.h"
00067 #include "process.h"
00068 #include "processinternal.h"
00069 #include "launch.h"
00070 
00071 #ifdef WIN95VERSION
00072     #include "Winland.h"
00073     #define idfrontiericon  IDB_FRONTIER_BITMAP
00074 #endif
00075 
00076 #ifdef MACVERSION
00077     #define idfrontiericon  128
00078 #endif
00079 
00080 
00081 
00082 static long aboutopenticks; /*so we can tell how long it's been up*/
00083 
00084 
00085 typedef struct tyaboutrecord {
00086     
00087     Rect messagearea;
00088     
00089     Rect aboutarea;
00090     
00091     boolean flbootsplash;
00092     
00093     boolean flbigwindow;
00094     
00095     boolean flextrastats;
00096 
00097     long refcon;
00098     } tyaboutrecord, *ptraboutrecord, **hdlaboutrecord;
00099 
00100 
00101 static hdlaboutrecord aboutdata = nil;
00102 
00103 static WindowPtr aboutwindow = nil;
00104 
00105 static hdlwindowinfo aboutwindowinfo;
00106 
00107 static boolean flsessionstats = false;
00108 
00109 
00110 static hdlaboutrecord displayedaboutdata = nil;
00111 
00112 static CGrafPtr aboutport = nil;
00113 
00114 static boolean flhavemiscrect = false;
00115 
00116 static Rect miscinforect;
00117 
00118 
00119 static bigstring bstheadinfo = "";
00120 
00121 static bigstring bsmiscinfo = "";
00122 
00123 
00124 #define agentpopupwidth (popuparrowwidth + 4)
00125 
00126 #define msgtopinset 3
00127 
00128 #define msgbottominset 3
00129 
00130 #define minmsgheight (heightsmallicon + 4)
00131 
00132 #define msgborderpix 5
00133 
00134 #define msgvertgap 4
00135 
00136 #define aboutlineheight 14
00137 
00138 #define aboutlinewidth 250 /*2005-01-12 aradke*/
00139 
00140 #define aboutvertstart 0
00141 
00142 #define aboutvertinset 6
00143 
00144 #define aboutvertgap 0
00145 
00146 #define abouthorizgap 20
00147 
00148 #define abouthorizinset 12
00149 
00150 #define aboutrowsStats 8
00151 
00152 #define aboutrectheightStats (aboutvertinset * 2 + aboutvertstart + aboutrowsStats * aboutlineheight + aboutvertgap)
00153 
00154 #define aboutrowsNoStats 4
00155 
00156 #define aboutrectheightNoStats (aboutvertinset * 2 + aboutvertstart + aboutrowsNoStats * aboutlineheight + aboutvertgap)
00157 
00158 #define abouticonsize 32
00159 
00160 #define versionwidth 56
00161 
00162 #define minaboutwidth  (aboutlinewidth + abouthorizgap + 2 * abouthorizinset + 4 * abouticonsize)   /*2005-01-12 aradke*/
00163 
00164 #define agentmenuhorizgap 10
00165 
00166 static byte * aboutstrings [] = {
00167 
00168     bs_APP_SLOGAN,      /* 2006-02-06 aradke: see versions.h */
00169     
00170     bs_APP_COPYRIGHT2,  /* 2006-04-08 aradke: see versions.h */
00171     
00172     bs_APP_COPYRIGHT,   /* 2006-02-06 aradke: see versions.h */
00173     
00174     bs_APP_URL,     /* 2006-02-06 aradke: see versions.h */
00175     
00176     BIGSTRING ("\x02" "^0"),
00177     
00178     BIGSTRING ("\x12" "Scripts Running:  "),
00179     
00180     BIGSTRING ("\x11" "Current Thread:  "),
00181     
00182     #ifdef MACVERSION
00183         BIGSTRING ("\x13" "Available Memory:  "),
00184     #endif
00185     #ifdef WIN95VERSION
00186         BIGSTRING ("\x14" "Handles Allocated:  "),
00187     #endif
00188 
00189     BIGSTRING (""),
00190 
00191     BIGSTRING ("\x10" "Visible Agent:  "),
00192     
00193     BIGSTRING ("\x0f" "Current Time:  "),
00194     
00195     bs_APP_NAME,        /* 2006-02-06 aradke: see versions.h */
00196     
00197     BIGSTRING ("\x02" "^0"),
00198     };
00199 
00200 
00201 enum { /*main window items*/
00202     
00203     sloganitem,
00204     
00205     copyright2item,
00206     
00207     copyrightitem,
00208     
00209     urlitem,
00210     
00211     isaitem,
00212     
00213     threadsitem,
00214     
00215     thisthreaditem,
00216     
00217     memoryitem,
00218     
00219     miscinfoitem,
00220 
00221     agentpopupitem,
00222     
00223     datetimeitem,
00224     
00225     frontieritem,
00226     
00227     versionitem
00228     };
00229 
00230 
00231 void aboutsegment (void) {
00232     
00233     } /*aboutsegment*/
00234 
00235 
00236 static boolean findaboutwindow (hdlwindowinfo *hinfo) {
00237 
00238     WindowPtr w;
00239     Handle hdata;
00240     
00241     return (shellfindwindow (idaboutconfig, &w, hinfo, &hdata));
00242     } /*findaboutwindow*/
00243 
00244 
00245 boolean aboutstatsshowing (void) {
00246     
00247     return (displayedaboutdata && (**displayedaboutdata).flbigwindow && (**displayedaboutdata).flextrastats);
00248     } /*aboutstatsshowing*/
00249 
00250 
00251 static long aboutrectheight () {
00252     if (aboutstatsshowing())
00253         return (aboutrectheightStats);
00254 
00255     return(aboutrectheightNoStats);
00256     } /*aboutrectheight*/
00257 
00258 
00259 static void getmessagecontentrect (Rect *rcontent) {
00260 
00261     if (aboutdata == nil)
00262         zerorect (rcontent);
00263     else
00264         *rcontent = (**aboutdata).messagearea;
00265     } /*getmessagecontentrect*/
00266 
00267 
00268 static void ccdrawfrontiericon (Rect rcicn, boolean flpressed) {
00269     
00270     #if TARGET_API_MAC_CARBON == 1 /*PBS 7.0b53: draw an OS X style icon*/
00271     
00272         IconRef iconref;
00273         tyfilespec programfspec;
00274         short label;
00275         OSErr ec;
00276         Rect r = rcicn;
00277         
00278         getapplicationfilespec (nil, &programfspec);
00279 
00280         if (GetIconRefFromFile (&programfspec, &iconref, &label) == noErr) {
00281             
00282             ec = PlotIconRef (&r, kAlignAbsoluteCenter, flpressed? kTransformSelected : 0, kIconServicesNormalUsageFlag, iconref);          
00283             
00284             ReleaseIconRef (iconref);
00285         
00286             if (ec == noErr)
00287                 return;
00288             } /*if*/
00289     #endif
00290     
00291     ploticonresource (&rcicn, kAlignAbsoluteCenter, flpressed? kTransformSelected : 0, idfrontiericon);
00292     
00293     } /*ccdrawfrontiericon*/
00294 
00295 
00296 static boolean ccgettextitemrect (short item, Rect *r) {
00297     
00298     short linewidth = aboutlinewidth;
00299     
00300     if (item == versionitem) {
00301         
00302         *r = (**aboutwindowinfo).contentrect;
00303         
00304     //  insetrect (r, msgborderpix, msgborderpix);
00305         
00306         (*r).right -= msgborderpix + getscrollbarwidth (); // leave room for grow icon
00307         
00308         (*r).top = (*r).bottom - aboutlineheight;
00309         
00310         return (true);
00311         }
00312     
00313     *r = (**aboutdata).aboutarea;
00314     
00315     linewidth = min (linewidth, ((*r).right - (*r).left - abouthorizgap) / 2);
00316     
00317     (*r).top += aboutvertstart + item * aboutlineheight;
00318     
00319     /*if (false && item > urlitem) {
00320     
00321         if (odd (item))
00322             (*r).left = (*r).right - aboutlinewidth;
00323         
00324         else
00325             (*r).right = (*r).left + aboutlinewidth;
00326         }
00327     else
00328     */
00329     if (item != miscinfoitem)
00330         (*r).left += 4 * abouticonsize + abouthorizinset;
00331     
00332     if ((*r).top > abouticonsize)
00333         (*r).top += aboutvertgap;
00334     
00335     (*r).bottom = (*r).top + aboutlineheight - 1;
00336     
00337     return ((*r).bottom <= (**aboutdata).aboutarea.bottom);
00338     } /*ccgettextitemrect*/
00339 
00340 
00341 static boolean ccgetagentpopuprect (Rect *rpopup) {
00342     
00343     Rect r = (**aboutdata).messagearea;
00344     
00345     r.left += msgborderpix;
00346     
00347     r.right = r.left + widthsmallicon;
00348     
00349     // r.top += msgborderpix + msgtopinset;
00350     r.top = (r.bottom + r.top - heightsmallicon) / 2;
00351     
00352     r.bottom = r.top + heightsmallicon;
00353     
00354     *rpopup = r;
00355     
00356     return (true);
00357     } /*ccgetagentpopuprect*/
00358 
00359 
00360 static void ccdrawmainwindowtext (short item, short style, ptrstring bs, short just) {
00361     
00362     Rect r;
00363     bigstring bsitem;
00364     
00365     if (!ccgettextitemrect (item, &r))
00366         return;
00367     
00368     if (bs == nil) { /*get from string list*/
00369         
00370         copystring (aboutstrings [item], bsitem);
00371         
00372         bs = bsitem;
00373         }
00374     
00375     setglobalfontsizestyle (geneva, 9, style);
00376     
00377     switch (just) {
00378         
00379         case leftjustified:
00380             eraserect (r);
00381             
00382             movepento (r.left, r.top + globalfontinfo.ascent);
00383             
00384             break;
00385         
00386         case rightjustified:
00387             movepento (r.right - stringpixels (bs), r.top + globalfontinfo.ascent);
00388             
00389             break;
00390         
00391         case fulljustified:
00392             break;
00393         }
00394     
00395     pendrawstring (bs);
00396     } /*ccdrawmainwindowtext*/
00397 
00398 
00399 static void pushaboutstyle (void) {
00400 
00401     register hdlwindowinfo hw = aboutwindowinfo;
00402     
00403     if ((**aboutdata).flbigwindow)
00404         pushstyle (geneva, 9, normal);
00405     else
00406         pushstyle ((**hw).defaultfont, (**hw).defaultsize, (**hw).defaultstyle);
00407     } /*pushaboutstyle*/
00408 
00409 
00410 static short ccgetneededheight (boolean flbigwindow) {
00411 
00412     register short x;
00413     
00414     if ((**aboutdata).flbootsplash)
00415         x = 0;
00416     
00417     else {
00418         
00419         pushaboutstyle ();
00420         
00421         x = globalfontinfo.ascent + globalfontinfo.descent;
00422         
00423         popstyle ();
00424         
00425         x = max (x, minmsgheight);
00426         
00427         x += msgtopinset + msgbottominset;
00428         }
00429     
00430     if (flbigwindow)
00431         x += 2 * msgborderpix + aboutrectheight() + msgvertgap;
00432     
00433     return (x);
00434     } /*ccgetneededheight*/
00435 
00436 
00437 #if 0
00438 
00439 static boolean ccfindagentvisit (bigstring bsname, hdlhashnode hnode, tyvaluerecord val, ptrvoid refcon) {
00440     
00441     hdltreenode hcode;
00442     
00443     if (!langexternalvaltocode (val, &hcode)) /*not a scipt, or no code*/
00444         return (false);
00445     
00446     if (hcode == (**cancoonglobals).hprimaryagent)
00447         return (true);
00448     
00449     return (false);
00450     } /*ccfindagentvisit*/
00451 
00452 #endif
00453 
00454 
00455 static void ccdrawagentpopup (void) {
00456     
00457     Rect r;
00458     
00459     if (ccgetagentpopuprect (&r)) {
00460         
00461         if (cancoonglobals == nil)
00462             eraserect (r);
00463         else {
00464             ccupdateagentpopup (r);
00465             /*
00466             Point pt;
00467             bigstring bs;
00468             
00469             ccdrawmainwindowtext (agentpopupitem, bold, nil, leftjustified);
00470             
00471             getpenpoint (&pt);
00472             
00473             r.left = pt.h + agentmenuhorizgap;
00474             
00475             r.bottom = r.top + popupheight;
00476             
00477             if (!hashinversesearch (agentstable, &ccfindagentvisit, nil, bs))
00478                 setemptystring (bs);
00479             
00480             insertstring ("\x03   ", bs);
00481             
00482             drawpopup (r, bs, true);
00483             */
00484             }
00485         }
00486     } /*ccdrawagentpopup*/
00487 
00488 
00489 #if 0
00490 
00491 static void cceraseagentpopup (void) {
00492     
00493     Rect r;
00494     
00495     if (ccgetagentpopuprect (&r))
00496         eraserect (r);
00497     } /*cceraseagentpopup*/
00498 
00499 #endif
00500 
00501 
00502 static void ccgetmsgrect (Rect *rmsg) {
00503     
00504     /*
00505     5.0.2b19 dmb: leave correct room for version string
00506     */
00507     
00508     Rect r;
00509     short lineheight = globalfontinfo.ascent + globalfontinfo.descent;
00510     
00511     getmessagecontentrect (rmsg);
00512     
00513     // if ((**aboutdata).flbigwindow)
00514     //      insetrect (rmsg, 6, 6);
00515     
00516     ccgetagentpopuprect (&r);
00517     
00518 //  (*rmsg).top = r.top + 1;
00519     
00520 //  (*rmsg).bottom = (*rmsg).top + globalfontinfo.ascent + globalfontinfo.descent;
00521 
00522     (*rmsg).top = ((*rmsg).bottom + (*rmsg).top - lineheight) / 2;
00523     
00524     (*rmsg).bottom = (*rmsg).top + lineheight;
00525     
00526     (*rmsg).left = r.right + 8;
00527     
00528     if (ccgettextitemrect (versionitem, &r) && (*rmsg).bottom > r.top) // overlap
00529         (*rmsg).right -= versionwidth; // leave root for version
00530     } /*ccgetmsgrect*/
00531 
00532 
00533 static boolean ccdrawmsg (void) {
00534     
00535     /*
00536     2.1b5 dmb: don't need flbitmapactive logic; openbitmap will return 
00537     false if one's already open.
00538     */
00539     
00540     register hdlcancoonrecord hc = cancoonglobals;
00541     //register hdlwindowinfo hw = aboutwindowinfo;
00542     register hdlstring hstring;
00543     register boolean flbitmap = false;
00544     bigstring bs;
00545     Rect r;
00546     
00547     if (hc == nil || aboutdata == nil)
00548         return (false);
00549     
00550     pushaboutstyle ();
00551     
00552     ccgetmsgrect (&r);
00553     
00554     flbitmap = openbitmap (r, aboutwindow);
00555     
00556     if (!flbitmap)
00557         pushclip (r);
00558 
00559     eraserect (r);
00560     
00561     /*
00562     grayframerect (r);
00563     */
00564     
00565     hstring = (**hc).hprimarymsg;
00566     
00567     /*
00568     if (hstring == nil) /%no primary message, display file name%/
00569         hstring = (**hw).hfilename;
00570     */
00571     
00572     copyheapstring (hstring, bs);
00573     
00574 //  centerstring (r, bs);
00575     
00576     movepento (r.left, r.top + globalfontinfo.ascent);
00577     
00578     pendrawstring (bs);
00579     
00580     popstyle ();
00581     
00582     if (flbitmap)
00583         closebitmap (aboutwindow);
00584     else
00585         popclip ();
00586     
00587     return (true);
00588     } /*ccdrawmsg*/
00589 
00590 
00591 static void ccdrawtextitem (short item, ptrstring param, short style, short just) {
00592     
00593     bigstring bsitem;
00594     
00595     parsedialogstring (aboutstrings [item], param, nil, nil, nil, bsitem);
00596     
00597     ccdrawmainwindowtext (item, style, bsitem, just);
00598     } /*ccdrawtextitem*/
00599 
00600 
00601 static boolean ccrunurlscript () {
00602 
00603     bigstring bsscript;
00604     
00605     if (!getsystemtablescript (idopenurlscript, bsscript))
00606         return (false);
00607     
00608     parsedialogstring (bsscript, aboutstrings [urlitem], nil, nil, nil, bsscript);
00609     
00610     return (processrunstring (bsscript));
00611     } /*ccrunurlscript*/
00612 
00613 
00614 static void ccdrawurlitem (boolean flpressed) {
00615     
00616     RGBColor rgb = {0, 0, 0};
00617     
00618     if (flpressed)
00619         rgb.red = 0xA000;   
00620     else
00621         rgb.blue = 0xA000;
00622     
00623     pushforecolor (&rgb);
00624     
00625     ccdrawtextitem (urlitem, nil, underline, leftjustified);
00626 //  ccdrawmainwindowtext (urlitem, underline, nil, leftjustified);
00627     
00628     popforecolor ();
00629     } /*ccdrawurlitem*/
00630 
00631 
00632 static void ccdrawstatistic (short item, ptrstring value, boolean flbitmap) {
00633 
00634     Rect r;
00635     
00636     if (flbitmap) {
00637     
00638         if (!ccgettextitemrect (item, &r))
00639             return;
00640         
00641         flbitmap = openbitmap (r, aboutwindow);
00642         }
00643     
00644     ccdrawmainwindowtext (item, bold, nil, leftjustified);
00645     
00646     ccdrawmainwindowtext (item, normal, value, rightjustified);
00647     
00648     if (flbitmap)
00649         closebitmap (aboutwindow);
00650     } /*ccdrawstatistic*/
00651 
00652     
00653 static void ccupdatestatistics (boolean flbitmap) {
00654     
00655     /*
00656     1/20/93 dmb: if fldisableyield is set, we got here in strange circumstances.
00657     most likely, it indicates that a script running as a component or fast script 
00658     put up a dialog. to avoid a system crash, we must not call langrunstringnoerror.
00659     */
00660     
00661     bigstring bs;
00662     short threadcount;
00663     
00664 //  timedatestring (timenow (), bs);
00665 //  ccdrawstatistic (datetimeitem, bs, flbitmap);
00666     
00667     if (aboutstatsshowing ()) {
00668     
00669     #ifdef WIN95VERSION
00670         extern long handlecounter;
00671         
00672         numbertostring (handlecounter, bs);
00673 
00674     #endif
00675 
00676     #ifdef MACVERSION
00677         long freemem = FreeMem () / 1024;
00678         
00679         numbertostring (freemem, bs);
00680         
00681         pushchar ('K', bs);
00682     #endif
00683         
00684         ccdrawstatistic (memoryitem, bs, flbitmap);
00685         
00686         threadcount = processthreadcount ();
00687         
00688         numbertostring (threadcount, bs);
00689         
00690         ccdrawstatistic (threadsitem, bs, flbitmap);
00691         
00692         ccdrawstatistic (thisthreaditem, bstheadinfo, flbitmap);
00693         
00694         ccdrawmainwindowtext (miscinfoitem, normal, bsmiscinfo, leftjustified);
00695         }
00696     
00697     /*
00698     if ((roottable != nil) && (!fldisableyield)) {
00699         
00700         if (langrunstringnoerror ("\puser.name", bs)) {
00701             
00702             ccdrawstatistic (usernameitem, bs, flbitmap);
00703             }
00704         }
00705     */
00706     } /*ccupdatestatistics*/
00707 
00708 
00709 static void ccdrawabout (void) {
00710     
00711     /*
00712     5.0b9 dmb: user Arial, but just for the frontier(tm) item
00713     */
00714 
00715     Rect rabout = (**aboutdata).aboutarea;
00716     bigstring bs;
00717     
00718     /*draw the icon*/ {
00719         
00720         #ifdef WIN95VERSION
00721             short tmfont;
00722 
00723             fontgetnumber (BIGSTRING ("\x05" "Arial"), &tmfont);
00724 
00725             if (tmfont != 0)
00726                 setglobalfontsizestyle (tmfont, 9, bold);
00727             else
00728         #endif
00729         
00730         setglobalfontsizestyle (geneva, 9, bold);
00731         
00732         rabout.top += max ((aboutrowsNoStats * aboutlineheight - abouticonsize) / 2, 0);
00733     
00734         rabout.left += abouticonsize; /*2005-01-12 aradke: shorter frontieritem, indent it too*/ 
00735 
00736         movepento (rabout.left, rabout.top + abouticonsize + globalfontinfo.ascent);
00737         
00738         pendrawstring (aboutstrings [frontieritem]);
00739         
00740         #ifdef WIN95VERSION
00741             if (tmfont != 0)
00742                 setglobalfontsizestyle (geneva, 9, bold);
00743         #endif
00744         
00745 
00746         //rabout.left += abouticonsize; /*2005-01-12 aradke*/
00747         
00748         rabout.right = rabout.left + abouticonsize;
00749         
00750         rabout.bottom = rabout.top + abouticonsize;
00751         
00752         ccdrawfrontiericon (rabout, false);
00753         }
00754     
00755     ccdrawtextitem (copyright2item, nil, normal, leftjustified);
00756 
00757     ccdrawtextitem (copyrightitem, nil, normal, leftjustified);
00758     
00759     ccdrawurlitem (false);
00760     
00761     #if __powerc
00762     
00763     //  ccdrawtextitem (isaitem, "\pPowerPC", normal);
00764         parsedialogstring (aboutstrings [isaitem], BIGSTRING ("\x07" "PowerPC"), nil, nil, nil, bs);
00765     
00766     #else
00767     
00768         parsedialogstring (aboutstrings [isaitem], BIGSTRING ("\x05" "680x0"), nil, nil, nil, bs);
00769     
00770     #endif
00771     
00772 //  ccdrawmainwindowtext (isaitem, normal, bs, leftjustified);
00773     
00774 //  ccdrawtextitem (frontieritem, nil, bold);
00775     
00776     ccdrawtextitem (sloganitem, nil, italic, leftjustified);
00777     
00778     filegetprogramversion (bs);
00779     
00780     #ifdef fltrialsize
00781     
00782         insertstring (BIGSTRING ("\x06" "Trial "), bs);
00783         
00784     #endif
00785     
00786     ccdrawmainwindowtext (versionitem, normal, bs, rightjustified);
00787     
00788     ccupdatestatistics (false);
00789     } /*ccdrawabout*/
00790 
00791 
00792 static void ccunblockmsg (void) {
00793     
00794     /*
00795     1/9/91 dmb: must set secondary message to nil when it's moved into 
00796     the primary message
00797     */
00798     
00799     register hdlcancoonrecord hc = cancoonglobals;
00800     register hdlstring hs;
00801     
00802     if (hc && (**hc).flbackgroundmsgblocked) {
00803     
00804         (**hc).flbackgroundmsgblocked = false; 
00805         
00806         hs = (**hc).hsecondarymsg;
00807         
00808         if (hs != nil) {
00809         
00810             disposehandle ((Handle) (**hc).hprimarymsg);
00811             
00812             (**hc).hprimarymsg = hs;
00813             
00814             (**hc).hsecondarymsg = nil;
00815             
00816             ccdrawmsg ();
00817             }
00818         }
00819     } /*ccunblockmsg*/
00820 
00821 
00822 boolean aboutsetthreadstring (hdlprocessthread hp, boolean flin) {
00823     
00824     register hdlcancoonrecord hc = cancoonglobals;
00825     hdlthreadglobals hg = (hdlthreadglobals) hp;
00826     boolean fl = false;
00827     hdlwindowinfo hinfo;
00828     
00829     if (hc == nil)
00830         return (false);
00831     
00832     if (!aboutstatsshowing ())
00833         return (false);
00834     
00835     if (!findaboutwindow (&hinfo) || !shellpushglobals ((**hinfo).macwindow))
00836         return (false);
00837     
00838     if (flin) {
00839 
00840         numbertostring ((long) (**hg).idthread, bstheadinfo);
00841 
00842         if ((**hg).hprocess) {
00843             
00844             pushstring (BIGSTRING ("\x02" " ["), bstheadinfo);
00845 
00846             pushstring ((**(**hg).hprocess).bsname, bstheadinfo);
00847 
00848             pushchar (']', bstheadinfo);
00849             }
00850         }
00851     else
00852         insertstring (BIGSTRING ("\x06" "(out) "), bstheadinfo);
00853     
00854     if (aboutdata != nil)
00855         ccupdatestatistics (false);
00856     
00857     shellpopglobals ();
00858         
00859     return (fl);
00860     } /*aboutsetthreadstring*/
00861 
00862 
00863 boolean aboutsetmiscstring (bigstring bsmisc) {
00864     
00865     #ifdef WIN95VERSION
00866     extern  DWORD ixthreadglobalsgrabcount;         // Tls index of counter for nest globals grabbing
00867 
00868     long grabcount = (long) TlsGetValue (ixthreadglobalsgrabcount);
00869     #endif
00870 
00871 //  register hdlcancoonrecord hc = cancoonglobals;
00872 //  hdlwindowinfo hinfo;
00873 
00874     copystring (bsmisc, bsmiscinfo);
00875 
00876 //  if (!findaboutwindow (&hinfo) || !shellpushglobals ((**hinfo).macwindow))
00877 //      return (false);
00878     
00879     #ifdef WIN95VERSION
00880     if (grabcount > 0)
00881     #endif
00882     if (aboutport != nil && flhavemiscrect) {
00883         //Code change by Timothy Paustian Monday, August 21, 2000 4:17:36 PM
00884         //We cannot just pass a window or dialog ptr to pushport. It's doing
00885         //an implicit cast. This will not work on OS X
00886         CGrafPtr    thePort;
00887         #if TARGET_API_MAC_CARBON == 1
00888         thePort = GetWindowPort((WindowRef) aboutport);
00889         #else
00890         thePort = (CGrafPtr)aboutport;      
00891         #endif
00892         pushport(thePort);
00893             
00894             pushclip (miscinforect);
00895             
00896             eraserect (miscinforect);
00897             
00898             movepento (miscinforect.left, miscinforect.top + globalfontinfo.ascent);
00899             
00900             pendrawstring (bsmisc);
00901             
00902             popclip ();
00903 
00904         popport ();
00905         }
00906     
00907 //  shellpopglobals ();
00908 
00909     return (true);
00910     } /*aboutsetmiscstring*/
00911 
00912 
00913 boolean ccmsg (bigstring bs, boolean flbackgroundmsg) {
00914     
00915     /*
00916     can be called from a script, not as part of a callback sequence.
00917     
00918     if flbackgroundmsg is true the message is coming from an agent.  we avoid 
00919     letting such messages overwrite the non-background message until the user
00920     has done something.
00921     
00922     1/9/91: see comment in ccbringtofront
00923     
00924     12/28/91 dmb: always force code match for background message, event if hcode is nil
00925     */
00926     
00927     register hdlcancoonrecord hc = cancoonglobals;
00928     boolean fl = false;
00929     hdlwindowinfo hinfo;
00930     hdlstring hstring;
00931     
00932     if (hc == nil)
00933         return (false);
00934     
00935     if (!findaboutwindow (&hinfo) || !shellpushglobals ((**hinfo).macwindow))
00936         hinfo = nil;
00937     
00938     if (!flbackgroundmsg && isemptystring (bs)) { /*empty string unblocks background messages*/
00939         
00940         ccunblockmsg ();
00941         
00942         goto pop;
00943         }
00944     
00945     if (flbackgroundmsg) {
00946         
00947         /*
00948         coming from an agent.  record the message text in the process record, so 
00949         we can use the popup to switch between the last message left by any agent.
00950         
00951         the make sure it's the currently-selected agent, or don't display it.
00952         */
00953         
00954         register hdltreenode hcode = (**hc).hprimaryagent;
00955         register hdlprocessrecord hp = currentprocess;
00956         
00957         if (hp == nil) /*only agents are allowed to send background messages!*/
00958             goto pop;
00959         
00960         copystring (bs, (**hp).bsmsg); /*store in process record*/
00961         
00962         if (/*(hcode != nil) &&*/ ((**hp).hcode != hcode))
00963             goto pop;
00964         }
00965     
00966     if (!newheapstring (bs, &hstring))
00967         goto pop;
00968     
00969     if (flbackgroundmsg && (**hc).flbackgroundmsgblocked) {
00970         
00971         disposehandle ((Handle) (**hc).hsecondarymsg);
00972         
00973         (**hc).hsecondarymsg = hstring;
00974         
00975         goto pop;
00976         }
00977     
00978     disposehandle ((Handle) (**hc).hprimarymsg);
00979     
00980     (**hc).hprimarymsg = hstring;
00981     
00982     if (hinfo != nil)
00983         fl = ccdrawmsg ();
00984     
00985     if (!flbackgroundmsg)
00986         (**hc).flbackgroundmsgblocked = true;
00987     
00988     pop: 
00989     
00990     if (hinfo != nil)
00991         shellpopglobals ();
00992         
00993     return (fl);
00994     } /*ccmsg*/
00995     
00996 
00997 static void aboutupdate (void) {
00998     
00999     /*
01000     1/22/91 dmb: openbitmap moves memory; its result cannot be assigned 
01001     into a double-dereferenced handle.  (ahem!)
01002     
01003     2.1b5 dmb: special case for nil cancoondata (during revert). also, removed 
01004     unneeded flbitmapactive logic
01005     */
01006     
01007     register hdlwindowinfo hw = aboutwindowinfo;
01008     Rect r;
01009     
01010     displayedaboutdata = aboutdata;
01011 
01012     #if TARGET_API_MAC_CARBON
01013         aboutport = GetWindowPort(aboutwindow);
01014     #else
01015         aboutport = (CGrafPtr)aboutwindow;  
01016     #endif
01017     
01018     flhavemiscrect = false;
01019 
01020     if (aboutdata == nil) /*in the middle of a revert*/
01021         return;
01022     
01023     r = (**hw).contentrect;
01024     
01025     eraserect (r);
01026     
01027     shelldrawgrowicon (hw);
01028     
01029     if ((**aboutdata).flbigwindow) {
01030         
01031         ccdrawabout ();
01032         
01033     //  ccgetmsgrect (&r);
01034         getmessagecontentrect (&r);
01035         
01036         insetrect (&r, -1, -1);
01037         
01038         #if TARGET_API_MAC_CARBON == 1
01039             
01040             insetrect (&r, 0, -3);
01041             
01042             r.bottom = r.top + 2;
01043         
01044             DrawThemeSeparator (&r, kThemeStateActive);
01045         
01046         #else
01047 
01048         //  grayframerect (r);
01049             movepento (r.left, r.top);
01050             
01051             pushpen ();
01052             
01053             setgraypen ();
01054             
01055             pendrawline (r.right, r.top);
01056             
01057             poppen ();
01058 
01059         #endif
01060         
01061         flhavemiscrect = ccgettextitemrect (miscinfoitem, &miscinforect);
01062         }
01063     
01064     if (!(**aboutdata).flbootsplash) {
01065         
01066         ccdrawagentpopup ();
01067         
01068         ccdrawmsg ();
01069         }
01070     } /*aboutupdate*/
01071 
01072 
01073 static boolean aboutgettargetdata (short id) {
01074     
01075     return (id == -1); /*true if target type is generic -- a shell verb*/
01076     } /*aboutgettargetdata*/
01077 
01078 
01079 static boolean aboutresetrects (hdlwindowinfo hinfo) {
01080     
01081     /*
01082     12/28/90 dmb: the resetrects routine is called while the windowinfo is 
01083     being created, before any data has been created for it.  we can't assume that 
01084     cancoondata or aboutwindowinfo are not nil
01085     */
01086     
01087     register hdlwindowinfo hw = hinfo;
01088     hdlaboutrecord ha = (hdlaboutrecord) (**hw).hdata;
01089     Rect rmessage, rabout;
01090     
01091     if (ha == nil)
01092         return (false);
01093     
01094     rmessage = (**hw).contentrect;
01095     
01096     shellcalcgrowiconrect (rmessage, hw);
01097     
01098     zerorect (&rabout);
01099     
01100     if ((**aboutdata).flbigwindow) { /*divide window into message and about*/
01101         
01102         rabout = rmessage; /*set left, right, bottom*/
01103         
01104         rabout.bottom = rabout.top + aboutrectheight();
01105         
01106         rmessage.top = rabout.bottom + msgvertgap;
01107         
01108     //  rmessage.bottom -= aboutlineheight;
01109         
01110         insetrect (&rabout, abouthorizinset, aboutvertinset);
01111         
01112         insetrect (&rmessage, abouthorizinset, aboutvertinset);
01113         }
01114     
01115     (**aboutdata).messagearea = rmessage;
01116     
01117     (**aboutdata).aboutarea = rabout;
01118     
01119     return (true);
01120     } /*aboutresetrects*/
01121     
01122 
01123 static boolean attachabout (void) {
01124     
01125     hdlwindowinfo hroot;
01126     
01127     if (aboutdata == nil)
01128         return (false);
01129 
01130     if (!ccfindrootwindow (&hroot)) {
01131         
01132         (**aboutwindowinfo).parentwindow = nil;
01133         
01134         return (false);
01135         }
01136     
01137     (**aboutwindowinfo).parentwindow = hroot;
01138     
01139     return (true);
01140     } /*attachabout*/
01141 
01142 
01143 static void detachabout (void) {
01144     
01145     (**aboutwindowinfo).parentwindow = nil;
01146     } /*detachabout*/
01147 
01148 
01149 static void aboutresizeafterfontchange (void) {
01150     
01151     register hdlwindowinfo hw = aboutwindowinfo;
01152     register short diff;
01153     Rect r;
01154     
01155 //  r = (**hw).contentrect;
01156     
01157     shellgetglobalwindowrect (hw, &r); /*rwindow is in global coords*/
01158     
01159     diff = ccgetneededheight ((**aboutdata).flbigwindow) - (r.bottom - r.top);
01160     
01161     if (diff > 0) {
01162         
01163         r.bottom += diff;
01164         
01165         moveandsizewindow ((**hw).macwindow, r);
01166         
01167         shelladjustaftergrow ((**hw).macwindow);
01168         }
01169     
01170     windowinval (aboutwindow);
01171     
01172     if (attachabout ()) {
01173         
01174         cccopywindowinfo (hw, ixaboutinfo); /*update aboutdata*/
01175         
01176         detachabout ();
01177         }
01178     } /*aboutresizeafterfontchange*/
01179 
01180 static void aboutsetconfigminimum (void) {
01181     
01182     short ixaboutconfig;
01183     Rect *rmin;
01184     
01185     if (shellfindcallbacks (idaboutconfig, &ixaboutconfig)) {
01186     
01187         rmin = &globalsarray [ixaboutconfig].config.rmin;
01188         
01189         if ((**aboutdata).flbigwindow) {
01190         
01191             (*rmin).bottom = aboutrectheight() + msgvertgap + minmsgheight + 2 * msgborderpix;
01192     
01193             (*rmin).right = minaboutwidth;
01194             }
01195         else {
01196         
01197             (*rmin).bottom = 26;
01198     
01199             (*rmin).right = 260;
01200             }
01201         }
01202     } /*aboutsetconfigminimum*/
01203 
01204 
01205 static boolean aboutzoom (hdlwindowinfo hinfo, boolean flgrow) {
01206     
01207 
01208     hdlaboutrecord ha = aboutdata;
01209     register hdlwindowinfo hw = hinfo;
01210     Rect rwindow;
01211     
01212     flgrow = (**ha).flbigwindow = !(**ha).flbigwindow;
01213     
01214     shellgetglobalwindowrect (hw, &rwindow);
01215         
01216     /*
01217     if (flgrow)
01218         rwindow.bottom += aboutrectheight + msgvertgap;
01219     else
01220         rwindow.bottom -= aboutrectheight + msgvertgap;
01221     */
01222     rwindow.bottom = rwindow.top + ccgetneededheight ((**aboutdata).flbigwindow);
01223     
01224     if (flgrow)
01225         rwindow.right = max (rwindow.right, rwindow.left + minaboutwidth);
01226     
01227     moveandsizewindow ((**hw).macwindow, rwindow);
01228     
01229     shellinvalcontent (hw);
01230 
01231     shelladjustaftergrow ((**hw).macwindow);
01232 
01233     if (cancoonglobals != nil) // remember setting with current root
01234         (**cancoonglobals).flbigwindow = (**ha).flbigwindow;
01235     
01236     aboutsetconfigminimum ();
01237 
01238     shellupdatewindow ((**hw).macwindow);
01239 
01240     return (true);
01241     } /*aboutzoom*/
01242 
01243 
01244 static boolean aboutsetsize (void) {
01245     
01246     register hdlwindowinfo hw = aboutwindowinfo;
01247 
01248     (**hw).defaultsize = (**hw).selectioninfo.fontsize;
01249     
01250     (**hw).selectioninfo.fldirty = true;
01251     
01252     aboutresizeafterfontchange ();
01253     
01254     return (true);
01255     } /*aboutsetsize*/
01256 
01257 
01258 static boolean aboutsetfont (void) {
01259 
01260     register hdlwindowinfo hw = aboutwindowinfo;
01261 
01262     (**hw).defaultfont = (**hw).selectioninfo.fontnum;
01263     
01264     (**hw).selectioninfo.fldirty = true;
01265     
01266     aboutresizeafterfontchange ();
01267     
01268     return (true);
01269     } /*aboutsetfont*/
01270 
01271     
01272 static boolean aboutsetstyle (void) {
01273 
01274     register hdlwindowinfo hw = aboutwindowinfo;
01275     
01276     shellsetdefaultstyle (hw); /*sets the defaultstyle field based on selectioninfo*/
01277     
01278     (**hw).selectioninfo.fldirty = true;
01279     
01280     aboutresizeafterfontchange ();
01281     
01282     return (true);
01283     } /*aboutsetstyle*/
01284 
01285 
01286 static boolean aboutmousedown (Point pt, tyclickflags flags) {
01287 #pragma unused (flags)
01288 
01289     /*
01290     1/24/91 dmb: to allow the home window to be dragged with a single click, 
01291     even when it's not already the front window, the dontconsumefrontclicks 
01292     flag is set in its config.  in order to avoid reacting to button clicks 
01293     or clicks in the close box or on the flag (which aren't even visiable when 
01294     the window is inactive), we test to make sure that the window has been 
01295     activated before considering taking any special actions.
01296     */
01297     
01298     hdlaboutrecord hc = aboutdata;
01299     Rect r;
01300     
01301     ccunblockmsg (); /*any mouse click re-enables background messages*/
01302     
01303     if ((**hc).flbigwindow) {
01304         
01305         if (ccgettextitemrect (urlitem, &r) && pointinrect (pt, r)) {
01306             
01307             if (trackicon (r, &ccdrawurlitem))
01308                 if (!ccrunurlscript ())
01309                     sysbeep ();
01310             
01311             return (true);
01312             }
01313         }
01314 
01315     if (ccgetagentpopuprect (&r)) { /*see if click is in agents popup*/
01316         
01317         if (pointinrect (pt, r)) { /*click in agents popup*/
01318             
01319             --r.top;
01320             
01321             if (ccagentpopuphit (r, pt))
01322                 ccdrawagentpopup ();
01323             
01324             return (true);
01325             }
01326         }
01327     
01328     return (true);
01329     } /*aboutmousedown*/
01330 
01331 
01332 static boolean aboutkeystroke (void) {
01333 
01334     char chkb = keyboardstatus.chkb;
01335 
01336     if (chkb == chenter)
01337         aboutzoom (aboutwindowinfo, true);
01338 
01339     return (true);
01340     } /*aboutkeystroke*/
01341 
01342 
01343 #ifndef version42orgreater
01344 
01345 static void drawtextitem (WindowPtr w, short item, short font, short size, short style) {
01346     
01347     Rect ritem;
01348     bigstring bsitem;
01349     
01350     getdialogtext ((DialogPtr) w, item, bsitem);
01351     
01352     dialoggetobjectrect ((DialogPtr) w, item, &ritem);
01353     
01354     edittextbox (bsitem, ritem, font, size, style);
01355     } /*drawtextitem*/
01356 
01357 
01358 static boolean runurlscript () {
01359 
01360     bigstring bsurl;
01361     bigstring bsscript;
01362     //this is a problem. aboutwindow is a window
01363     getdialogtext ((DialogPtr) aboutwindow, urlitem, bsurl);
01364     
01365     if (!getsystemtablescript (idopenurlscript, bsscript))
01366         return (false);
01367     
01368     parsedialogstring (bsscript, bsurl, nil, nil, nil, bsscript);
01369     
01370     return (processrunstring (bsscript));
01371     } /*runurlscript*/
01372 
01373 
01374 static void drawurlitem (boolean flpressed) {
01375     
01376     RGBColor rgb = {0, 0, 0};
01377     
01378     if (flpressed)
01379         rgb.red = 0xA000;   
01380     else
01381         rgb.blue = 0xA000;
01382     
01383     pushforecolor (&rgb);
01384     
01385     drawtextitem (aboutwindow, urlitem, geneva, 9, underline);
01386     
01387     popforecolor ();
01388     } /*drawurlitem*/
01389 
01390 
01391 #define aboutresnumber 128 /*the id of the various "about" resources*/
01392 
01393 static void drawabout (WindowPtr w, boolean flliveurl) { 
01394 
01395     /*
01396     10/18/91 DW: color!
01397     
01398     10/18/91 DW: added PICT #128 to shell..rsrc.
01399     
01400     12/19/91 dmb: use version resource instead of buildinfo routine
01401     */
01402     
01403     /*draw the icon*/ {
01404         
01405         Rect rcicn;
01406         
01407         dialoggetobjectrect (w, iconitem, &rcicn);
01408         
01409         ploticon (&rcicn, aboutresnumber);
01410         }
01411     
01412     drawtextitem (w, userlanditem, systemFont, 12, 0);
01413     
01414     drawtextitem (w, sloganitem, helv, 9, 0);
01415     
01416     drawtextitem (w, copyrightitem, helv, 9, 0);
01417     
01418     if (flliveurl)
01419         drawurlitem (false);
01420     else
01421         drawtextitem (w, urlitem, helv, 9, 0);
01422     
01423     #if __powerc
01424     
01425         drawtextitem (w, nativeitem, helv, 9, 0);
01426     
01427     #else
01428     
01429         drawtextitem (w, emulateditem, helv, 9, 0);
01430     
01431     #endif
01432     
01433     /*draw the version string*/ {
01434     
01435         Rect ritem;
01436         
01437         bigstring bsbuildinfo;
01438         
01439         filegetprogramversion (bsbuildinfo);
01440         
01441         setfontsizestyle (geneva, 9, normal);
01442         
01443         dialoggetobjectrect (w, versionitem, &ritem);
01444         
01445         movepento (ritem.right - stringpixels (bsbuildinfo), ritem.bottom - 6);
01446     
01447         pendrawstring (bsbuildinfo);
01448         }
01449     } /*drawabout*/
01450 
01451 
01452 static void updateabout (WindowPtr w, boolean flliveurl) {
01453     
01454     shellupdatenow (w);
01455     } /*updateabout*/
01456 
01457 
01458 static boolean abouteventhook (EventRecord *ev, WindowPtr w) {
01459     
01460     if (w != aboutwindow) /*don't hook if not our dialog*/
01461         return (true);
01462     
01463     if ((*ev).what == updateEvt)
01464         updateabout (w, false);
01465     
01466     return (false); /*don't process this event any further*/
01467     } /*abouteventhook*/
01468 
01469 #endif
01470 
01471 
01472 static boolean aboutsave (ptrfilespec fs, hdlfilenum fnum, short rnum, boolean flsaveas, boolean flrunnable) {
01473 
01474     hdlwindowinfo hinfo;
01475     
01476     if (ccfindrootwindow (&hinfo)) {
01477         
01478         shellpushglobals ((**hinfo).macwindow);
01479         
01480         grayownedwindows (shellwindow);
01481         
01482         ccsavefile (fs, fnum, rnum, flsaveas, flrunnable);
01483         
01484         shellpopglobals ();
01485         }
01486     
01487     return (true);
01488     } /*aboutsave*/
01489 
01490 
01491 static boolean aboutclose (void) {
01492     
01493     if (!(**aboutdata).flbootsplash && (cancoonglobals != nil)) {
01494         
01495         attachabout ();
01496         
01497         ccsubwindowclose (aboutwindowinfo, ixaboutinfo);
01498         
01499         detachabout ();
01500         }
01501     
01502     aboutwindow = nil;
01503     
01504     return (true);
01505     } /*aboutclose*/
01506 
01507 
01508 static boolean aboutdisposerecord (void) {
01509     
01510     disposehandle ((Handle) aboutdata);
01511     
01512     aboutdata = nil;
01513     
01514     displayedaboutdata = nil;
01515     
01516     aboutport = nil;
01517 
01518     return (true);
01519     } /*aboutdisposerecord*/
01520 
01521 
01522 static boolean aboutsetsuperglobals (void) {
01523     
01524     hdlwindowinfo hinfo;
01525     
01526     if (ccfindrootwindow (&hinfo)) {
01527         
01528         shellpushglobals ((**hinfo).macwindow);
01529         
01530         ccsetsuperglobals ();
01531         
01532         shellpopglobals ();
01533         }
01534     
01535     return (true);
01536     } /*aboutsetsuperglobals*/
01537 
01538 
01539 static void aboutwindowsetup (void) {
01540     
01541     /*
01542     5.0a2 dmb: while we're grabbing out font settings from the root, 
01543     also steal the old flbigwindow flag
01544     */
01545     
01546     register hdlwindowinfo hw = aboutwindowinfo;
01547     tycancoonwindowinfo windowinfo;
01548     
01549     // get bigwindow setting from current root
01550     (**aboutdata).flbigwindow = (cancoonglobals == nil) || (**cancoonglobals).flbigwindow;
01551     
01552     (**aboutdata).flextrastats = flsessionstats; //optionkeydown ();
01553     
01554     if (attachabout ()) {
01555         
01556         shellpushrootglobals (aboutwindow);
01557 
01558         ccgetwindowinfo (ixaboutinfo, &windowinfo);
01559         
01560         (**hw).defaultfont = windowinfo.fontnum;
01561         
01562         (**hw).defaultsize = windowinfo.fontsize;
01563         
01564         windowinfo.w = aboutwindow;
01565         
01566         ccsetwindowinfo (ixaboutinfo, windowinfo);
01567         
01568         shellpopglobals ();
01569 
01570         detachabout ();
01571         }
01572     } /*aboutwindowsetup*/
01573 
01574 
01575 static boolean newaboutwindow (boolean flbootsplash) {
01576     
01577     /*
01578     5.0.2b20 dmb: don't reset window pos for negative values
01579     */
01580     
01581     WindowPtr w;
01582     hdlwindowinfo hw;
01583     bigstring bstitle;
01584     Rect rzoom, rwindow;
01585     hdlaboutrecord hdata;
01586     short ixaboutconfig;
01587     
01588     if (!newclearhandle (sizeof (tyaboutrecord), (Handle *) &hdata))
01589         return (false);
01590     
01591     shellfindcallbacks (idaboutconfig, &ixaboutconfig);
01592     
01593     if (flbootsplash) {
01594         
01595         globalsarray [ixaboutconfig].config.templateresnum = 131;//config.fldialog
01596         
01597         (**hdata).flbootsplash = true;
01598         }
01599     else
01600         globalsarray [ixaboutconfig].config.templateresnum = 129; //restore
01601     
01602     // get bigwindow setting with current root
01603 //  (**hdata).flbigwindow = (cancoonglobals == nil) || (**cancoonglobals).flbigwindow;
01604     
01605     ccgetwindowrect (ixaboutinfo, &rwindow);
01606     
01607 //  if (rwindow.top <= 0 || rwindow.left <= 0)
01608 //      rwindow.top = -1;
01609     
01610     getsystemoriginrect (&rzoom);
01611     
01612     //  getstringlist (aboutlistnumber, abouttitlestring, bstitle);
01613     copystring (aboutstrings [frontieritem], bstitle);
01614     
01615     if (!flbootsplash)
01616         insertstring (BIGSTRING ("\x06" "About "), bstitle);    /* 2006-02-04 aradke: eliminated titleitem */
01617     
01618     if (!newchildwindow (idaboutconfig, nil, &rwindow, &rzoom, bstitle, &w)) {
01619         
01620         disposehandle ((Handle) hdata);
01621         
01622         return (false);
01623         }
01624     
01625     #if TARGET_API_MAC_CARBON == 1
01626     
01627         SetThemeWindowBackground (w, kThemeBrushModelessDialogBackgroundActive, false);
01628     
01629     #endif
01630     
01631     getwindowinfo (w, &hw);
01632     
01633     (**hw).hdata = (Handle) hdata;
01634     
01635     shellpushglobals (w);
01636     
01637     aboutwindowsetup ();
01638     
01639     aboutresetrects (hw);
01640     
01641     if (!flbootsplash) {
01642         
01643         aboutresizeafterfontchange ();
01644         
01645         aboutsetconfigminimum ();
01646         }
01647     
01648     shellpopglobals ();
01649     
01650     windowzoom (w);
01651     
01652     return (true);
01653     } /*newaboutwindow*/
01654 
01655 
01656 boolean aboutcommand (void) {
01657     
01658     hdlwindowinfo hinfo;
01659     
01660     if (findaboutwindow (&hinfo)) {
01661         
01662         shellbringtofront (hinfo);
01663         
01664         return (true);
01665         }
01666     
01667     return (newaboutwindow (false));
01668     } /*aboutcommand*/
01669 
01670 
01671 void aboutsetstatsflag (boolean fl) {
01672     hdlwindowinfo hinfo;
01673     WindowPtr w;
01674     flsessionstats = fl;
01675 
01676     if (findaboutwindow (&hinfo)) {
01677         
01678         aboutwindowinfo = hinfo;
01679 
01680         aboutdata = (hdlaboutrecord)(**aboutwindowinfo).hdata;
01681 
01682         if (aboutdata != nil)
01683             (**aboutdata).flextrastats = fl;
01684 
01685         w = (**hinfo).macwindow;
01686     
01687         aboutresetrects (hinfo);
01688 
01689         shellpushglobals (w);
01690 
01691         aboutsetsize();
01692     
01693         shellpopglobals ();
01694         }
01695         
01696     } /*aboutsetstatsflag*/
01697 
01698 
01699 boolean aboutstart (void) {
01700     
01701     /*
01702     set up callback routines record, and link our data into the shell's 
01703     data structure.
01704     */
01705     
01706     ptrcallbacks aboutcallbacks;
01707     register ptrcallbacks cb;
01708     static boolean aboutstarted = false;
01709     
01710     if (aboutstarted)
01711         return (true);
01712     
01713     aboutstarted = true;
01714     
01715     shellnewcallbacks (&aboutcallbacks);
01716     
01717     cb = aboutcallbacks; /*copy into register*/
01718     
01719     loadconfigresource (idaboutconfig, &(*cb).config);
01720     
01721     (*cb).configresnum = idaboutconfig;
01722         
01723     (*cb).windowholder = &aboutwindow;
01724     
01725     (*cb).dataholder = (Handle *) &aboutdata;
01726     
01727     (*cb).infoholder = &aboutwindowinfo;
01728     
01729     (*cb).setglobalsroutine = &attachabout;
01730     
01731     (*cb).saveroutine = &aboutsave;
01732     
01733     (*cb).disposerecordroutine = &aboutdisposerecord;
01734     
01735     (*cb).closeroutine = &aboutclose;
01736     
01737     (*cb).gettargetdataroutine = &aboutgettargetdata;
01738     
01739     (*cb).updateroutine = &aboutupdate;
01740     
01741 //  (*cb).activateroutine = &aboutactivate;
01742     
01743     (*cb).mouseroutine = &aboutmousedown;
01744     
01745     (*cb).keystrokeroutine = &aboutkeystroke;
01746     
01747 //  (*cb).adjustcursorroutine = &aboutadjustcursor;
01748     
01749 //  (*cb).msgroutine = &aboutmsg;
01750     
01751     (*cb).resetrectsroutine = &aboutresetrects;
01752     
01753     (*cb).fontroutine = &aboutsetfont;
01754     
01755     (*cb).sizeroutine = &aboutsetsize;
01756     
01757     (*cb).styleroutine = &aboutsetstyle;
01758     
01759     (*cb).zoomwindowroutine = &aboutzoom;
01760     
01761     (*cb).setsuperglobalsroutine = &aboutsetsuperglobals;
01762     
01763     return (true);
01764     } /*aboutstart*/
01765 
01766 
01767 boolean openabout (boolean flzoom, long ctreservebytes) {
01768 #pragma unused(flzoom)
01769 
01770     /*
01771     2.1b5 dmb: added ctreservebytes parameter. of non-zero, caller wants us to 
01772     reserve space in the heap below the dialog record (during initialization)
01773     */
01774     
01775     hdlwindowinfo hinfo;
01776     
01777 #ifdef MACVERSION
01778     Ptr ptemp = nil;
01779     
01780     if (ctreservebytes > 0)
01781         ptemp = NewPtr (ctreservebytes); /*force about window to load high*/
01782 #endif
01783 
01784     aboutstart ();
01785     
01786     shellpatchnilroutines ();
01787     
01788 //  aboutwindow = newmodaldialog (128, -1);
01789     newaboutwindow (true);
01790     
01791     if (findaboutwindow (&hinfo))
01792     {
01793         shellupdatenow ((**hinfo).macwindow);
01794         //Code change by Timothy Paustian 10/5/00
01795         //We need to flush the about window to the screen
01796         //safe because this routine only gets call during init. 
01797         #if TARGET_API_MAC_CARBON == 1
01798         QDFlushPortBuffer(GetWindowPort((**hinfo).macwindow), nil);
01799         #endif
01800     }
01801 #ifdef MACVERSION
01802     if (ptemp != nil)
01803         DisposePtr (ptemp); /*restore heap space for remaining code segments*/
01804 #endif
01805     
01806     aboutopenticks = gettickcount ();
01807     
01808     return (true);
01809     } /*openabout*/
01810 
01811 
01812 void closeabout (boolean flzoom, short minticks) {
01813 #pragma unused(flzoom)
01814 
01815     hdlwindowinfo hinfo;
01816     
01817     if (findaboutwindow (&hinfo)) {
01818     
01819         delayticks (aboutopenticks + minticks - gettickcount ());
01820         
01821         shellclose ((**hinfo).macwindow, false);
01822         }
01823     } /*closeabout*/
01824 

Generated on Wed May 31 18:19:38 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6