progressbar.c

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

Generated on Wed May 31 18:20:00 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6