shellwindow.c

Go to the documentation of this file.
00001 
00002 /*  $Id: shellwindow.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 #include "frontier.h"
00029 #include "standard.h"
00030 
00031 #include "memory.h"
00032 #include "bitmaps.h"
00033 #include "font.h"
00034 #include "kb.h"
00035 #include "launch.h"
00036 #include "quickdraw.h"
00037 #include "search.h"
00038 #include "strings.h"
00039 #include "frontierwindows.h"
00040 #include "frontierconfig.h"
00041 #include "scrollbar.h"
00042 #include "zoom.h"
00043 #include "file.h"
00044 #include "resources.h"
00045 #include "shell.h"
00046 #include "shellbuttons.h"
00047 #include "shellhooks.h"
00048 #include "shellundo.h"
00049 #include "shellprivate.h"
00050 #include "lang.h"
00051 #include "langinternal.h"
00052 #include "tablestructure.h"
00053 #include "cancoon.h"
00054 
00055 #ifdef WIN95VERSION
00056 #include "FrontierWinMain.h"
00057 #endif
00058 
00059 
00060 
00061 #ifdef xxxWIN95VERSION
00062     static byte bschangedwindowsuffix [] = "\x02" " *";
00063 #endif
00064 
00065 
00066 static hdlwindowinfo hfirstwindow = nil; /*head of the window list*/
00067 
00068 
00069 
00070 void shellwindowinval (hdlwindowinfo hinfo) {
00071     
00072     windowinval ((**hinfo).macwindow);
00073     } /*shellwindowinval*/
00074     
00075     
00076 void shellinvalcontent (hdlwindowinfo hinfo) {
00077     
00078     //Code change by Timothy Paustian Monday, August 21, 2000 4:31:49 PM
00079     //Must pass a CGrafPtr to pushport on OS X to avoid a crash
00080     CGrafPtr    thePort;
00081     #if TARGET_API_MAC_CARBON == 1
00082     thePort = GetWindowPort((**hinfo).macwindow);
00083     #else
00084     thePort = (CGrafPtr)(**hinfo).macwindow;
00085     #endif
00086         
00087     pushport (thePort);
00088     
00089     smashrect ((**hinfo).contentrect);
00090     
00091     popport ();
00092     } /*shellinvalcontent*/
00093 
00094 
00095 boolean shellrectneedsupdate (const Rect *r) {
00096 
00097     hdlregion rgn = (**shellwindowinfo).drawrgn;
00098     
00099     if (rgn == nil)
00100         return (false);
00101     
00102 //  #if WIN95VERSION
00103 //      return (true);  // *** cover bug
00104 //  #endif
00105 
00106     return (rectinregion (*r, (**shellwindowinfo).drawrgn)); 
00107     } /*shellrectneedsupdate*/
00108 
00109 
00110 boolean shellgetgrowiconrect (hdlwindowinfo hinfo, Rect *r) {
00111     
00112     if (config.flgrowable) {
00113     
00114         *r = (**hinfo).growiconrect;
00115         
00116         return (true);
00117         }
00118     
00119     return (false);
00120     } /*shellgetgrowiconrect*/
00121 
00122 
00123 void shelldrawgrowicon (hdlwindowinfo hinfo) {
00124 
00125 #   ifdef MACVERSION
00126 #       if TARGET_API_MAC_CARBON == 1
00127 #           pragma unused (hinfo)
00128 
00129     return;
00130 
00131 #   else
00132             
00133             Rect r;
00134             
00135             if (shellgetgrowiconrect (hinfo, &r)) {
00136                 
00137                 register WindowPtr w = (**hinfo).macwindow;
00138                 boolean flnoframe; // 5.0a3 dmb: should add new config flag
00139                 
00140                 //Code change by Timothy Paustian Monday, August 21, 2000 4:31:49 PM
00141                 //Must pass a CGrafPtr to pushport on OS X to avoid a crash
00142                 {
00143                 CGrafPtr    thePort;
00144                 #if TARGET_API_MAC_CARBON == 1
00145                 thePort = GetWindowPort(w);
00146                 #else
00147                 thePort = (CGrafPtr)w;
00148                 #endif
00149                     
00150                 pushport (thePort);
00151                 }
00152                 
00153                 flnoframe = (**hinfo).configresnum == idaboutconfig;
00154                 
00155                 if (flnoframe)
00156                     insetrect (&r, 1, 1); /*don't wan't to erase its frame*/
00157                 
00158                 pushclip (r);
00159                 
00160                 if ((**hinfo).flwindowactive)
00161                     DrawGrowIcon (w);
00162                 
00163                 else {
00164                     
00165                     if (!flnoframe) {
00166                     
00167                         framerect (r);
00168                         
00169                         insetrect (&r, 1, 1); /*don't wan't to erase its frame*/
00170                         }
00171                     
00172                     eraserect (r);
00173                     }
00174                 
00175                 validrect (r);
00176                 
00177                 popclip ();
00178                 
00179                 popport ();
00180                 }
00181         #endif
00182     #endif
00183 
00184     } /*shelldrawgrowicon*/
00185 
00186 
00187 void shellerasegrowicon (hdlwindowinfo hinfo) {
00188     
00189     Rect r;
00190     
00191     if (shellgetgrowiconrect (hinfo, &r)) 
00192         eraserect (r);
00193     } /*shellerasegrowicon*/
00194 
00195 
00196 boolean getwindowinfo (WindowPtr w, hdlwindowinfo *hinfo) {
00197     
00198     register hdlwindowinfo h;
00199     
00200     *hinfo = nil;
00201     
00202     if (w == nil) /*defensive driving*/
00203         return (false);
00204     
00205     *hinfo = h = (hdlwindowinfo) getwindowrefcon (w);
00206 
00207     return (h != nil);
00208     } /*getwindowinfo*/
00209 
00210 
00211 boolean isshellwindow (WindowPtr wptr) {
00212     
00213     /*
00214     return true if the indicated window is one of our windows, owned by 
00215     the shell.  see comments in frontshellwindow below.
00216     
00217     note: another method traverse our window list looking for a match
00218     
00219     3/26/93 dmb: that's really the best method, clean & reasonably fast.
00220     */
00221     
00222     register WindowPtr w = wptr;
00223     register hdlwindowinfo nomad;
00224     
00225     if (w == nil)
00226         return (false);
00227     
00228 #ifdef MACVERSION
00229     //Code change by Timothy Paustian Saturday, April 29, 2000 11:12:22 PM
00230     //Changed to Opaque call for Carbon
00231     if(GetWindowKind(w) <= 0)
00232         return false;
00233     //old code
00234     //if ((*(WindowPeek) w).windowKind <= 0)
00235     //  return (false);
00236 #endif
00237     
00238     nomad = hfirstwindow;
00239     
00240     if (nomad == nil)
00241         return (false);
00242     
00243     while (true) {
00244         
00245         if ((**nomad).macwindow == (WindowPtr) w)
00246             return (true);
00247         
00248         nomad = (**nomad).nextwindow;
00249         
00250         if (nomad == hfirstwindow) /*wrapped around, didn't find it*/
00251             return (false);
00252         }
00253 
00254     } /*isshellwindow*/
00255 
00256 
00257 boolean isfilewindow (WindowPtr w) {
00258     
00259     /*
00260     return true if the indicated window is a file window -- a root 
00261     window. this routine could also be called isrootwindow
00262     */
00263     
00264     hdlwindowinfo hinfo;
00265     
00266     if (!getwindowinfo (w, &hinfo))
00267         return (false);
00268     
00269     return ((**hinfo).parentwindow == nil);
00270     } /*isfilewindow*/
00271 
00272 
00273 boolean frontshellwindow (WindowPtr *wptr) {
00274     
00275     /*
00276     built to return the front window even when a modal dialog box is the
00277     front window.  we chase through the Mac's window list looking for a 
00278     window with a non-nil refcon field.  we assume (perhaps foolishly?)
00279     that the only windows we will encounter are ones of our own creation.
00280     
00281     this can be a problem when all our windows are hidden.
00282     
00283     7/27/90 dmb: can't assume non-nil refcon is ours...  test for 
00284     a comm event with a null event.
00285     
00286     12/28/90 dmb: also need to check windowKind
00287     */
00288 
00289     register WindowPtr w;
00290     
00291     for (w = getfrontwindow (); w != nil; w = getnextwindow (w)) {
00292         
00293         if (isshellwindow ((WindowPtr) w)) {
00294             
00295             *wptr = (WindowPtr) w;
00296             
00297             return (true);
00298             }
00299         }
00300     
00301     *wptr = nil; /*fell off the end of the list*/
00302     
00303     return (false);
00304     } /*frontshellwindow*/
00305 
00306 
00307 boolean shellfindwindow (short id, WindowPtr *w, hdlwindowinfo *hinfo, Handle *hdata) {
00308     
00309     /*
00310     find the window that has a config id equal to the indicated id.
00311     
00312     return all three records -- its window, its info record and a handle to its data.
00313 
00314     5.1.5 dmb: out callers expect hidden windows to be found. so we can't walk 
00315     the window manager's list. so the result may not be he fontmost. but our callers
00316     are all one-of-a-kind
00317     */
00318 
00319     register hdlwindowinfo h = hfirstwindow;
00320     
00321     if (h == nil) /*no windows open*/
00322         return (false);
00323     
00324     while (true) {
00325         
00326         if ((**h).configresnum == id) {
00327             
00328             *w = (**h).macwindow;
00329             
00330             *hinfo = h;
00331             
00332             *hdata = (**h).hdata;
00333             
00334             return (true);
00335             }
00336         
00337         h = (**h).nextwindow; /*nomad might have been dealloc'd already*/
00338         
00339         if (h == hfirstwindow) /*wrapped around to head of list*/
00340             return (false);
00341         } /*while*/
00342     } /*shellfindwindow*/
00343 
00344 
00345 boolean getfrontwindowinfo (hdlwindowinfo *hinfo) {
00346     
00347     /*
00348     get the windowinfo record for the frontmost window.
00349     */
00350     
00351     WindowPtr w;
00352     
00353     if (!frontshellwindow (&w))
00354         return (false);
00355     
00356     return (getwindowinfo (w, hinfo));
00357     } /*getfrontwindowinfo*/
00358     
00359 
00360 boolean shellgetglobalwindowrect (hdlwindowinfo hinfo, Rect *r) {
00361     
00362     return (getglobalwindowrect ((**hinfo).macwindow, r));
00363     } /*shellgetglobalwindowrect*/
00364     
00365     
00366 boolean shellgetwindowrect (hdlwindowinfo hinfo, Rect *r) {
00367     
00368     if (hinfo == nil)
00369         return (false);
00370         
00371 #ifdef MACVERSION
00372     
00373     //Code change by Timothy Paustian Saturday, April 29, 2000 11:16:53 PM
00374     //Changed to Opaque call for Carbon
00375     #if ACCESSOR_CALLS_ARE_FUNCTIONS == 1
00376     {
00377     CGrafPtr    thePort = GetWindowPort((**hinfo).macwindow);
00378     GetPortBounds(thePort, r);
00379     }
00380     #else
00381     //old code
00382     *r = (*(**hinfo).macwindow).portRect; 
00383     #endif
00384 #endif
00385 
00386 #ifdef WIN95VERSION
00387     
00388     GetClientRect ((**hinfo).macwindow, r);
00389 #endif
00390 
00391     return (true);
00392     } /*shellgetwindowrect*/
00393     
00394 
00395 boolean shellgetwindowcenter (hdlwindowinfo hinfo, Rect *rcenter) {
00396     
00397     Rect r;
00398     
00399     shellgetglobalwindowrect (hinfo, &r); 
00400     
00401     zerorect (rcenter); /*we zoom from a point*/
00402     
00403     centerrect (rcenter, r);
00404     
00405     return (true);
00406     } /*shellgetwindowcenter*/
00407 
00408 
00409 hdlfilenum windowgetfnum (WindowPtr w) {
00410     
00411     hdlwindowinfo hinfo;
00412     
00413     if (!getwindowinfo (w, &hinfo))
00414         return (0);
00415         
00416     return ((**hinfo).fnum);
00417     } /*windowgetfnum*/
00418 
00419 
00420 void windowsetfnum (WindowPtr w, hdlfilenum fnum) {
00421     
00422     hdlwindowinfo hinfo;
00423     
00424     if (!getwindowinfo (w, &hinfo))
00425         return;
00426     
00427     (**hinfo).fnum = fnum;
00428     } /*windowsetfnum*/
00429 
00430 
00431 short windowgetrnum (WindowPtr w) {
00432     
00433     hdlwindowinfo hinfo;
00434     
00435     if (!getwindowinfo (w, &hinfo))
00436         return (0);
00437         
00438     return ((**hinfo).rnum);
00439     } /*windowgetrnum*/
00440 
00441 
00442 void windowsetrnum (WindowPtr w, short rnum) {
00443     
00444     hdlwindowinfo hinfo;
00445     
00446     if (!getwindowinfo (w, &hinfo))
00447         return;
00448     
00449     (**hinfo).rnum = rnum;
00450     } /*windowsetrnum*/
00451     
00452     
00453 short windowgetvnum (WindowPtr w) {
00454     
00455     hdlwindowinfo hinfo;
00456     
00457     if (!getwindowinfo (w, &hinfo))
00458         return (0);
00459     
00460 #ifdef MACVERSION
00461     return ((**hinfo).fspec.vRefNum);
00462 #endif
00463 
00464 #ifdef WIN95VERSION
00465     return -1; // *** need new field?
00466 #endif
00467     } /*windowgetvnum*/
00468     
00469     
00470 boolean windowsetfspec (WindowPtr w, tyfilespec *fspec) {
00471 
00472     hdlwindowinfo hinfo;
00473     bigstring bstitle;
00474     
00475     if (!getwindowinfo (w, &hinfo))
00476         return (false);
00477     
00478     (**hinfo).fspec = *fspec;
00479     
00480     getfsfile (fspec, bstitle);
00481     
00482     shellsetwindowtitle (hinfo, bstitle); // 7.24.97 dmb: was windowsettitle
00483 
00484     return (true);
00485     } /*windowsetfspec*/
00486     
00487 
00488 boolean windowgetfspec (WindowPtr w, tyfilespec *fspec) {
00489 
00490     /*
00491     6.18.97 dmb: return boolean value indicating whether or not the
00492     fspec actually points to an existing file
00493     */
00494     
00495     hdlwindowinfo hinfo;
00496     long vnum;
00497     boolean flfolder;
00498     
00499     clearbytes (fspec, sizeof (tyfilespec));
00500     
00501     if (!getwindowinfo (w, &hinfo))
00502         return (false);
00503     
00504     *fspec = (**hinfo).fspec;
00505     
00506     if (!getfsvolume (fspec, &vnum)) //don't allow default vol to satisfy fileexists
00507         return (false);
00508     
00509     return (fileexists (fspec, &flfolder));
00510     } /*windowgetfspec*/
00511 
00512 
00513 boolean windowgetpath (WindowPtr w, bigstring bspath) {
00514     
00515     tyfilespec fs;
00516     
00517     if (!windowgetfspec (w, &fs))
00518         return (false);
00519     
00520     return (filespectopath (&fs, bspath));
00521     } /*windowgetpath*/
00522 
00523 
00524 #ifndef version42orgreater
00525 
00526 // dmb 12/17/96: it's not clear that any of the resource saving
00527 // code should be used any more. font/size and window positioning
00528 // information should be stored in the op or wp data files directly.
00529 
00530 boolean shellsavewindowresource (WindowPtr wptr, ptrfilespec fspec, short rnum) {
00531     
00532     /*
00533     save information about the window's size and position in the 
00534     wpos resource in the given file.
00535     */
00536     
00537     register WindowPtr w = wptr;
00538     hdlwindowinfo hinfo;
00539     register hdlwindowinfo h;
00540     tywindowposition wpos;
00541     
00542     if (!getwindowinfo (w, &hinfo)) /*defensive driving*/
00543         return (false);
00544     
00545     h = hinfo; /*copy into register*/
00546     
00547     wpos = (**h).wpos; /*copy from window data structure*/
00548     
00549     getscrollbarinfo ((**h).vertscrollbar, &wpos.vertmin, &wpos.vertmax, &wpos.vertcurrent);
00550     
00551     getscrollbarinfo ((**h).horizscrollbar, &wpos.horizmin, &wpos.horizmax, &wpos.horizcurrent);
00552     
00553     wpos.configresnum = (**h).configresnum;
00554     
00555     getglobalwindowrect (w, &wpos.windowrect);
00556     
00557     wpos.flhidden = (**h).flhidden;
00558     
00559     (**h).wpos = wpos; /*copy it back into the window data structure*/
00560     
00561     return (saveresource (fspec, rnum, 'wpos', 128, nil, sizeof (wpos), &wpos));
00562     } /*shellsavewindowresource*/
00563 
00564 
00565 boolean shellsavewindowposition (WindowPtr wptr) {
00566     
00567     /*
00568     save information about the window's size and position in the 
00569     wpos resource in the file.
00570     */
00571     
00572     register WindowPtr w = wptr;
00573     tyfilespec fspec;
00574     
00575     if (windowgetfnum (w) == 0) /*no file to save window info into*/
00576         return (false);
00577     
00578     windowgetfspec (w, &fspec);
00579     
00580     return (shellsavewindowresource (w, &fspec, windowgetrnum (w)));
00581     } /*shellsavewindowposition*/
00582 
00583 
00584 boolean shellsavefontresource (WindowPtr w, ptrfilespec fspec, short rnum) {
00585     
00586     hdlwindowinfo hinfo;
00587     register hdlwindowinfo h;
00588     tysavedfont savedfont;
00589     register long len;
00590     
00591     if (!getwindowinfo (w, &hinfo)) /*defensive driving*/
00592         return (false);
00593     
00594     h = hinfo; /*copy into register*/
00595     
00596     fontgetname ((**h).defaultfont, savedfont.fontname);
00597     
00598     savedfont.fontsize = (**h).defaultsize;
00599     
00600     savedfont.fontstyle = (**h).defaultstyle;
00601     
00602     len = sizeof (savedfont) - sizeof (bigstring) + stringlength (savedfont.fontname) + 1;
00603     
00604     return (saveresource (fspec, rnum, 'styl', 128, nil, len, &savedfont));
00605     } /*shellsavefontresource*/
00606 
00607 
00608 boolean shellsavedefaultfont (register WindowPtr w) {
00609     
00610     tyfilespec fspec;
00611     
00612     if (windowgetfnum (w) == 0) /*no file to save window info into*/
00613         return (false);
00614     
00615     windowgetfspec (w, &fspec);
00616     
00617     return (shellsavefontresource (w, &fspec, windowgetrnum (w)));
00618     } /*shellsavedefaultfont*/
00619 
00620 #endif  // MACVERSION
00621 
00622 
00623 boolean loadwindowposition (ptrfilespec fspec, short rnum, tywindowposition *wpos) {
00624     
00625     return (loadresource (fspec, rnum, 'wpos', 128, nil, sizeof (tywindowposition), wpos, resourcefork)); /* 2005-09-02 creedon - added support for fork parameter, see resources.c: openresourcefile and pushresourcefile */ 
00626     } /*loadwindowposition*/
00627 
00628 
00629 boolean loaddefaultfont (WindowPtr w) {
00630 
00631     hdlwindowinfo hinfo;
00632     register hdlwindowinfo h;
00633     tyfilespec fspec;
00634     tysavedfont savedfont;
00635     short fontnum;
00636     long resourceSize;
00637     if (!getwindowinfo (w, &hinfo)) /*defensive driving*/
00638         return (false);
00639     
00640     h = hinfo; /*copy into register*/
00641     
00642     if ((**h).fnum == 0) /*no file to save font info into*/
00643         return (false);
00644     
00645     windowgetfspec (w, &fspec);
00646     
00647     //bug notice by Timothy Paustian Friday, May 19, 2000 1:03:18 PM
00648     //the size of a style resource in the root in not the size of the savedfont
00649     //type. savedfont is 260 while the resource is 11 in the root. 
00650     //I think a more insidious problem was that the sizeof() was returning
00651     //a short that was not being picked up right when run under spotlight. 
00652     //This may be a spotlight bug though.
00653     resourceSize = sizeof (savedfont);
00654     if (!loadresource (&fspec, (short) (**h).rnum, 'styl', 128, nil, resourceSize, &savedfont, resourcefork)) { /* 2005-09-02 creedon - added support for fork parameter, see resources.c: openresourcefile and pushresourcefile */
00655         
00656         (**h).defaultfont = config.defaultfont;
00657         
00658         (**h).defaultsize = config.defaultsize;
00659         
00660         (**h).defaultstyle = config.defaultstyle;
00661         
00662         return (false);
00663         }
00664         
00665     (**h).defaultsize = savedfont.fontsize;
00666     
00667     (**h).defaultstyle = savedfont.fontstyle;
00668     
00669     fontgetnumber (savedfont.fontname, &fontnum);
00670     
00671     (**h).defaultfont = fontnum;
00672     
00673     return (true);
00674     } /*loaddefaultfont*/
00675 
00676 
00677 void getdefaultwindowrect (Rect *rdefault) {
00678     
00679     hdlwindowinfo hinfo;
00680     Rect r;
00681     register short height, width;
00682     Rect rfront;
00683     Rect rdesktop;
00684     register short h, v;
00685     
00686 #ifdef MACVERSION
00687     #if TARGET_API_MAC_CARBON == 1
00688         {
00689         BitMap  screenBits;
00690         GetQDGlobalsScreenBits(&screenBits);
00691         rdesktop = r = screenBits.bounds;
00692         }
00693         #else
00694         rdesktop = r = qd.screenBits.bounds;
00695     #endif
00696         
00697 #endif
00698 
00699 #ifdef WIN95VERSION
00700     getglobalwindowrect (shellframewindow, &rdesktop);
00701 
00702     r = rdesktop;
00703 #endif
00704     
00705     width = r.right - r.left;
00706     
00707     height = r.bottom - r.top;
00708     
00709     r.left += (width / 6);
00710     
00711     r.right -= (width / 6);
00712     
00713     r.top += height / 7;
00714     
00715     r.bottom = r.top + (height / 3);
00716     
00717     *rdefault = r;
00718     
00719     if (!getfrontwindowinfo (&hinfo)) /*no front window to position relative to*/
00720         return;
00721     
00722     shellgetglobalwindowrect (hinfo, &rfront);
00723     
00724     h = rfront.left + 12;
00725     
00726     v = rfront.top + 12;
00727     
00728     offsetrect (&r, h - r.left, v - r.top);
00729     
00730     if (issubrect (r, rdesktop))
00731         *rdefault = r;
00732     } /*getdefaultwindowrect*/
00733 
00734 
00735 void shellcalcgrowiconrect (Rect rwholewindow, hdlwindowinfo hinfo) {
00736 
00737     Rect r = rwholewindow;
00738     register short scrollbarwidth;
00739     
00740     scrollbarwidth = getscrollbarwidth ();
00741     
00742     r.left = r.right - scrollbarwidth;
00743     
00744     r.top = r.bottom - scrollbarwidth;
00745     
00746     offsetrect (&r, 1, 1);
00747     
00748     (**hinfo).growiconrect = r;
00749     } /*shellcalcgrowiconrect*/
00750 
00751 
00752 void shellresetwindowrects (hdlwindowinfo hinfo) {
00753     
00754     /*
00755     resize all the rectangles stored in the window's information record.
00756     
00757     dmb 10/24/90: on entry, buttons rect is now already cleared, and the 
00758     contentrect is initialized to the portrect
00759     
00760     7.0b26 PBS: tweaks for having a message area but no horizontal scrollbar.
00761     */
00762     
00763     register hdlwindowinfo h;
00764     register short messagewidth;
00765     register short scrollbarwidth;
00766     Rect messagerect;
00767     Rect rwholewindow;
00768     Rect r;
00769     Rect buttonsrect;
00770     
00771     h = hinfo; /*copy into register*/
00772     
00773     scrollbarwidth = getscrollbarwidth ();
00774     
00775     rwholewindow = (**h).contentrect;
00776     
00777     r = rwholewindow;
00778     
00779     if (config.flvertscroll) /*leave room for vertical scrollbar*/
00780         r.right -= scrollbarwidth;
00781     
00782     if (config.flhorizscroll || config.flmessagearea) /*leave room for horiz scrollbar*/ /*7.0b26 PBS: leave room for msg, even if no scrollbar.*/
00783         r.bottom -= scrollbarwidth;
00784     
00785     if ((shellglobals.buttonlist != nil) && (!(**h).flhidebuttons)) { /*window type has attached button list*/
00786         
00787         shellgetbuttonsrect (h, &buttonsrect);
00788         
00789         if (config.flvertscroll)
00790             buttonsrect.right -= scrollbarwidth - 1;
00791         
00792         r.top = buttonsrect.bottom;
00793         
00794         (**h).buttonsrect = buttonsrect;
00795         }
00796     
00797     if (config.flinsetcontentrect)
00798         insetrect (&r, 3, 3);
00799     
00800     (**h).contentrect = r;
00801     
00802     if (config.flgrowable)
00803         shellcalcgrowiconrect (rwholewindow, h);
00804     
00805     if (config.flmessagearea) {
00806         
00807         r = rwholewindow;
00808         
00809         //if (config.flhorizscroll) 
00810         
00811             messagewidth = (r.right - r.left - scrollbarwidth) / config.messageareafraction;
00812         
00813         //else
00814         
00815             //messagewidth = (r.right - r.left); /*7.0b26 PBS: if no horiz scrollbar, message gets entire space.*/
00816         
00817         messagerect.top = r.bottom - scrollbarwidth + 1;
00818         
00819         messagerect.left = r.left - 1;
00820         
00821         messagerect.bottom = r.bottom + 1;
00822         
00823         messagerect.right = r.left + messagewidth;      
00824         }
00825     else {
00826     
00827         messagewidth = 0;
00828         
00829         clearbytes (&messagerect, sizeof (messagerect));
00830         }
00831         
00832     (**h).messagerect = messagerect;
00833     
00834     if (config.flvertscroll) { /*position the vertical scrollbar*/
00835         
00836         register hdlscrollbar scrollbar = (**h).vertscrollbar;
00837         
00838         r = rwholewindow; 
00839     
00840         r.bottom -= scrollbarwidth - 1;
00841         
00842         scrollbarflushright (r, scrollbar);
00843         }
00844         
00845     if (config.flhorizscroll) { /*position the horizontal scrollbar*/
00846     
00847         register hdlscrollbar scrollbar = (**h).horizscrollbar;
00848         
00849         r = rwholewindow; 
00850     
00851         r.right -= scrollbarwidth - 2;
00852     
00853         r.left += messagewidth - 1; /*leave room for the message area*/
00854     
00855         scrollbarflushbottom (r, scrollbar);
00856         }
00857     } /*shellresetwindowrects*/
00858 
00859 
00860 void windowresetrects (hdlwindowinfo hinfo) {
00861     
00862     /*
00863     (re)initialize all of the rectangles stored in the window's information 
00864     record.  start by clearing the buttons rect and setting the content rect 
00865     to be the owning window's portrect.  the resetwindowrects callback routine 
00866     is responsible for:
00867         1.  adjust the contentrect, if necessary
00868         2.  setting the buttons rect, if used
00869         3.  positioning any scrollbars
00870         4.  setting up the grow box rect
00871     */
00872     
00873     register hdlwindowinfo h = hinfo;
00874     
00875     // (**h).contentrect = (*(**h).macwindow).portRect;
00876     
00877     getlocalwindowrect((**h).macwindow, &(**h).contentrect);
00878     
00879     zerorect (&(**h).buttonsrect); /*fill with zeros*/
00880     
00881     (*shellglobals.resetrectsroutine) (h);
00882     } /*windowresetrects*/
00883 
00884 
00885 boolean emptywindowlist (void) {
00886     
00887     return (hfirstwindow == nil);
00888     } /*emptywindowlist*/
00889             
00890     
00891 short countwindowlist (void) {
00892     
00893     /*
00894     return the number of windows in the window list.
00895     */
00896     
00897     register hdlwindowinfo nomad, firstnomad, nextnomad;
00898     register short ct;
00899     
00900     nomad = hfirstwindow;
00901     
00902     if (nomad == nil) /*special case for empty list*/
00903         return (0);
00904     
00905     firstnomad = nomad;
00906     
00907     ct = 1; /*at least one element in the list*/
00908     
00909     while (true) {
00910     
00911         nextnomad = (**nomad).nextwindow;
00912         
00913         if (nextnomad == firstnomad) /*reached the end of the list*/
00914             return (ct);
00915             
00916         ct++;
00917         
00918         nomad = nextnomad;
00919         } /*while*/
00920     } /*countwindowlist*/
00921     
00922 
00923 boolean indexwindowlist (short windownumber, hdlwindowinfo *hwindow) {
00924     
00925     /*
00926     finds the nth window in the window list.  n is 1-based.
00927     
00928     return false if there aren't that many windows.
00929     */
00930     
00931     register hdlwindowinfo nomad, firstnomad, nextnomad;
00932     register short i, ct;
00933     
00934     *hwindow = nil;
00935     
00936     nomad = hfirstwindow;
00937     
00938     if (nomad == nil) /*special case for empty list*/
00939         return (false);
00940     
00941     firstnomad = nomad;
00942     
00943     ct = windownumber - 1; /*iterate n - 1 times*/
00944     
00945     for (i = 1; i <= ct; i++) {
00946     
00947         nextnomad = (**nomad).nextwindow;
00948         
00949         if (nextnomad == firstnomad) /*reached the end of the list, element doesn't exist*/
00950             return (false);
00951             
00952         nomad = nextnomad;
00953         } /*while*/
00954     
00955     *hwindow = nomad; /*loop terminated, it actually has that many elements*/
00956     
00957     return (true);
00958     } /*indexwindowlist*/
00959 
00960 
00961 /*3/1/91 dmb: unused
00962 
00963 boolean firstrootwindow (hdlwindowinfo *hinfo) {
00964     
00965     /%
00966     a root window is one with no parent.  we travel through the window
00967     list and return the info record for the first such window.
00968     
00969     return false if there aren't any root windows;
00970     %/
00971     
00972     *hinfo = hfirstwindow; /%start search with first window%/
00973     
00974     return (nextrootwindow (hinfo));
00975     } /%firstrootwindow%/
00976     
00977 
00978 boolean nextrootwindow (hdlwindowinfo *hinfo) {
00979     
00980     /%
00981     a root window is one with no parent.  we travel through the window
00982     list and return the info record for the next such window.
00983     
00984     return false if there aren't any root windows;
00985     %/
00986     
00987     register hdlwindowinfo nomad = *hinfo;
00988     register hdlwindowinfo firstnomad = nomad;
00989     register hdlwindowinfo nextnomad;
00990     
00991     if (nomad == nil) /%empty list, no more root windows%/
00992         return (false);
00993     
00994     while (true) { /%check each node in the window list%/
00995         
00996         if ((**nomad).parentwindow == nil) { /%a root window%/
00997             
00998             *hinfo = nomad;
00999             
01000             return (true);
01001             }
01002     
01003         nextnomad = (**nomad).nextwindow;
01004         
01005         if (nextnomad == hfirstwindow) { /%reached end of list, no more root windows%/
01006             
01007             *hinfo = nil;
01008             
01009             return (false);
01010             }
01011             
01012         nomad = nextnomad;
01013         } /%while%/
01014     } /%nextrootwindow%/
01015 
01016 
01017 boolean visitrootwindows (boolean (*visit) ()) {
01018     
01019     hdlwindowinfo nomad;
01020     
01021     if (!firstrootwindow (&nomad))
01022         return (false);
01023         
01024     while (true) {
01025         
01026         if (!(*visit) (nomad))
01027             return (true);
01028         
01029         nomad = (**nomad).nextwindow;
01030         
01031         if (nomad == hfirstwindow) /%wrapped around to head of list%/
01032             return (true);
01033         
01034         if (!nextrootwindow (&nomad)) /%finished visiting%/
01035             return (true);
01036         } /%while%/
01037     } /%visitrootwindows%/
01038 */
01039 
01040 
01041 boolean getrootwindow (WindowPtr w, hdlwindowinfo *hrootinfo) {
01042 
01043     hdlwindowinfo hinfo;
01044     register hdlwindowinfo nomad, nextnomad;
01045     
01046     if (!getwindowinfo (w, &hinfo))
01047         return (false);
01048         
01049     nomad = hinfo;
01050     
01051     while (true) { /*traverse the parent links, if any*/
01052         
01053         nextnomad = (**nomad).parentwindow;
01054         
01055         if (nextnomad == nil) { /*at a root window*/
01056             
01057             *hrootinfo = nomad;
01058             
01059             return (true);
01060             }
01061         
01062         nomad = nextnomad; /*keep traversing for the root*/
01063         } /*while*/
01064     } /*getrootwindow*/
01065     
01066     
01067 boolean frontrootwindow (hdlwindowinfo *hrootinfo) {
01068 
01069     /*
01070     a root window is one with no parent.  we look at the frontmost window, and
01071     if it's a root window, return its info record handle.
01072     
01073     otherwise we return a handle to the first root window we encounter traversing
01074     the parent links of the info record.
01075     
01076     10/3/92 dmb: try to handle case where user hides all windows
01077     */
01078     
01079     WindowPtr w;
01080     
01081     if (!frontshellwindow (&w)) { /*none of our windows are open*/
01082         
01083         if (hfirstwindow == nil)
01084             return (false);
01085         
01086         w = (**hfirstwindow).macwindow; /*it's hidden, but it's the first window opened*/
01087         }
01088     
01089     return (getrootwindow (w, hrootinfo));
01090     } /*frontrootwindow*/
01091 
01092 
01093 WindowPtr shellnextwindow (WindowPtr pwindow) {
01094     
01095     /*
01096     return the next window in the system window list that is a 
01097     shell window, or nil.
01098     */
01099     
01100     register WindowPtr w = pwindow;
01101     
01102     while (true) {
01103         
01104         w = getnextwindow (w); /*advance to next window in the list*/
01105         
01106         if (w == nil) /*no more window in the list*/
01107             break;
01108         
01109         if (isshellwindow (w))
01110             break;
01111         }
01112     
01113     return (w);
01114     } /*shellnextwindow*/
01115 
01116 
01117 boolean shellvisitwindowlayer (shellwindowvisitcallback visit, ptrvoid refcon) {
01118     
01119     /*
01120     visits all windows in front to back order.  to do this, we must use 
01121     the OS's window list, since ours has no particular order
01122     
01123     if the visit routine returns false, we return false immediately.  if all
01124     visits returned true, we return true.
01125     */
01126     
01127     register WindowPtr w;
01128     
01129     w = getfrontwindow ();
01130     
01131     while (w != nil) {
01132         
01133         if (isshellwindow (w))
01134             if (!(*visit) (w, refcon))
01135                 return (false);
01136         
01137         w = shellnextwindow (w); /*advance to next window in the list*/
01138         }
01139     
01140     return (true);
01141     } /*shellvisitwindowlayer*/
01142 
01143 
01144 boolean visitownedwindows (WindowPtr w, short id, shellwindowvisitcallback visit, ptrvoid refcon) {
01145     
01146     /*
01147     w should be a root window, one whose parent is nil.
01148     
01149     we call the visit routine for each window whose root window is w whose type
01150     equals the indicated id.  if id == -1 then we visit all owned windows,
01151     regardless of type.
01152     
01153     if the visit routine returns false, we return false immediately.  if all
01154     visits returned true, we return true.
01155     */
01156     
01157     register hdlwindowinfo nomad = hfirstwindow;
01158     hdlwindowinfo hparentinfo;
01159     
01160     if (!getwindowinfo (w, &hparentinfo))
01161         return (false);
01162     
01163     while (true) {
01164         
01165         hdlwindowinfo nextnomad = (**nomad).nextwindow;
01166         hdlwindowinfo hinfo;
01167         
01168         if (getrootwindow ((**nomad).macwindow, &hinfo)) {
01169             
01170             if (hinfo == hparentinfo)
01171                 
01172                 if (((**nomad).configresnum == id) || (id == -1))
01173             
01174                     if (!(*visit) ((**nomad).macwindow, refcon))
01175                         return (false);
01176             }
01177             
01178         nomad = nextnomad; /*nomad might have been dealloc'd already*/
01179         
01180         if (nomad == hfirstwindow) /*wrapped around to head of list*/
01181             return (true);
01182         } /*while*/
01183     } /*visitownedwindows*/
01184     
01185     
01186 boolean shellvisittypedwindows (short id, shellwindowvisitcallback visit, ptrvoid refcon) {
01187     
01188     /*
01189     visit all windows whose configresum equals id.  
01190     
01191     to visit all windows, set id to -1.
01192     
01193     if the visit routine returns false, we return false immediately.  if all
01194     visits returned true, we return true.
01195     */
01196     
01197     register hdlwindowinfo nomad = hfirstwindow;
01198     
01199     if (nomad == nil) /*no windows open*/
01200         return (true);
01201         
01202     while (true) {
01203         
01204         hdlwindowinfo nextnomad = (**nomad).nextwindow;
01205         
01206         if (((**nomad).configresnum == id) || (id == -1)) {
01207             
01208             if (!(*visit) ((**nomad).macwindow, refcon))
01209                 return (false);
01210             }
01211         
01212         nomad = nextnomad; /*nomad might have been dealloc'd already*/
01213         
01214         if (nomad == hfirstwindow) /*wrapped around to head of list*/
01215             return (true);
01216         } /*while*/
01217     } /*shellvisittypedwindows*/
01218 
01219 
01220 static boolean counttypedvisit (WindowPtr w,  ptrvoid refcon) {
01221 #pragma unused(w)
01222 
01223     (*(short *)refcon)++;
01224     
01225     return (true);
01226     } /*counttypedvisit*/
01227 
01228 
01229 short counttypedwindows (short id) {
01230     
01231     short windowcount = 0;
01232     
01233     shellvisittypedwindows (id, &counttypedvisit, &windowcount);
01234     
01235     return (windowcount);
01236     } /*counttypedwindows*/
01237 
01238 
01239 typedef struct finddatainfo {
01240     
01241     Handle hdata;
01242     
01243     hdlwindowinfo hinfo;
01244     } tyfinddatainfo;
01245 
01246 
01247 static boolean shellfinddatavisit (WindowPtr w, ptrvoid refcon) {
01248     
01249     tyfinddatainfo *findinfo = (tyfinddatainfo *) refcon;
01250     hdlwindowinfo hinfo;
01251     
01252     if (getwindowinfo (w, &hinfo)) {
01253         
01254         if ((**hinfo).hdata == (*findinfo).hdata) { /*found the handle we're looking for*/
01255             
01256             (*findinfo).hinfo = hinfo;
01257             
01258             return (false);
01259             }
01260         }
01261     
01262     return (true);
01263     } /*shellfinddatavisit*/
01264 
01265 
01266 boolean shellfinddatawindow (Handle hdata, hdlwindowinfo *hinfo) {
01267     
01268     /*
01269     search the window list looking for a window that has the indicated data
01270     handle linked into it.  return true if such a window was found, false
01271     otherwise.
01272     */
01273     
01274     tyfinddatainfo findinfo;
01275 
01276     if (hdata == nil)
01277         return (false);
01278 
01279     findinfo.hdata = hdata;
01280     
01281     findinfo.hinfo = nil;
01282     
01283     shellvisittypedwindows (-1, &shellfinddatavisit, &findinfo);
01284     
01285     *hinfo = findinfo.hinfo;
01286     
01287     return (findinfo.hinfo != nil);
01288     } /*shellfinddatawindow*/
01289 
01290 
01291 typedef struct findfileinfo {
01292     
01293     ptrfilespec fsfind;
01294     
01295     WindowPtr wfound;
01296     } tyfindfileinfo;
01297 
01298 
01299 static boolean shellfindfilevisit (WindowPtr w, ptrvoid refcon) {
01300     
01301     /*
01302     if the filespec for the given window is the one we're
01303      looking for, select that window and stop visiting
01304     */
01305     
01306     tyfindfileinfo *findinfo = (tyfindfileinfo *) refcon;
01307     tyfilespec fs;
01308     
01309     windowgetfspec (w, &fs);
01310     
01311     if (equalfilespecs ((*findinfo).fsfind, &fs)) {
01312         
01313         (*findinfo).wfound = w;
01314         
01315         return (false);
01316         }
01317     
01318     return (true);
01319     } /*shellfindfilevisit*/
01320 
01321 
01322 WindowPtr shellfindfilewindow (ptrfilespec fs) {
01323     
01324     /*
01325     4.1b7 dmb: return the window of the root who's fspec
01326     matches fs, nil if not found.
01327     */
01328     
01329     tyfindfileinfo findinfo;
01330     
01331     findinfo.fsfind = fs;
01332     
01333     if (!shellvisittypedwindows (idcancoonconfig, &shellfindfilevisit, &findinfo))
01334         return (findinfo.wfound);
01335     
01336     return (nil);
01337     } /*shellfindfilewindow*/
01338 
01339 
01340 typedef struct findtitleinfo {
01341     
01342     ptrstring pwindowtitle;
01343     
01344     hdlwindowinfo *hinfo;
01345     } tyfindtitleinfo;
01346 
01347 
01348 static boolean findpathvisit (WindowPtr w, ptrvoid refcon) {
01349     
01350     tyfindtitleinfo *findinfo = (tyfindtitleinfo *) refcon;
01351     bigstring bs;
01352     
01353     if (windowgetpath (w, bs) && equalidentifiers (bs, (*findinfo).pwindowtitle)) { /*found it -- set values and terminate visit*/
01354         
01355         getwindowinfo (w, (*findinfo).hinfo);
01356         
01357         return (false);
01358         }
01359     
01360     return (true); /*keep visiting*/
01361     } /*findpathvisit*/
01362 
01363 
01364 static boolean findtitlevisit (WindowPtr w, ptrvoid refcon) {
01365     
01366     tyfindtitleinfo *findinfo = (tyfindtitleinfo *) refcon;
01367     hdlwindowinfo hinfo;
01368     bigstring bs;
01369     
01370     getwindowinfo (w, &hinfo);
01371 
01372     shellgetwindowtitle (hinfo, bs); // 7.24.97 dmb: was windowgettitle
01373     
01374     if (equalidentifiers (bs, (*findinfo).pwindowtitle)) { /*found it -- set values and terminate visit*/
01375         
01376         *(*findinfo).hinfo = hinfo;
01377         
01378         return (false);
01379         }
01380     
01381     return (true); /*keep visiting*/
01382     } /*findtitlevisit*/
01383 
01384 
01385 boolean shellfindnamedwindow (const bigstring bsname, hdlwindowinfo *hinfo) {
01386     
01387     /*
01388     7.2.97 dmb: find the window whose title or file path is bsname
01389     */
01390     
01391     tyfindtitleinfo findinfo;
01392     
01393     *hinfo = nil; /*default return if not found*/
01394     
01395     findinfo.pwindowtitle = (ptrstring) bsname; /*so visit routine can see it*/
01396     
01397     findinfo.hinfo = hinfo; /*so visit routine can set it*/
01398     
01399     if (shellvisittypedwindows (-1, &findpathvisit, &findinfo) &&
01400         shellvisittypedwindows (-1, &findtitlevisit, &findinfo))
01401         
01402         return (false);
01403 
01404     return (*hinfo != nil);
01405     } /*shellfindnamedwindow*/
01406 
01407 
01408 #if isFrontier
01409 
01410 boolean shellclosedatawindow (Handle hdata) {
01411     
01412     hdlwindowinfo hinfo;
01413     
01414     if (!shellfinddatawindow (hdata, &hinfo)) /*easy - already closed*/
01415         return (true);
01416     
01417     return (shellclosewindow ((**hinfo).macwindow));
01418     } /*shellclosedatawindow*/
01419 
01420 #endif
01421 
01422 
01423 boolean shellfirstchildwindow (hdlwindowinfo hparent, hdlwindowinfo *hchild) {
01424     
01425     /*
01426     return the first window in the window list whose parent is hparent.
01427     
01428     return true if we found one, false otherwise.
01429     */
01430     
01431     register hdlwindowinfo nomad = hfirstwindow;
01432     register hdlwindowinfo firstnomad = nomad;
01433     
01434     if (nomad == nil) /*an empty list*/
01435         return (false);
01436         
01437     while (true) {
01438         
01439         if ((**nomad).parentwindow == hparent) {    
01440             
01441             *hchild = nomad;
01442             
01443             return (true);
01444             }
01445             
01446         nomad = (**nomad).nextwindow;
01447         
01448         if (nomad == firstnomad) /*cycled around*/
01449             return (false);
01450         } /*while*/
01451     } /*shellfirstchildwindow*/
01452 
01453 
01454 static boolean graywindowvisit (WindowPtr w, ptrvoid refcon) {
01455 #pragma unused (refcon)
01456 
01457     graywindow (w);
01458     
01459     return (true);
01460     } /*graywindowvisit*/
01461 
01462 
01463 void grayownedwindows (WindowPtr w) {
01464     
01465     graywindow (w);
01466     
01467     visitownedwindows (w, -1, &graywindowvisit, nil);
01468     } /*grayownedwindows*/
01469     
01470 
01471 static void insertwindowlist (hdlwindowinfo hwindow) {
01472 
01473     /*
01474     link the window in at the end of the window list.
01475     
01476     if the list is empty (hfirstwindow == nil) then set up a one-window
01477     list.
01478     
01479     the list is circular and doubly linked.
01480     */
01481     
01482     register hdlwindowinfo hprev;
01483     
01484     shellwindowmenudirty ();
01485     
01486     if (hfirstwindow == nil) { /*no windows open -- this is the first window*/
01487     
01488         hfirstwindow = hwindow; /*doubly linked and circular list*/
01489         
01490         (**hwindow).nextwindow = hwindow;
01491         
01492         (**hwindow).prevwindow = hwindow;
01493         
01494         return;
01495         }
01496     
01497     hprev = (**hfirstwindow).prevwindow; /*link into a non-empty list*/
01498     
01499     (**hprev).nextwindow = hwindow;
01500     
01501     (**hwindow).prevwindow = hprev;
01502     
01503     (**hwindow).nextwindow = hfirstwindow;
01504     
01505     (**hfirstwindow).prevwindow = hwindow; /*new window becomes last in list*/
01506     } /*insertwindowlist*/
01507 
01508 
01509 static void unlinkwindowlist (hdlwindowinfo hwindow) {
01510 
01511     /*
01512     unlink the window from the window list.
01513     
01514     if it's the only window, indicate that the list is now empty.
01515     
01516     if it's the first window, unlink it and set hfirstwindow to point at
01517     the next window.
01518     */
01519 
01520     hdlwindowinfo hnext, hprev;
01521     
01522     hnext = (**hwindow).nextwindow;
01523     
01524     if (hnext == nil) //not in window list anymore
01525         return;
01526     
01527     (**hwindow).nextwindow = nil; //mark as not being in list
01528     
01529     shellwindowmenudirty ();
01530     
01531     if (hnext == hwindow) { /*one-element list*/
01532         
01533         hfirstwindow = nil; /*the list is now empty*/
01534         
01535         return;
01536         }
01537         
01538     hprev = (**hwindow).prevwindow; /*unlink from a >1 element list*/
01539     
01540     (**hprev).nextwindow = hnext;
01541     
01542     (**hnext).prevwindow = hprev;
01543     
01544     if (hfirstwindow == hwindow)
01545         hfirstwindow = hnext;
01546     } /*unlinkwindowlist*/
01547 
01548 
01549 static void enforceminimumsize (Rect *rwindow) {
01550     
01551     /*
01552     be sure the window rect is at least as large as config's rmin
01553     */
01554     
01555     register Rect *r = rwindow;
01556     register short minwidth, minheight;
01557     
01558     minwidth = config.rmin.right - config.rmin.left;
01559     
01560     minheight = config.rmin.bottom - config.rmin.top;
01561     
01562     (*r).right = max ((*r).right, (*r).left + minwidth);
01563     
01564     (*r).bottom = max ((*r).bottom, (*r).top + minheight);
01565     } /*enforceminimumsize*/
01566 
01567 
01568 static void constrainwindowrect (WindowPtr w, Rect *rwindow) {
01569     
01570     /*
01571     make sure the rectangle is visible within the current desktop.
01572     
01573     then make sure it's at least the minimum required size for a 
01574     window, according to the current config record.
01575     
01576     9/27/91 dmb: now take window parameter and pass through to constraintodesktop
01577     
01578     2.1b2 dmb: contrain top-right of window to a particular screen, 
01579     supplementing desktop bounds constraint
01580     
01581     2.1b5 dmb: no; if top right of window isn't visible on its screen after 
01582     desktop constraint, constrain the entire window to its screen
01583     */
01584     
01585     Rect r, rmin;
01586     
01587     r = *rwindow; /*copy into a local*/
01588     
01589     constraintodesktop (w, &r);
01590     
01591     /*make sure top-right corner (zoom box) is accessable*/
01592     
01593     setrect (&rmin, r.top, r.right - 50, r.top + 5, r.right);
01594     
01595     if (constraintoscreenbounds (w, false, &rmin))
01596         constraintoscreenbounds (w, false, &r);
01597     
01598     /*be sure the rect is at least as large as config's rmin*/
01599     
01600     enforceminimumsize (&r);
01601     
01602     *rwindow = r; /*copy back into parameter*/
01603     } /*constrainwindowrect*/
01604 
01605 
01606 void disposeshellwindowinfo (hdlwindowinfo hinfo) {
01607     
01608     /*
01609     10/5/92 dmb: dispose hundostring (fixes small memory leak)
01610     
01611     4.1b1 dmb: new name; public; take card of window list here
01612     
01613     5.1.3 dmb: handle nil hinfo
01614     */
01615     
01616     register hdlwindowinfo h = hinfo;
01617     
01618     if (h == nil)
01619         return;
01620     
01621     unlinkwindowlist (h);
01622     
01623     disposehandle ((Handle) (**h).hmessagestring);
01624     
01625     disposehandle ((Handle) (**h).hundostring);
01626     
01627     disposescrollbar ((**h).vertscrollbar);
01628     
01629     disposescrollbar ((**h).horizscrollbar);
01630     
01631     disposeundostack ((hdlundostack) (**h).hundostack);
01632     
01633     disposeundostack ((hdlundostack) (**h).hredostack);
01634     
01635     disposehandle ((Handle) (**h).hwindowtitle);
01636 
01637     disposehandle ((Handle) h);
01638     } /*disposeshellwindowinfo*/
01639 
01640 
01641 boolean defaultselectioninfo (hdlwindowinfo hinfo) {
01642     
01643     /*
01644     6/28/91 dmb: now use union for style to make things a lot easier
01645     */
01646     
01647     register hdlwindowinfo hw = hinfo;
01648     tyselectioninfo x;
01649     
01650     clearbytes (&x, sizeof (x)); /*initialize all fields to zero*/
01651     
01652     x.flcansetfont = true;
01653     
01654     x.flcansetsize = true;
01655     
01656     x.flcansetstyle = true;
01657     
01658     x.fontnum = (**hw).defaultfont; 
01659     
01660     x.fontsize = (**hw).defaultsize; 
01661     
01662     x.fontstyle = (**hw).defaultstyle;
01663     
01664     (**hw).selectioninfo = x;
01665     
01666     return (true);
01667     } /*defaultselectioninfo*/
01668     
01669 
01670 boolean newshellwindowinfo (WindowPtr w, hdlwindowinfo *hinfo) {
01671     
01672     /*
01673     4.1b1 dmb: new name; public; take card of window list here
01674     */
01675     
01676     hdlwindowinfo h;
01677     hdlundostack hundostack;
01678     hdlstring htitle;
01679     
01680     if (!newclearhandle (sizeof (tywindowinfo), (Handle *) hinfo))
01681         return (false);
01682     
01683     h = *hinfo;
01684     
01685     setwindowrefcon (w, (long) h); /*window points at info structure*/
01686     
01687     (**h).macwindow = w; /*the pointing is mutual*/
01688     
01689     insertwindowlist (h);
01690     
01691     if (!newundostack (&hundostack))
01692         goto error;
01693     
01694     (**h).hundostack = (Handle) hundostack;
01695     
01696     if (!newundostack (&hundostack))
01697         goto error;
01698     
01699     (**h).hredostack = (Handle) hundostack;
01700     
01701     if (!newheapstring (zerostring, &htitle))
01702         goto error;
01703     
01704     (**h).hwindowtitle = htitle;
01705 
01706     return (true);
01707     
01708     error:
01709     
01710         disposeshellwindowinfo (h);
01711         
01712         return (false);
01713     } /*newshellwindowinfo*/
01714 
01715 
01716 boolean newshellwindow (WindowPtr *wnew, hdlwindowinfo *hnew, tywindowposition *wpos) {
01717     
01718     register WindowPtr w;
01719     register hdlwindowinfo hinfo = nil;
01720     hdlscrollbar vertbar = nil, horizbar = nil;
01721 #ifdef WIN95VERSION
01722     tyconfigrecord origconfig = config;
01723     tyshellglobals origglobals = shellglobals;
01724     GrafPtr saveport = getport ();
01725 #endif
01726     
01727     w = getnewwindow (config.templateresnum, config.fldialog, &(*wpos).windowrect);
01728     
01729 #ifdef WIN95VERSION
01730     config = origconfig;
01731     shellglobals = origglobals;
01732     setport (saveport);
01733 #endif
01734     
01735     *wnew = w; /*copy into returned value*/
01736     
01737     if (w == nil) 
01738         return (false);
01739     
01740     if (!newshellwindowinfo (w, hnew))
01741         goto error;
01742     
01743     hinfo = *hnew; /*copy into register*/
01744     
01745     (**hinfo).defaultfont = config.defaultfont;
01746     
01747     (**hinfo).defaultsize = config.defaultsize;
01748     
01749     (**hinfo).defaultstyle = config.defaultstyle;
01750     
01751     (**hinfo).processid = getcurrentprocessid ();
01752 
01753     defaultselectioninfo (hinfo);
01754     
01755     if (config.flvertscroll) {
01756         
01757         if (!newscrollbar (w, true, &vertbar)) 
01758             goto error;
01759         
01760         (**hinfo).vertscrollbar = vertbar;
01761         }
01762     
01763     if (config.flhorizscroll) {
01764         
01765         if (!newscrollbar (w, false, &horizbar)) 
01766             goto error;
01767             
01768         (**hinfo).horizscrollbar = horizbar;
01769         }
01770     
01771     return (true);
01772     
01773     error: /*goto here on an error, everything that's been allocated gets deallocated*/
01774     
01775     disposeshellwindowinfo (hinfo);
01776     
01777     if (w != nil)
01778         disposewindow (w);
01779     
01780     return (false);
01781     } /*newshellwindow*/
01782 
01783     
01784 boolean newfilewindow (ptrfilespec fspec, hdlfilenum fnum, short rnum, boolean flhidden, WindowPtr *wnew) { 
01785     
01786     /*
01787     create a new window to display the contents of a file.
01788     
01789     12/1/92 dmb: if we're passed a full path and zero vnum, get vnum from path
01790     
01791     2.1b2 dmb: updated for filespecs
01792     */
01793     
01794     register WindowPtr w;
01795     register hdlwindowinfo hinfo;
01796     register hdlscrollbar vertbar, horizbar;
01797     hdlwindowinfo hwindowinfo = nil;
01798     tywindowposition wpos;
01799     bigstring bspath;
01800     
01801     // 5.6.97 dmb: calc wpos first, and pass it to newshellwindow
01802 
01803     if ((fnum == 0) || !loadwindowposition (fspec, rnum, &wpos)) {
01804         
01805         clearbytes (&wpos, sizeof (wpos));
01806         
01807     //  getdefaultwindowrect (&wpos.windowrect);
01808         wpos.windowrect = config.defaultwindowrect;
01809         
01810         wpos.configresnum = iddefaultconfig;
01811         }
01812     
01813     wpos.ctopens++; /*it's been opened one more time*/
01814     
01815     if (!newshellwindow (wnew, &hwindowinfo, &wpos))
01816         return (false);
01817     
01818     hinfo = hwindowinfo; /*copy into register*/
01819     
01820     w = *wnew; /*copy into register*/
01821     
01822     //Code change by Timothy Paustian Monday, August 21, 2000 4:31:49 PM
01823     //Must pass a CGrafPtr to pushport on OS X to avoid a crash
01824     {
01825     CGrafPtr    thePort;
01826     #if TARGET_API_MAC_CARBON == 1
01827     thePort = GetWindowPort(w);
01828     #else
01829     thePort = (CGrafPtr)w;
01830     #endif
01831         
01832     pushport (thePort);
01833     }   
01834     vertbar = (**hinfo).vertscrollbar;
01835     
01836     horizbar = (**hinfo).horizscrollbar;
01837     
01838     (**hinfo).fspec = *fspec;
01839         
01840     (**hinfo).fnum = fnum;
01841     
01842     (**hinfo).rnum = rnum;
01843     
01844     (**hinfo).wpos = wpos; /*save it so application can refer to it*/
01845     
01846     (**hinfo).configresnum = wpos.configresnum;
01847     
01848     (**hinfo).flhidden = flhidden || wpos.flhidden;
01849     
01850     getfsfile (fspec, bspath);
01851     
01852     shellsetwindowtitle (hinfo, bspath);
01853     
01854     windowresetrects (hinfo);
01855     
01856     *shellglobals.infoholder = hinfo;
01857     
01858     #ifndef version5orgreater
01859         setscrollbarinfo (vertbar, wpos.vertmin, wpos.vertmax, wpos.vertcurrent);
01860         
01861         setscrollbarinfo (horizbar, wpos.horizmin, wpos.horizmax, wpos.horizcurrent);
01862     #endif
01863     
01864     loaddefaultfont (w);
01865     
01866     popport ();
01867     
01868     return (true);
01869     } /*newfilewindow*/
01870     
01871 
01872 boolean newchildwindow (short idtype, hdlwindowinfo hparentinfo, Rect * rwindow, rectparam rzoom, bigstring bstitle, WindowPtr *wnew) {
01873     
01874     /*
01875     create a new window, and a windowinfo record linked into it.
01876     
01877     the window can be linked to a parent, hparentinfo is nil then the window is a 
01878     root, subordinate to no other window.
01879     
01880     rwindow describes the window's size and position on the desktop.
01881     
01882     rzoom is the rectangle that the window zooms from, but the zooming doesn't take
01883     place now, the rect is recorded in the windowinfo record and zooming occurs 
01884     when the application calls windowzoom.
01885     
01886     bstitle is the title of the window.  if it's nil, don't set the title.
01887     
01888     a pointer to the Macintosh window record is returned.
01889     
01890     10/29/91 dmb: only use default rect if top is -1, not any negative number
01891     
01892     10/3/92 dmb: setfontsizestyle after pushing new port
01893 
01894     5.0a8 dmb: set title at end; it can smash globals
01895 
01896     5.0a24 dmb: constrain rwindow
01897     */
01898     
01899     register hdlwindowinfo hinfo;
01900     register hdlscrollbar vertbar, horizbar;
01901     hdlwindowinfo hwindowinfo;
01902     register WindowPtr w;
01903     short ix;
01904     tyconfigrecord origconfig;
01905     tyshellglobals origglobals;
01906     register boolean fl = false;
01907     tywindowposition wpos;
01908     
01909     if (!shellfindcallbacks (idtype, &ix))
01910         return (false);
01911         
01912     origconfig = config; /*save, we'll restore later*/
01913     
01914     origglobals = shellglobals; /*save*/
01915     
01916     shellglobals = globalsarray [ix];
01917     
01918     config = shellglobals.config;
01919     
01920     // 5.6.97 dmb: calc wpos first, and pass it to newshellwindow
01921 
01922     clearbytes (&wpos, sizeof (wpos));
01923     
01924     if ((*rwindow).top != -1) { /*-1 is a signal to use default rect*/
01925         
01926         constrainwindowrect (nil, rwindow);
01927 
01928         wpos.windowrect = *rwindow;
01929         }
01930     
01931     else {
01932         hdlwindowinfo hfrontinfo;
01933         
01934         wpos.windowrect = config.defaultwindowrect;
01935         
01936         if (getfrontwindowinfo (&hfrontinfo)) {
01937             
01938             if ((**hfrontinfo).configresnum == idtype) {
01939                 
01940                 Rect wrect;
01941                 
01942                 getglobalwindowrect ((**hfrontinfo).macwindow, &wrect);
01943                 
01944                 offsetrect (&wpos.windowrect, wrect.left - wpos.windowrect.left, wrect.top - wpos.windowrect.top);
01945                 
01946                 offsetrect (&wpos.windowrect, doctitlebarheight, doctitlebarheight);
01947                 }
01948             }
01949         }
01950     
01951     wpos.configresnum = idtype;
01952     
01953     if (!newshellwindow (wnew, &hwindowinfo, &wpos))
01954         goto exit;
01955     
01956     hinfo = hwindowinfo; /*copy into register*/
01957     
01958     w = *wnew; /*copy into register*/
01959     
01960     //Code change by Timothy Paustian Monday, August 21, 2000 4:31:49 PM
01961     //Must pass a CGrafPtr to pushport on OS X to avoid a crash
01962     {
01963     CGrafPtr    thePort;
01964     #if TARGET_API_MAC_CARBON == 1
01965     thePort = GetWindowPort(w);
01966     #else
01967     thePort = (CGrafPtr)w;
01968     #endif
01969         
01970     pushport (thePort);
01971     }
01972     
01973     setfontsizestyle (config.defaultfont, config.defaultsize, config.defaultstyle);
01974     
01975     popport ();
01976     
01977     vertbar = (**hinfo).vertscrollbar; /*copy into register*/
01978     
01979     horizbar = (**hinfo).horizscrollbar; /*copy into register*/
01980     
01981     (**hinfo).parentwindow = hparentinfo;
01982     
01983     (**hinfo).configresnum = idtype;
01984     
01985     (**hinfo).wpos = wpos; /*save it so application can refer to it*/
01986     
01987     windowresetrects (hinfo);
01988     
01989     *shellglobals.infoholder = hinfo;
01990     
01991     #ifndef version42orgreater
01992         setscrollbarinfo (vertbar, wpos.vertmin, wpos.vertmax, wpos.vertcurrent);
01993         
01994         setscrollbarinfo (horizbar, wpos.horizmin, wpos.horizmax, wpos.horizcurrent);
01995     #endif
01996     
01997     (**hinfo).rzoomfrom = *rzoom; /*so that we can zoom the window later*/
01998     
01999     if (bstitle != nil) {
02000         
02001         shellsetwindowtitle (hinfo, bstitle); // 7.24.97 dmb: was windowsettitle
02002         
02003         copystring (bstitle, fsname (&(**hinfo).fspec));
02004         }
02005     
02006     fl = true;
02007     
02008     exit:
02009     
02010     config = origconfig; /*restore*/
02011     
02012     shellglobals = origglobals; /*restore*/
02013     
02014     return (fl);
02015     } /*newchildwindow*/
02016     
02017     
02018 boolean windowinit (WindowPtr w) {
02019     
02020     if (!shellpushglobals (w))
02021         return (false);
02022         
02023     if ((*shellglobals.newrecordroutine) ()) {
02024         
02025         (**shellwindowinfo).hdata = *shellglobals.dataholder; /*link data to window*/
02026         }
02027     
02028     shellpopglobals ();
02029     
02030     return (true);
02031     } /*windowinit*/
02032 
02033 
02034 boolean shellrunwindowconfirmationscript (WindowPtr pwindow, short idscript) {
02035     
02036     /*
02037     5.0a23 dmb: common code now shared by window close & window open
02038 
02039     5.1.2 dmb: better error handling
02040     */
02041     
02042     tyvaluerecord val;
02043     bigstring bsname;
02044     bigstring bsscript;
02045     bigstring bsresult;
02046     boolean fl, flscriptwasrunning;
02047     
02048     if (cancoonglobals == nil)  /*not in a position to run scripts*/
02049         return (true);
02050     
02051     if (!getsystemtablescript (idscript, bsscript))
02052         return (true);
02053     
02054     if (!setwinvalue (pwindow, &val))
02055         return (false);
02056     
02057     if (!coercetostring (&val))
02058         return (false);
02059     
02060     pullstringvalue (&val, bsname);
02061     
02062     disposevaluerecord (val, true);
02063     
02064     parsedialogstring (bsscript, bsname, nil, nil, nil, bsscript);
02065     
02066     flscriptwasrunning = flscriptrunning;
02067     
02068     flscriptrunning = false;
02069     
02070     fl = langrunstringnoerror (bsscript, bsresult);
02071     
02072     flscriptrunning = flscriptwasrunning;
02073     
02074     if (!fl) /*couldn't find/run the script*/
02075         return (true);
02076     
02077     if (equalstrings (bsresult, BIGSTRING ("\x01" "3"))) /*yes/no/cancel was cancelled*/
02078         return (false);
02079     
02080     if (equalstrings (bsresult, bsfalse))
02081         return (false);
02082     
02083     return (true);
02084     } /*shellrunwindowconfirmationscript*/
02085 
02086 
02087 boolean windowzoom (WindowPtr w) {
02088     
02089     /*
02090     after creating a new window, you may want to pick the moment when the
02091     user sees the window.  that's why we unbundled this functionality from
02092     newchildwindow.  it may be useful in other window creating operations.
02093     
02094     12/17/91 dmb: set searchparams.flwindowzoomed every time -- see tablefind.c.
02095     
02096     5.0a23 dmb: call new shellrunwindowconfirmationscript
02097     */
02098     
02099     hdlwindowinfo hinfo;
02100     register hdlwindowinfo h;
02101     
02102     if (!getwindowinfo (w, &hinfo))
02103         return (false);
02104     
02105     searchparams.flwindowzoomed = true; /*it wants to know*/
02106     
02107     h = hinfo; /*move into register*/
02108     
02109     showscrollbar ((**h).vertscrollbar); 
02110     
02111     showscrollbar ((**h).horizscrollbar); 
02112     
02113     if (!shellrunwindowconfirmationscript (w, idopenwindowscript))
02114         (**h).flhidden = true;
02115     
02116     if ((**h).rzoomfrom.top == -2) /*window is supposed to be invisible*/
02117         (**h).flhidden = true;
02118     
02119     if (!(**h).flhidden)
02120         zoomwindowfromcenter ((**h).rzoomfrom, w);
02121     
02122     /*
02123     shelldrawgrowicon (h);
02124     */
02125     
02126     return (true);
02127     } /*windowzoom*/
02128     
02129 
02130 boolean zoomfilewindow (WindowPtr w) {
02131     
02132     /*
02133     after creating a new window, you may want to pick the moment when the
02134     user sees the window.  that's why we unbundled this functionality from
02135     newfilewindow.
02136     
02137     5.0a23 dmb: call new shellrunwindowconfirmationscript
02138     */
02139     
02140     hdlwindowinfo hinfo;
02141     
02142     if (!getwindowinfo (w, &hinfo))
02143         return (false);
02144     
02145     if (!shellrunwindowconfirmationscript (w, idopenwindowscript))
02146         (**hinfo).flhidden = true;
02147     
02148     if ((**hinfo).flhidden) {
02149         
02150         #ifdef WIN95VERSION
02151             //windowsendtoback (w);
02152             windowbringtofront (getnextwindow (w));
02153         #endif
02154         }
02155     else {
02156         
02157         zoomfromorigin (w); /*zoom and then show the window*/
02158         
02159         #ifdef MACVERSION
02160             shelldrawgrowicon (hinfo);
02161             
02162             showscrollbar ((**hinfo).vertscrollbar); 
02163             
02164             showscrollbar ((**hinfo).horizscrollbar);
02165         #endif
02166         }
02167     
02168     return (true);
02169     } /*zoomfilewindow*/
02170 
02171 
02172 void shelladjustaftergrow (WindowPtr wptr) {
02173     
02174     register WindowPtr w = wptr;
02175     Rect r;
02176     hdlwindowinfo hinfo;
02177     register hdlwindowinfo h;
02178     
02179     getwindowinfo (w, &hinfo);
02180     
02181     if (hinfo != NULL) {
02182         
02183         h = hinfo; /*copy into register*/
02184         
02185         (**h).oldcontentrect = (**h).contentrect; /*some handlers need this*/
02186         
02187         if (config.fleraseonresize) {
02188             
02189             shellgetwindowrect (h, &r);
02190             
02191             //eraserect (r);
02192             smashrect (r);
02193             }
02194         
02195         shellerasegrowicon (h);
02196         
02197         shellerasemessagearea (h);
02198         
02199         windowresetrects (h);
02200         
02201         (*shellglobals.resizeroutine) ();
02202         
02203         (*shellglobals.setscrollbarroutine) ();
02204         
02205     //  shellwindowinval (h); /*force update on whole window*/
02206         
02207 //  #ifdef MACVERSION
02208         shellupdatenow (w);
02209 //  #endif
02210 
02211         //zerorect (&(**h).zoomedrect);
02212         }
02213     } /*shelladjustaftergrow*/
02214 
02215 
02216 boolean shellmoveandsizewindow (hdlwindowinfo hinfo, Rect r) {
02217     
02218     register WindowPtr w = (**hinfo).macwindow;
02219     
02220     shellpushglobals (w);
02221     
02222     constrainwindowrect (w, &r); /*make sure it isn't too big or too small*/
02223     
02224     moveandsizewindow (w, r);
02225     
02226     shelladjustaftergrow (w);
02227     
02228     shellpopglobals ();
02229     
02230     return (true);
02231     } /*shellmoveandsizewindow*/
02232 
02233 
02234 boolean shellmovewindow (hdlwindowinfo hinfo, short h, short v) {
02235     
02236     register WindowPtr w = (**hinfo).macwindow;
02237     Rect r;
02238     
02239     shellpushglobals (w);
02240     
02241     shellgetglobalwindowrect (hinfo, &r);
02242     
02243     offsetrect (&r, h - r.left, v - r.top);
02244     
02245     constrainwindowrect (w, &r); /*make sure it isn't too big or too small*/
02246     
02247     movewindow (w, r.left, r.top);
02248     
02249     shellpopglobals ();
02250     
02251     return (true);
02252     } /*shellmovewindow*/
02253 
02254 
02255 boolean shellmovewindowhidden (hdlwindowinfo hinfo, short h, short v) {
02256     
02257     register WindowPtr w = (**hinfo).macwindow;
02258     Rect r;
02259     
02260     shellpushglobals (w);
02261     
02262     shellgetglobalwindowrect (hinfo, &r);
02263     
02264     offsetrect (&r, h - r.left, v - r.top);
02265     
02266     constrainwindowrect (w, &r); /*make sure it isn't too big or too small*/
02267     
02268     movewindowhidden (w, r.left, r.top);
02269     
02270     shellpopglobals ();
02271     
02272     return (true);
02273     } /*shellmovewindowhidden*/
02274 
02275 
02276 boolean shellsizewindow (hdlwindowinfo hinfo, short h, short v) {
02277     
02278     /*
02279     9/19/91 dmb: don't resize windows that aren't growable
02280     
02281     5.0.2b16 dmb: avoid integer overflow
02282     */
02283     
02284     register WindowPtr w = (**hinfo).macwindow;
02285     Rect r;
02286     boolean fl = false;
02287     
02288     shellpushglobals (w);
02289     
02290     if (config.flgrowable) {
02291         
02292         shellgetglobalwindowrect (hinfo, &r);
02293         
02294         r.right = min ((long) r.left + h, infinity);
02295         
02296         r.bottom = min ((long) r.top + v, infinity);
02297         
02298         constrainwindowrect (w, &r); /*make sure it isn't too big or too small*/
02299         
02300         sizewindow (w, r.right - r.left, r.bottom - r.top);
02301         
02302         shelladjustaftergrow (w);
02303         
02304         fl = true;
02305         }
02306     
02307     shellpopglobals ();
02308     
02309     return (fl);
02310     } /*shellsizewindow*/
02311 
02312 
02313 boolean shellsizewindowhidden (hdlwindowinfo hinfo, short h, short v) {
02314     
02315     /*
02316     9/19/91 dmb: don't resize windows that aren't growable
02317     
02318     5.0.2b16 dmb: avoid integer overflow
02319     */
02320     
02321     register WindowPtr w = (**hinfo).macwindow;
02322     Rect r;
02323     boolean fl = false;
02324     
02325     shellpushglobals (w);
02326     
02327     if (config.flgrowable) {
02328         
02329         shellgetglobalwindowrect (hinfo, &r);
02330         
02331         r.right = min ((long) r.left + h, infinity);
02332         
02333         r.bottom = min ((long) r.top + v, infinity);
02334         
02335         constrainwindowrect (w, &r); /*make sure it isn't too big or too small*/
02336         
02337         sizewindowhidden (w, r.right - r.left, r.bottom - r.top);
02338         
02339         shelladjustaftergrow (w);
02340         
02341         fl = true;
02342         }
02343     
02344     shellpopglobals ();
02345     
02346     return (fl);
02347     } /*shellsizewindow*/
02348 
02349 
02350 boolean shellzoomwindow (hdlwindowinfo hinfo, boolean flzoomin) {
02351 #pragma unused (flzoomin)
02352 
02353     /*
02354     9/16/91 dmb: use the new getcontentsizeroutine to apply intelligent 
02355     window sizing when zooming window.
02356     
02357     9/19/91 dmb: unforce a minimum zoomed size of the title width, plus 
02358     space for the close box & zoom box.
02359     
02360     10/6/91 dmb: return false if config says it's not growable
02361     
02362     12/24/91 dmb: fixed potential integer overflow in rect calculation
02363     
02364     2.1b1 dmb: scroll everything that fits completely into view
02365     
02366     2.1b6 dmb: fixed integer overflow bug when subtracting negative 
02367     number from infinity. also, don't call constrainwindowrect here;
02368     that can limit height on account of menubar that isn't on our screen.
02369     */
02370 
02371     register hdlwindowinfo h = hinfo;
02372     register WindowPtr w = (**h).macwindow;
02373     long width, height;
02374     Rect rwindow;
02375     Rect rcontent;
02376     Rect rzoom;
02377     Rect rprevstate;
02378     boolean flscrollleft = false;
02379     boolean flscrollup = false;
02380     //boolean flzoom;
02381     //Code change by Timothy Paustian Saturday, April 29, 2000 11:23:29 PM
02382     //Changed to Opaque call for Carbon
02383 
02384     
02385 #ifdef MACVERSION
02386     Rect    rectToErase;
02387     short part;
02388     //WStateData **hstatedata;
02389     //Code change by Timothy Paustian Saturday, April 29, 2000 11:22:52 PM
02390     //Changed to Opaque call for Carbon
02391     //hstatedata = (WStateData **)GetWindowDataHandle(w);
02392     //old code
02393     //hstatedata = (WStateData **) (*(WindowPeek) w).dataHandle;
02394 
02395     //if (hstatedata == nil)
02396     //  return (false);
02397 #endif
02398     
02399     shellpushglobals (w);
02400     
02401     if (!config.flgrowable) {
02402         
02403         shellpopglobals ();
02404         
02405         return (false);
02406         }
02407     
02408     getglobalwindowrect (w, &rwindow); /*current state*/
02409     
02410 #ifdef MACVERSION
02411     //Code change by Timothy Paustian Saturday, April 29, 2000 11:30:25 PM
02412     //Changed to Opaque call for Carbon
02413     GetWindowStandardState(w, &rzoom);
02414     //old code
02415     //rzoom = (**hstatedata).stdState; /*last calculated "zoomed out" state*/
02416 #else
02417     rzoom = (**h).zoomedrect;
02418 #endif
02419 
02420 //  if (rzoom.top > 0)
02421 //      flzoom = false;
02422 //  else
02423 //      flzoom = true;
02424 
02425     rprevstate = rzoom;
02426     
02427     if ((*shellglobals.getcontentsizeroutine) (&width, &height)) { /*calculate new "zoomed out" state*/
02428         
02429         bigstring bstitle;
02430         short titlewidth;
02431         Rect rfull;
02432         
02433         pushstyle (systemFont, 12, normal);
02434         
02435         shellgetwindowtitle (shellwindowinfo, bstitle); // 7.24.97 dmb: was windowgettitle
02436         
02437         titlewidth = stringpixels (bstitle);
02438         
02439         popstyle ();
02440         
02441         rcontent = (**h).contentrect;
02442         
02443         #ifdef WIN95VERSION
02444             width += (rwindow.right - rwindow.left) - (rcontent.right - rcontent.left);
02445 
02446             height += (rwindow.bottom - rwindow.top) - (rcontent.bottom - rcontent.top);
02447         #endif
02448 
02449         width -= (rcontent.right - rcontent.left);
02450         
02451         height -= (rcontent.bottom - rcontent.top);
02452         
02453         width = min (width, (long) infinity - rwindow.right);
02454         
02455         height = min (height, (long) infinity - rwindow.bottom);
02456         
02457         rzoom = rwindow;
02458         
02459         rzoom.right = min (infinity - 6, (long) rzoom.right + width);
02460         
02461         rzoom.bottom = min (infinity - 6, (long) rzoom.bottom + height);
02462         
02463         rfull = rzoom;
02464         
02465         enforceminimumsize (&rzoom);
02466         
02467         rzoom.right = max (rzoom.right, rzoom.left + titlewidth + 64);
02468         
02469         if (keyboardstatus.floptionkey) { /*just get real big*/
02470             
02471             rzoom.right = rzoom.left + 6000;
02472             
02473             rzoom.bottom = rzoom.top + 6000;
02474             }
02475         
02476         insetrect (&rzoom, -3, -3); /*extra border*/
02477         
02478         constraintoscreenbounds (w, true, &rzoom);
02479         
02480         insetrect (&rzoom, 3, 3);
02481         
02482         if ((rfull.right - rfull.left) <= (rzoom.right - rzoom.left)) /*can fit full horiz*/
02483             flscrollleft = true;
02484         
02485         if ((rfull.bottom - rfull.top) <= (rzoom.bottom - rzoom.top)) /*can fit full vert*/
02486             flscrollup = true;
02487         
02488         #ifdef MACVERSION
02489             //Code change by Timothy Paustian Saturday, April 29, 2000 11:31:20 PM
02490             //Changed to Opaque call for Carbon
02491             SetWindowStandardState(w, &rzoom);
02492             //old code
02493             //(**hstatedata).stdState = rzoom;
02494         #else
02495             (**h).zoomedrect = rzoom;  /* 2006-03-28 SMD fixed, was rwindow */
02496         #endif
02497         }
02498     
02499     #ifdef MACVERSION
02500         if (equalrects (rwindow, rzoom)) /*we're zoomed out*/
02501             part = inZoomIn;
02502         else
02503             part = inZoomOut;
02504         //Code change by Timothy Paustian Saturday, April 29, 2000 11:25:04 PM
02505         //Changed to Opaque call for Carbon
02506         #if ACCESSOR_CALLS_ARE_FUNCTIONS == 1
02507         {
02508         CGrafPtr thePort = GetWindowPort(w);
02509         GetPortBounds(thePort, &rectToErase);
02510         eraserect (rectToErase);
02511         }
02512         #else
02513         #pragma unused(rectToErase)
02514         //old code
02515         eraserect ((*w).portRect);
02516         #endif
02517         
02518         ZoomWindow (w, part, false);
02519     
02520         shelladjustaftergrow (w);
02521         
02522         if (part == inZoomOut) {
02523             
02524             if (flscrollleft) /*can fit full horiz*/
02525                 (*shellglobals.scrollroutine) (left, false, -(**h).horizscrollinfo.cur);
02526             
02527             if (flscrollup) /*can fit full vert*/
02528                 (*shellglobals.scrollroutine) (up, false, -(**h).vertscrollinfo.cur);
02529             }
02530     #else
02531         if (!equalrects (rwindow, rzoom) || rprevstate.top == 0) { /*we're not already zoomed*/
02532 //      if (flzoom) {
02533             shellmoveandsizewindow (h, rzoom);
02534             (**h).zoomedrect = rwindow;
02535             //(**h).zoomedrect.top += 20000;
02536             }
02537         else
02538             shellmoveandsizewindow (h, rprevstate);
02539 
02540         if (flscrollleft) /*can fit full horiz*/
02541             (*shellglobals.scrollroutine) (left, false, -(**h).horizscrollinfo.cur);
02542         
02543         if (flscrollup) /*can fit full vert*/
02544             (*shellglobals.scrollroutine) (up, false, -(**h).vertscrollinfo.cur);
02545     #endif
02546     
02547     shellpopglobals ();
02548     
02549     return (true);
02550     } /*shellzoomwindow*/
02551 
02552 
02553 boolean getwindowmessage (WindowPtr w, bigstring bs) {
02554     
02555     hdlwindowinfo hinfo;
02556     register hdlstring hstring;
02557     
02558     setstringlength (bs, 0);
02559     
02560     if (!getwindowinfo (w, &hinfo))
02561         return (false);
02562         
02563     hstring = (**hinfo).hmessagestring;
02564     
02565     if (hstring != nil)
02566         copyheapstring (hstring, bs);
02567         
02568     return (true);
02569     } /*getwindowmessage*/
02570         
02571 
02572 boolean drawwindowmessage (WindowPtr wptr) {
02573 
02574     register WindowPtr w = wptr;
02575     hdlwindowinfo hinfo;
02576     register hdlwindowinfo h;
02577     Rect r;
02578     bigstring bs;
02579     
02580     if (!config.flmessagearea) /*feature wired off*/
02581         return (true);
02582     
02583     if (!getwindowinfo (w, &hinfo))
02584         return (false);
02585         
02586     h = hinfo; /*copy into register*/
02587     
02588     //Code change by Timothy Paustian Monday, August 21, 2000 4:31:49 PM
02589     //Must pass a CGrafPtr to pushport on OS X to avoid a crash
02590     {
02591     CGrafPtr    thePort;
02592     #if TARGET_API_MAC_CARBON == 1
02593     thePort = GetWindowPort(w);
02594     #else
02595     thePort = (CGrafPtr)w;
02596     #endif
02597         
02598     pushport (thePort);
02599     }
02600     
02601     r = (**h).messagerect;
02602     
02603     pushclip (r);
02604     
02605     openbitmap (r, w);
02606     
02607     eraserect (r);
02608     
02609     framerect (r);
02610     
02611     insetrect (&r, 2, 0); /*leave room for the vertical boundary lines & 1 white pixel*/
02612     
02613     if ((**h).flwindowactive) { /*only active windows display their messages*/
02614     
02615         getwindowmessage (w, bs);
02616         
02617         pushstyle (geneva, 9, 0);
02618         
02619         centerstring (r, bs);
02620         
02621         popstyle ();
02622         }
02623     
02624     closebitmap (w);
02625     
02626     popclip ();
02627     
02628     popport ();
02629     
02630     return (true);
02631     } /*drawwindowmessage*/
02632 
02633 
02634 boolean setwindowmessage (WindowPtr w, bigstring bs) {
02635     
02636     hdlwindowinfo hinfo;
02637     hdlstring hstring;
02638     register hdlstring hs;
02639     bigstring bsoldmessage;
02640     
02641     if (!getwindowinfo (w, &hinfo))
02642         return (false);
02643         
02644     hs = (**hinfo).hmessagestring;
02645     
02646     copyheapstring (hs, bsoldmessage);
02647     
02648     if (equalstrings (bsoldmessage, bs)) /*no change, save time and flicker*/
02649         return (true);
02650     
02651     disposehandle ((Handle) hs); /*get rid of the old message string*/
02652     
02653     if (stringlength (bs) == 0)
02654         hs = nil; 
02655         
02656     else {
02657         newheapstring (bs, &hstring);
02658         
02659         hs = hstring;
02660         }
02661         
02662     (**hinfo).hmessagestring = hs;
02663     
02664     return (true);
02665     } /*setwindowmessage*/
02666     
02667     
02668 boolean shellsetwindowmessage (hdlwindowinfo hinfo, bigstring bs) {
02669     
02670     return (setwindowmessage ((**hinfo).macwindow, bs));
02671     } /*shellsetwindowmessage*/
02672 
02673 
02674 boolean shelldrawwindowmessage (hdlwindowinfo hinfo) {
02675     
02676     return (drawwindowmessage ((**hinfo).macwindow));
02677     } /*shellsetwindowmessage*/
02678 
02679 
02680 boolean lockwindowmessage (WindowPtr w, boolean fllocked) {
02681     
02682     hdlwindowinfo hinfo;
02683     
02684     if (!getwindowinfo (w, &hinfo))
02685         return (false);
02686         
02687     (**hinfo).flmessagelocked = bitboolean (fllocked);
02688     
02689     return (true);
02690     } /*lockwindowmessage*/
02691 
02692 
02693 void shellerasemessagearea (hdlwindowinfo hinfo) {
02694     
02695     smashrect ((**hinfo).messagerect);
02696     } /*shellerasemessagearea*/
02697 
02698 
02699 boolean shellsetwindowchanges (hdlwindowinfo hinfo, boolean fldirty) {
02700     
02701     /*
02702     use this instead of windowsetchanges when you don't want dirtyhooks called.
02703     
02704     set the flmadechanges field of the indicated info record.
02705     
02706     if the window has a parent and we're setting the bit, set its dirty bit.
02707     */
02708     
02709     register hdlwindowinfo hw = hinfo;
02710     register boolean fl = bitboolean (fldirty);
02711     register hdlwindowinfo hparent;
02712     
02713     if (hw == nil) //defensive driving
02714         return (true);
02715     
02716     if ((**hw).flmadechanges != fl) { /*changing state*/
02717         
02718         #ifdef xxxWIN95VERSION
02719             bigstring bstitle;
02720             
02721             shellgetwindowtitle (hw, bstitle);
02722             
02723             if (fl)
02724                 pushstring (bschangedwindowsuffix, bstitle);
02725 
02726             windowsettitle ((**hw).macwindow, bstitle);
02727         #endif
02728         
02729         (**hw).flmadechanges = fl;
02730         
02731         shellwindowmenudirty ();
02732         }
02733     
02734     if (!fl) /*clearing the bit doesn't percolate -- think about it...*/
02735         return (true);
02736     
02737     hparent = (**hw).parentwindow;
02738     
02739     if (hparent == nil) /*this is a root window*/
02740         return (true);
02741     
02742     return (shellsetwindowchanges (hparent, true)); /*percolate through recursion*/
02743     } /*shellsetwindowchanges*/
02744 
02745 
02746 boolean windowsetchanges (WindowPtr w, boolean fldirty) {
02747     
02748     /*
02749     set the flmadechanges field of the info record for the indicated window.
02750     
02751     if the window has a parent and we're setting the bit, set it's dirty bit.
02752     
02753     7/18/90 DW: added call to routines hooked into dirty events.
02754     
02755     6/14/91 dmb: only call dirtyhooks when dirtying, not when cleaning.  also,
02756     make sure the windows menu is current
02757     */
02758     
02759     hdlwindowinfo hinfo;
02760     register boolean fl = bitboolean (fldirty);
02761     
02762     if (fl)
02763         shellcalldirtyhooks ();
02764     
02765     if (!getwindowinfo (w, &hinfo))
02766         return (true);
02767     
02768     return (shellsetwindowchanges (hinfo, fl));
02769     } /*windowsetchanges*/
02770 
02771 
02772 boolean windowmadechanges (WindowPtr w) {
02773 
02774     hdlwindowinfo hinfo;
02775     
02776     if (!getwindowinfo (w, &hinfo))
02777         return (false);
02778     
02779     return ((**hinfo).flmadechanges);
02780     } /*windowmadechanges*/
02781     
02782     
02783 boolean windowgetcontentrect (WindowPtr w, Rect *rcontent) {
02784 
02785     hdlwindowinfo hinfo;
02786     
02787     if (!getwindowinfo (w, &hinfo))
02788         return (false);
02789     
02790     *rcontent = (**hinfo).contentrect;
02791     
02792     return (true);
02793     } /*windowgetcontentrect*/
02794 
02795 
02796 void disposeshellwindow (WindowPtr wptr) {
02797     
02798     /*
02799     dmb 8/20/90:  return immediately if nil
02800     
02801     4.1b4 dmb: respect new fldontownwindow windowinfo field
02802 
02803     3/31/97 dmb: invalidate globals _before_ disposewindow to handle
02804     Windows messages cleanly
02805 
02806     5.0.1 dmb: if hinfo isn't nil, disconnect data before 
02807     invalidating globals (avoids Win crash).
02808     
02809     5.1.5b7 dmb: ctpushes, fldisposewhenpopped replace shellinvalidglobals
02810     */
02811     
02812     register WindowPtr w = wptr;
02813     hdlwindowinfo hinfo;
02814     boolean fldontownwindow = false;
02815     
02816     if (!w)
02817         return;
02818     
02819     if (getwindowinfo (w, &hinfo)) { /*defensive driving*/
02820         
02821         if ((**hinfo).ctpushes > 0) {
02822             
02823             unlinkwindowlist (hinfo);
02824             
02825             (**hinfo).fldisposewhenpopped = true;
02826             
02827             return;
02828             }
02829         
02830         (**hinfo).hdata = nil;
02831         
02832         //shellinvalidglobals (w);
02833         
02834         fldontownwindow = (**hinfo).fldontownwindow;
02835         
02836         disposeshellwindowinfo (hinfo);
02837         }
02838 //  else
02839 //      shellinvalidglobals (w);
02840     
02841     setwindowrefcon (w, 0); // don't point to disposed structure
02842     
02843     if (!fldontownwindow)
02844         disposewindow (w);
02845     } /*disposeshellwindow*/
02846 
02847 
02848 boolean shellhidewindow (hdlwindowinfo hinfo) {
02849     
02850     /*
02851     5.0a10 dmb: special case for MAC is now in hidewindow code
02852 
02853     5.1b23 dmb: for Win, make sure hinfo isn't disposed behind our back
02854     */
02855 
02856     register hdlwindowinfo hw = hinfo;
02857     register WindowPtr w = (**hw).macwindow;
02858     
02859     hidewindow (w);
02860     
02861     if (*hw == nil)
02862         return (false);
02863 
02864     (**hw).flhidden = true;
02865     
02866     /*
02867     unlinkwindowlist (hw);
02868     */
02869     
02870     shellwindowmenudirty ();
02871     
02872     return (true);
02873     } /*shellhidewindow*/
02874 
02875 
02876 boolean shellunhidewindow (hdlwindowinfo hinfo) {
02877     
02878     /*
02879     5.1b23 dmb: for Win, make sure hinfo isn't disposed behind our back
02880     */
02881 
02882     register hdlwindowinfo hw = hinfo;
02883     
02884     if ((hw == nil) || (*hw == nil))
02885         return (false);
02886 
02887     showwindow ((**hw).macwindow);
02888     
02889     if (*hw == nil)
02890         return (false);
02891 
02892     (**hw).flhidden = false;
02893     
02894     /*
02895     insertwindowlist (hinfo);
02896     */
02897     
02898     shellwindowmenudirty ();
02899     
02900     return (true);
02901     } /*shellunhidewindow*/
02902 
02903     
02904 boolean shellbringtofront (hdlwindowinfo hinfo) {
02905     
02906     /*
02907     4/20/93 dmb: handle windows that were opened in another process
02908     */
02909     
02910     register hdlwindowinfo hw = hinfo;
02911     register WindowPtr w = (**hw).macwindow;
02912     typrocessid processid = (**hw).processid;
02913     boolean fl;
02914     
02915     if (!iscurrentapplication (processid))
02916         fl = activateapplicationwindow (processid, w);
02917     else
02918         fl = windowbringtofront (w);
02919     
02920     if (!fl)
02921         return (false);
02922     
02923     shellunhidewindow (hinfo);
02924     
02925     return (true);
02926     } /*shellbringtofront*/
02927 
02928 
02929 boolean shellsetwindowtitle (hdlwindowinfo hinfo, bigstring bstitle) {
02930     
02931     setheapstring (bstitle, (**hinfo).hwindowtitle);
02932     
02933     #ifdef xxxWIN95VERSION
02934         if ((**hinfo).flmadechanges)
02935             pushstring (bschangedwindowsuffix, bstitle);
02936     #endif
02937 
02938     windowsettitle ((**hinfo).macwindow, bstitle);
02939     
02940     shellwindowmenudirty ();
02941     
02942     return (true);
02943     } /*shellsetwindowtitle*/
02944 
02945 
02946 void shellgetwindowtitle (hdlwindowinfo hinfo, bigstring bstitle) {
02947     
02948     /*
02949     7.24.97 dmb: added hwindowtitle to the windowinfo record so we 
02950     don't need to get it from the window. Under Windows, getwindowtitle 
02951     calls back to the window message proc, forcing us to allow a thread
02952     swap. this was wreaking havoc which has only partially been handled.
02953     */
02954 
02955     // windowgettitle ((**hinfo).macwindow, bstitle);
02956     
02957     if (hinfo == nil)
02958         setemptystring (bstitle);
02959     else
02960         copyheapstring ((**hinfo).hwindowtitle, bstitle);
02961     } /*shellgetwindowtitle*/
02962 
02963 
02964 void closewindowfile (WindowPtr wptr) {
02965     
02966     /*
02967     close the file displayed in the indicated window, and set up his information
02968     handle to indicate that no file is open.
02969     
02970     dmb 8/20/90:  support resource fork
02971     dmb 10/15/90:  dispose file if never saved
02972     */
02973     
02974     hdlwindowinfo hinfo;
02975     register hdlwindowinfo h;
02976     tyfilespec fspec;
02977     
02978     if (!getwindowinfo (wptr, &hinfo))
02979         return;
02980         
02981     h = hinfo; /*copy into register*/
02982     
02983     if ((**h).fnum != 0) {
02984     
02985         closefile ((**h).fnum);
02986         
02987         closeresourcefile ((**h).rnum);
02988         
02989         windowgetfspec (wptr, &fspec);
02990         
02991         if ((**h).flneversaved)
02992             deletefile (&fspec);
02993         
02994         flushvolumechanges (&fspec, (hdlfilenum)0);
02995         }
02996     
02997     (**h).fnum = 0; /*indicate no file open*/
02998     
02999     (**h).rnum = -1;
03000     } /*closewindowfile*/
03001 
03002 
03003 void shellwindowmessage (bigstring bs) {
03004     
03005     if (!(**shellwindowinfo).flmessagelocked) 
03006         (*shellglobals.msgroutine) (bs, false);
03007     } /*shellwindowmessage*/
03008 
03009 
03010 boolean shellfrontwindowmessage (bigstring bs) {
03011     
03012     /*
03013     display the message in the frontmost window.
03014     */
03015     
03016     if (!shellpushfrontglobals ())
03017         return (false);
03018     
03019     shellwindowmessage (bs);
03020     
03021     shellpopglobals ();
03022     
03023     return (true);
03024     } /*shellfrontwindowmessage*/
03025 
03026 
03027 boolean shellfrontrootwindowmessage (bigstring bs) {
03028     
03029     /*
03030     display the message in the frontmost root window.
03031     */
03032     
03033     if (!shellpushfrontrootglobals ())
03034         return (false);
03035     
03036     shellwindowmessage (bs);
03037     
03038     shellpopglobals ();
03039     
03040     return (true);
03041     } /*shellfrontrootwindowmessage*/
03042 
03043 
03044 boolean shellgettargetdata (short id, WindowPtr w) {
03045     
03046     boolean fl;
03047     
03048     shellpushglobals (w);
03049     
03050     fl = (*shellglobals.gettargetdataroutine) (id); /*sets target globals if possible*/
03051     
03052     shellpopglobals ();
03053     
03054     return (fl); /*keep looking*/
03055     } /*shellgettargetdata*/
03056 
03057 
03058 typedef struct findtargetinfo {
03059 
03060     short targetdataid;
03061 
03062     WindowPtr targetwindow;
03063     } tyfindtargetinfo;
03064 
03065 
03066 static boolean findtargetvisit (WindowPtr w, ptrvoid refcon) {
03067     
03068     tyfindtargetinfo *findinfo = (tyfindtargetinfo *) refcon;
03069     
03070     if (windowvisible (w)) { /*hidden windows aren't condidates for default target*/
03071         
03072         if (shellgettargetdata ((*findinfo).targetdataid, w)) {
03073             
03074             (*findinfo).targetwindow = w;
03075             
03076             return (false); /*stop visiting*/
03077             }
03078         }
03079     
03080     return (true); /*keep looking*/
03081     } /*findtargetvisit*/
03082 
03083 
03084 boolean shellfindtargetwindow (short id, WindowPtr *targetwindow) {
03085     
03086     /*
03087     chase through the window list, looking for the frontmost window that contains
03088     data for a verb of the given type.
03089     
03090     the gettargetdata callback routine sets up globals and returns true if 
03091     it is able to handle this type of verb
03092     */
03093     
03094     tyfindtargetinfo findinfo;
03095     
03096     findinfo.targetdataid = id; /*make visible to visit routine*/
03097     
03098     if (shellvisitwindowlayer (&findtargetvisit, &findinfo))
03099         return (false);
03100     
03101     *targetwindow = findinfo.targetwindow;
03102     
03103     return (true);
03104     } /*shellfindtargetwindow*/
03105 
03106 
03107 boolean shellgetexternaldata (hdlwindowinfo hinfo, void *hdata) {
03108     
03109     boolean fl;
03110     
03111     *(Handle *) hdata = nil;
03112     
03113     shellpushglobals ((**hinfo).macwindow);
03114     
03115     fl = (*shellglobals.getvariableroutine) (hdata);
03116     
03117     shellpopglobals ();
03118     
03119     return (fl);
03120     } /*shellfindtargetwindow*/
03121 
03122 
03123 boolean shellgetdatabase (WindowPtr w, hdldatabaserecord *hdatabase) {
03124     
03125     boolean fl;
03126     hdloutlinerecord ho = outlinedata;
03127     
03128     *hdatabase = nil;
03129     
03130     if (!shellpushrootglobals (w))
03131         return (false);
03132     
03133     fl = (*shellglobals.getdatabaseroutine) (hdatabase);
03134 
03135     shellpopglobals ();
03136     
03137     opsetoutline (ho);
03138 
03139     return (fl);
03140     } /*shellgetdatabase*/
03141 
03142 
03143 
03144 

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