shellmenu.c

Go to the documentation of this file.
00001 
00002 /*  $Id: shellmenu.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 #ifdef MACVERSION
00032     #include <uisharing.h>
00033 #endif
00034 
00035 #include "memory.h"
00036 #include "cursor.h"
00037 #include "dialogs.h"
00038 #include "font.h"
00039 #include "menu.h"
00040 #include "resources.h"
00041 #include "sounds.h"
00042 #include "strings.h"
00043 #include "popup.h"
00044 #include "quickdraw.h"
00045 #include "frontierwindows.h"
00046 #include "kb.h"
00047 #include "about.h"
00048 #include "shell.h"
00049 #include "shell.rsrc.h"
00050 #include "shellhooks.h"
00051 #include "shellmenu.h"
00052 #include "shellprint.h"
00053 #include "shellprivate.h"
00054 #include "cancoon.h"
00055 #include "tablestructure.h"
00056 #include "ops.h" /* 2005-09-25 creedon */
00057 #include "langinternal.h" /* 2005-12-27 creedon */
00058 
00059 
00060 tymenuinfo menustack [ctmenustack];
00061 
00062 short topmenustack = -1;
00063 
00064 static hdlmenu happlemenu;
00065 
00066 static tymenustate menustate = dirtymenus;
00067 
00068 
00069 #ifdef MACVERSION
00070 
00071 static boolean parammenuitem (hdlmenu hmenu, short item) {
00072     
00073     /*
00074     in the indicated menu item, replace all occurrences of ^0 with the
00075     parameter string.
00076     */
00077     
00078     register hdlmenu h = hmenu; 
00079     bigstring bsitem;
00080     
00081     getmenuitem (h, item, bsitem); 
00082     
00083     parseparamstring (bsitem);
00084     
00085     setmenuitem (h, item, bsitem);
00086     
00087     return (true);
00088     } /*parammenuitem*/
00089 
00090 #endif
00091     
00092     
00093 static boolean menudisablevisit (hdlmenu hmenu, short item) {
00094     
00095     if (hmenu != happlemenu) /*apple menu always fully enabled*/
00096         disablemenuitem (hmenu, item);
00097     
00098     return (true);
00099     } /*menudisablevisit*/
00100 
00101 
00102 static boolean visitonemenu (short idmenu, boolean (*visitproc) (hdlmenu, short)) {
00103     
00104     register hdlmenu hmenu;
00105     register short i;
00106     register short lastitem;
00107     
00108     hmenu = shellmenuhandle (idmenu);
00109     
00110     if (hmenu == nil)
00111         return (false);
00112     
00113     lastitem = countmenuitems (hmenu);
00114     
00115     for (i = 1; i <= lastitem; i++) {
00116         
00117         if (!(*visitproc) (hmenu, i))
00118             return (false);
00119         } /*for*/
00120 
00121     return (true);
00122     } /*visitonemenu*/
00123 
00124 
00125 static boolean visitmenuitems (boolean (*visitproc) (hdlmenu, short)) {
00126     
00127     register short lastmenu = topmenustack;
00128     register short i, j;
00129     register short lastitem;
00130     register hdlmenu hmenu;
00131     
00132     for (i = 0; i <= lastmenu; i++) {
00133         
00134         hmenu = menustack [i].macmenu;
00135         
00136         lastitem = countmenuitems (hmenu);
00137         
00138         for (j = 1; j <= lastitem; j++) {
00139             
00140             if (!(*visitproc) (hmenu, j))
00141                 return (false);
00142             } /*for*/
00143         } /*for*/
00144         
00145     return (true);
00146     } /*visitmenuitems*/
00147 
00148 
00149 #if 0 //TARGET_API_MAC_CARBON == 1
00150 
00151 static void setfontmenustyles (void) {
00152 
00153     /*
00154     7.0b47 PBS: set font styles for the items in the Font menu.
00155     */
00156 
00157     short i, lastitem, idfont;
00158     hdlmenu hfontmenu;
00159     bigstring bsitem;
00160     
00161     hfontmenu = shellmenuhandle (fontmenu);
00162     
00163     lastitem = countmenuitems (hfontmenu);
00164     
00165     for (i = 1; i <= lastitem; i++) {
00166     
00167         getmenuitem (hfontmenu, i, bsitem);
00168         
00169         fontgetnumber (bsitem, &idfont);
00170     
00171         SetMenuItemFontID (hfontmenu, i, idfont);   
00172         } /*for*/
00173 
00174     } /*setfontmenustyles*/
00175     
00176 #endif
00177 
00178 
00179 hdlmenu shellmenuhandle (short idmenu) {
00180 
00181     short i;
00182     register short lastmenu = topmenustack;
00183 
00184     for (i = 0; i <= lastmenu; i++) {
00185         
00186         if (menustack [i].idmenu == idmenu)
00187             return (menustack [i].macmenu);
00188         }
00189 
00190     return (nil);
00191     } /*shellmenuhandle*/
00192 
00193 
00194 boolean shelltgetmainmenu (bigstring bsmenu, hdlmenu *hmenu, short *idmenu) {
00195     
00196     /*
00197     5.0a24 dmb: find a main menu with the given title
00198     */
00199 
00200     short ctmainmenus = (lastmainmenu - firstmainmenu) / mainmenuincrement + 1;
00201     short ixmenu;
00202     
00203     for (ixmenu = 0; ixmenu < ctmainmenus; ++ixmenu) {
00204         
00205         register hdlmenu h = menustack [ixmenu].macmenu;
00206         bigstring bstitle;
00207         
00208         getmenuitem (h, 0, bstitle);
00209         
00210         popleadingchars (bstitle, (char) '&'); /*pop off keyboard accelerator mark*/
00211         
00212         if (equalstrings (bstitle, bsmenu)) {
00213             
00214             *hmenu = h;
00215             
00216             *idmenu = menustack [ixmenu].idmenu;
00217             
00218             return (true);
00219             }
00220         }
00221     
00222     #ifdef MACVERSION
00223         if (equalstrings (bsmenu, "\pHelp")) {
00224             
00225             #if TARGET_API_MAC_CARBON == 1
00226             //Code change by Timothy Paustian Friday, June 16, 2000 3:04:41 PM
00227             //Changed to Opaque call for Carbon
00228             //we will add the below code when this is implemented in carbon.
00229             {
00230                 MenuItemIndex   theIndex;
00231                 if (HMGetHelpMenu(hmenu, &theIndex) == noErr && *hmenu != nil) {
00232                     
00233                     *idmenu = kHMHelpMenuID;
00234                     
00235                     return (true);
00236                     }
00237                 }
00238             #else
00239             
00240                 if (HMGetHelpMenuHandle (hmenu) == noErr && *hmenu != nil) {
00241                     
00242                     *idmenu = kHMHelpMenuID;
00243                     
00244                     return (true);
00245                     }
00246                 
00247             #endif
00248         }
00249     #endif
00250 
00251     return (false);
00252     } /*shelltgetmainmenu*/
00253 
00254 
00255 static boolean pushmenustack (short idmenu, hdlmenu hmenu) {
00256     
00257     register short top = topmenustack + 1;
00258     
00259     if (top >= ctmenustack) 
00260         return (false);
00261     
00262     menustack [top].idmenu = idmenu;
00263 
00264     menustack [top].macmenu = hmenu;
00265     
00266     topmenustack = top;
00267     
00268     return (true);
00269     } /*pushmenustack*/
00270     
00271     
00272 static boolean installmenu (short idmenu) {
00273     
00274     register hdlmenu h;
00275     
00276     h = getresourcemenu (idmenu); 
00277     
00278     if (h == nil) /*error in the menu manager*/
00279         return (false);
00280     
00281     if (!pushmenustack (idmenu, h))
00282         return (false);
00283         
00284     insertmenu (h, insertatend);
00285     
00286     return (true);
00287     } /*installmenu*/
00288 
00289 
00290 static boolean installhierarchicmenu (short idmenu) {
00291     
00292     register hdlmenu h;
00293     
00294     h = getresourcemenu (idmenu);
00295     
00296     if (h == nil) /*error in the menu manager*/
00297         return (false);
00298     
00299     if (!pushmenustack (idmenu, h))
00300         return (false);
00301     
00302     inserthierarchicmenu (h, idmenu); /*insert it as a hierarchic menu*/
00303         
00304     return (true);
00305     } /*installhierarchicmenu*/
00306 
00307 
00308 static boolean installresitems (short idmenu, OSType restype) {
00309     
00310     /*
00311     2/6/91 dmb: HierDA leaves ResError set after AddResMenu, so 
00312     we no longer check the result.  we probably wouldn't want to 
00313     treat that as a fatal error anyway.
00314     */
00315     
00316     register hdlmenu h;
00317     
00318     h = shellmenuhandle (idmenu);
00319     
00320     if (h == nil) /*error in the menu manager*/
00321         return (false);
00322     
00323     pushresourcemenuitems (h, idmenu, restype); 
00324     
00325     return (true);
00326     } /*installresitems*/
00327 
00328 
00329 boolean shellinitmenus (void) {
00330     
00331     register short idmenu;
00332     
00333     #ifdef MACVERSION
00334         bigstring bsprogramname; /*PBS 7.1b4: use ifdef because this variable isn't used on Windows.*/
00335     #endif
00336     
00337     topmenustack = -1; /*no items on the menu stack*/
00338     
00339     clearbytes (&menustack, sizeof (menustack)); /*clear it for neatness sake*/
00340     
00341     for (idmenu = firstmainmenu;  idmenu <= lastmainmenu;  idmenu += mainmenuincrement)
00342         if (!installmenu (idmenu))
00343             return (false);
00344         
00345     for (idmenu = firsthiermenu;  idmenu <= lasthiermenu;  idmenu += hiermenuincrement)
00346         if (!installhierarchicmenu (idmenu))
00347             return (false);
00348     
00349     happlemenu = shellmenuhandle (applemenu); /*set global*/
00350 
00351 #ifdef MACVERSION
00352     if (!installresitems (applemenu, 'DRVR'))
00353         return (false);
00354 #endif
00355     
00356     if (!installresitems (fontmenu, 'FONT'))
00357         return (false);
00358     
00359     //#if TARGET_API_MAC_CARBON == 1 /*PBS 7.1b15: too slow to open that menu.*/
00360     
00361         //setfontmenustyles (); /*PBS 7.0b46: wizzy font menu*/
00362         
00363     //#endif
00364     
00365 #ifdef MACVERSION
00366     
00367     getprogramname (bsprogramname);
00368     
00369     setparseparams (bsprogramname, nil, nil, nil);
00370     
00371     visitmenuitems (&parammenuitem); /*perform ^0, ^1... substitutions*/
00372 
00373 #endif
00374 
00375     visitmenuitems (&menudisablevisit); /*disable all menu items*/
00376     
00377     return (true);
00378     } /*shellinitmenus*/
00379     
00380     
00381 void shellgetlastmenuid (short *id) {
00382     
00383     /*
00384     return the menu id of the last menu we insert into the menubar.
00385     */
00386     
00387     *id = editmenu;
00388     } /*shellgetlastmenuid*/
00389     
00390 #ifdef MACVERSION
00391 boolean shellapplemenu (bigstring bsname) {
00392     
00393     /*
00394     can be called from one of the clients.  also there's a verb in the language
00395     that supports this.
00396     
00397     by convention, DA names may or may not begin with one or more nulls.  we take
00398     this cultural wierdness into account.
00399     
00400     return true if we got to call OpenDeskAcc, false if there was some problem we
00401     were able to detect.
00402     */
00403     
00404     bigstring bs, bsorig, bscompare;
00405     short i, ct;
00406     
00407     copystring (bsname, bs); /*work with a copy*/
00408     
00409     if (isemptystring (bs)) /*nothing to do*/
00410         return (false);
00411     
00412     popleadingchars (bs, (char) 0); /*pop off any leading nulls*/
00413     
00414     ct = countmenuitems (happlemenu);
00415     
00416     for (i = 1; i <= ct; i++) {
00417         
00418         getmenuitem (happlemenu, i, bsorig);
00419         
00420         copystring (bsorig, bscompare);
00421         
00422         popleadingchars (bscompare, (char) 0); /*pop off any leading nulls*/
00423         
00424         if (equalstrings (bs, bscompare)) { /*strings match without any nulls*/
00425             
00426             pushstyle (systemFont, 12, 0);
00427             //Code change by Timothy Paustian Friday, June 16, 2000 3:01:02 PM
00428             //Changed to Opaque call for Carbon
00429             //we do not need to do this for carbon
00430             #if !TARGET_API_MAC_CARBON
00431             OpenDeskAcc (bsorig); /*use the string as the menu manager provided it*/
00432             #endif
00433 
00434             popstyle ();    
00435             
00436             return (true);  
00437             }
00438         } /*for*/
00439     
00440     return (false); /*no item with a matching name*/
00441     } /*shellapplemenu*/
00442 #endif  
00443 
00444 boolean shelleditcommand (tyeditcommand editcmd) {
00445 
00446     /*
00447     7.0b33 PBS: For some reason the HTML Control background on Windows version
00448     of Radio messes with the kernel's notion of when an editing window is in
00449     front. This can cause a crash. So a bit of defensive code has been placed here.
00450     Having spent hours on this bug, I'm going with the defensive code until I can get Bob's help.
00451     However, I'm limiting the defensive code to Radio/Win only.
00452     */
00453     
00454     register boolean fl = false;
00455 
00456     #ifdef PIKE
00457         #ifdef WIN95VERSION
00458 
00459             if (shellwindow == nil) /*7.0b33 PBS: defensive code for Radio/Win to prevent a crash.*/
00460 
00461                 return (false);
00462 
00463         #endif
00464     #endif
00465     
00466     switch (editcmd) {
00467         
00468         case undocommand:
00469             fl = (*shellglobals.undoroutine) ();
00470             
00471             break;
00472         
00473         case cutcommand:
00474             fl = (*shellglobals.cutroutine) ();
00475             
00476             break;
00477             
00478         case copycommand:
00479             fl = (*shellglobals.copyroutine) ();
00480             
00481             break;
00482             
00483         case pastecommand:
00484             
00485             shellreadscrap (); /*since we don't display scrap, now's the time to get current*/
00486             
00487             fl = (*shellglobals.pasteroutine) ();
00488             
00489             break;
00490             
00491         case clearcommand:
00492             fl = (*shellglobals.clearroutine) ();
00493             
00494             break;
00495         
00496         case selectallcommand:
00497             fl = (*shellglobals.selectallroutine) ();
00498         
00499         default:
00500             return (false);
00501         } /*switch*/
00502     
00503     return (true);
00504     } /*shelleditcommand*/
00505     
00506 
00507 static boolean shellfontmenuchecker (hdlmenu hmenu, short itemnumber) {
00508 
00509     /*
00510     11/8/90 DW: turns out we CAN ligitimately check more than one font, if there
00511     is a conflict in font numbers.  the solution -- the user must straighten out
00512     his font resources, possibly using a font harmonzier so that there are not
00513     font number conflicts.
00514     */
00515     
00516     register boolean fl;
00517     bigstring bs;
00518     short fontnum;
00519     
00520     getmenuitem (hmenu, itemnumber, bs);
00521     
00522     fontgetnumber (bs, &fontnum);
00523     
00524     fl = (fontnum == (**shellwindowinfo).selectioninfo.fontnum);
00525     
00526     checkmenuitem (hmenu, itemnumber, fl);
00527         
00528     return (true);
00529     } /*shellfontmenuchecker*/
00530     
00531     
00532 static boolean shellsizemenuchecker (hdlmenu hmenu, short itemnumber) {
00533     
00534     register short checkeditem;
00535     register short fontsize;
00536     register short itemsize;
00537     register short style;
00538     register short fontnum;
00539     
00540     fontsize = (**shellwindowinfo).selectioninfo.fontsize;
00541     
00542     switch (fontsize) {
00543         
00544         case -1: /*no consistent size across selection*/
00545             checkmenuitem (hmenu, itemnumber, false);
00546             
00547             goto L1; /*skip to determining if it's a real font or not*/
00548         
00549         case 9:
00550             checkeditem = point9item;
00551             
00552             break;
00553             
00554         case 10:
00555             checkeditem = point10item;
00556             
00557             break;
00558             
00559         case 12:
00560             checkeditem = point12item;
00561             
00562             break;
00563             
00564         case 14:
00565             checkeditem = point14item;
00566             
00567             break;
00568             
00569         case 18:
00570             checkeditem = point18item;
00571             
00572             break;
00573             
00574         case 24:
00575             checkeditem = point24item;
00576             
00577             break;
00578             
00579         default:
00580             checkeditem = pointcustomitem;
00581             
00582             break;
00583         } /*switch*/
00584     
00585     checkmenuitem (hmenu, itemnumber, itemnumber == checkeditem);
00586     
00587     L1:
00588     
00589     fontnum = (**shellwindowinfo).selectioninfo.fontnum;
00590     
00591     if (fontnum == -1) { /*no consistent font across selection*/
00592         
00593         stylemenuitem (hmenu, itemnumber, 0); /*plain*/
00594         
00595         return (true);
00596         }
00597     
00598     itemsize = -1;
00599     
00600     switch (itemnumber) {
00601         
00602         case point9item:
00603             itemsize = 9;
00604             
00605             break;
00606             
00607         case point10item:
00608             itemsize = 10;
00609             
00610             break;
00611             
00612         case point12item:
00613             itemsize = 12;
00614             
00615             break;
00616             
00617         case point14item:
00618             itemsize = 14;
00619             
00620             break;
00621             
00622         case point18item:
00623             itemsize = 18;
00624             
00625             break;
00626             
00627         case point24item:
00628             itemsize = 24;
00629             
00630             break;
00631             
00632         } /*switch*/
00633     
00634     style = 0;
00635     
00636     if (itemsize != -1)
00637         if (realfont (fontnum, itemsize))
00638             style = outline;
00639         
00640     stylemenuitem (hmenu, itemnumber, style);
00641         
00642     return (true);
00643     } /*shellsizemenuchecker*/
00644     
00645     
00646 static boolean shellstylemenuchecker (hdlmenu hmenu, short itemnumber) {
00647     
00648     register boolean flchecked = false;
00649     tyselectioninfo x;
00650     
00651     x = (**shellwindowinfo).selectioninfo;
00652     
00653     switch (itemnumber) {
00654         
00655         case plainitem:
00656             flchecked = x.fontstyle == 0; /*flplain;*/
00657             
00658             break;
00659             
00660         case bolditem:
00661             flchecked = (x.fontstyle & bold) != 0;
00662             
00663             break;
00664             
00665         case italicitem:
00666             flchecked = (x.fontstyle & italic) != 0;
00667             
00668             break;
00669             
00670         case underlineitem:
00671             flchecked = (x.fontstyle & underline) != 0;
00672             
00673             break;
00674             
00675         case outlineitem:
00676             flchecked = (x.fontstyle & outline) != 0;
00677             
00678             break;
00679             
00680         case shadowitem:
00681             flchecked = (x.fontstyle & shadow) != 0;
00682             
00683             break;
00684 
00685         /*
00686         case condenseditem:
00687             flchecked = x.fontstyle.flcondensed;
00688             
00689             break;
00690         
00691         case superscriptitem:
00692             flchecked = x.fontstyle.flsuperscript;
00693             
00694             break;
00695             
00696         case subscriptitem:
00697             flchecked = x.fontstyle.flsubscript;
00698             
00699             break;
00700         */  
00701         } /*switch*/
00702     
00703     checkmenuitem (hmenu, itemnumber, flchecked);
00704     
00705     return (true);
00706     } /*shellstylemenuchecker*/
00707     
00708 
00709 static boolean shellleadingmenuchecker (hdlmenu hmenu, short itemnumber) {
00710     
00711     register short leading = (**shellwindowinfo).selectioninfo.leading;
00712     register short checkeditem = -1;
00713     
00714     switch (leading) {
00715         
00716         case -1: /*no consistent leading across selection*/
00717             checkmenuitem (hmenu, itemnumber, false);
00718             
00719             return (true);
00720         
00721         case 0:
00722             checkeditem = leading0item;
00723             
00724             break;
00725         
00726         case 1:
00727             checkeditem = leading1item;
00728             
00729             break;
00730             
00731         case 2:
00732             checkeditem = leading2item;
00733             
00734             break;
00735             
00736         case 3:
00737             checkeditem = leading3item;
00738             
00739             break;
00740             
00741         case 4:
00742             checkeditem = leading4item;
00743             
00744             break;
00745             
00746         case 5:
00747             checkeditem = leading5item;
00748             
00749             break;
00750             
00751         default:
00752             checkeditem = leadingcustomitem;
00753             
00754             break;
00755         } /*switch*/
00756     
00757     checkmenuitem (hmenu, itemnumber, itemnumber == checkeditem);
00758     
00759     return (true);
00760     } /*shellleadingmenuchecker*/
00761 
00762 
00763 static boolean shelljustifymenuchecker (hdlmenu hmenu, short itemnumber) {
00764     
00765     register tyjustification justification = (**shellwindowinfo).selectioninfo.justification;
00766     register short checkeditem = -1;
00767     
00768     switch (justification) {
00769         
00770         case leftjustified:
00771             checkeditem = leftjustifyitem;
00772             
00773             break;
00774             
00775         case centerjustified:
00776             checkeditem = centerjustifyitem;
00777             
00778             break;
00779             
00780         case rightjustified:
00781             checkeditem = rightjustifyitem;
00782             
00783             break;
00784             
00785         case fulljustified:
00786             checkeditem = fulljustifyitem;
00787             
00788             break;
00789             
00790         case unknownjustification:
00791             checkmenuitem (hmenu, itemnumber, false);
00792             
00793             return (true);
00794             
00795         } /*switch*/
00796     
00797     checkmenuitem (hmenu, itemnumber, itemnumber == checkeditem);
00798     
00799     return (true);
00800     } /*shelljustifymenuchecker*/
00801 
00802 
00803 static void shellcheckfontsizestyle (void) {
00804     
00805     register hdlwindowinfo hw = shellwindowinfo;
00806     tyselectioninfo x;
00807     
00808     /*blidgey ();*/
00809     
00810     if (hw == nil) /*no windows open*/
00811         return;
00812     
00813     x = (**hw).selectioninfo;
00814     
00815     if (!x.fldirty) /*nothing to do*/
00816         return;
00817     
00818     shellsetselectioninfo ();
00819     
00820     x = (**hw).selectioninfo; /*get updated flags*/
00821     
00822 #ifdef fontmenu
00823     if (x.flcansetfont)
00824         visitonemenu (fontmenu, &shellfontmenuchecker);
00825 #endif
00826 
00827 #ifdef sizemenu 
00828     if (x.flcansetsize)
00829         visitonemenu (sizemenu, &shellsizemenuchecker);
00830 #endif
00831 
00832 #ifdef stylemenu    
00833     if (x.flcansetstyle)
00834         visitonemenu (stylemenu, &shellstylemenuchecker);
00835 #endif
00836 
00837 #ifdef leadingmenu  
00838     if (x.flcansetleading)
00839         visitonemenu (leadingmenu, &shellleadingmenuchecker);
00840 #endif
00841 
00842 #ifdef justifymenu  
00843     if (x.flcansetjust)
00844         visitonemenu (justifymenu, &shelljustifymenuchecker);
00845 #endif
00846     } /*shellcheckfontsizestyle*/
00847 
00848 
00849 void shelladjustundo (void) {
00850     
00851     register hdlstring hstring = nil;
00852     register boolean flundoable = false;
00853     register hdlmenu hmenu;
00854     bigstring bs;
00855     
00856     if (shellwindow != nil) { /*there's at least one window open*/
00857     
00858         (*shellglobals.setundostatusroutine) ();
00859     
00860         hstring = (**shellwindowinfo).hundostring;
00861     
00862         flundoable = hstring != nil;
00863         }
00864     
00865     if (!flundoable) 
00866         getstringlist (undolistnumber, cantundoitem, bs);
00867     else
00868         copyheapstring (hstring, bs);
00869     
00870     hmenu = shellmenuhandle (editmenu);
00871     
00872     if (hmenu != nil) {
00873         
00874         setmenuitem (hmenu, undoitem, bs);
00875     
00876         setmenuitemenable (hmenu, undoitem, flundoable);
00877         }
00878     } /*shelladjustundo*/
00879 
00880 
00881 void shellforcemenuadjust (void) {
00882     
00883     menustate = dirtymenus;
00884     } /*shellforcemenuadjust*/
00885 
00886 
00887 void shellmodaldialogmenuadjust (void) {
00888     
00889     menustate = modaldialogmenus;
00890     
00891     shelladjustmenus ();
00892     } /*shellforcemenuadjust*/
00893 
00894 
00895 #ifndef PIKE
00896 
00897 static boolean shellsetmenuitemstring (hdlmenu hmenu, short ixmenu, short ixitemstring) {
00898     
00899     bigstring bs;
00900     
00901     return (shellgetstring (ixitemstring, bs) && setmenuitem (hmenu, ixmenu, bs));
00902     } /*shellsetmenuitemstring*/
00903 
00904 #endif
00905 
00906 
00907 #ifdef PIKE
00908 
00909 static void pikesetfilemenuitemchecked (short ixmenu) {
00910     
00911     /*
00912     7.0b25 PBS: Run a Radio UserLand script that returns true if the item should get
00913     a check mark. If true, put a check next to the item.
00914 
00915     7.1b4 PBS: Get script from resource, don't hard-code.
00916     */
00917     
00918     bigstring bsscript, bsitem, bsresult;
00919     
00920     if (roottable == nil)
00921         return;
00922     
00923     getfilemenuitemidentifier (ixmenu, bsitem);
00924     
00925     /*copystring ("\x20" "pike.isFileMenuItemChecked(\"^0\")", bsscript);*/
00926 
00927     getsystemtablescript (idpikeisfilemenuitemcheckedscript, bsscript);
00928     
00929     parsedialogstring (bsscript, bsitem, nil, nil, nil, bsscript);
00930 
00931     grabthreadglobals ();
00932     
00933     langrunstringnoerror (bsscript, bsresult);
00934     
00935     releasethreadglobals ();
00936 
00937     checkmenuitem (shellmenuhandle (filemenu), ixmenu, equalstrings (bsresult, bstrue));
00938     } /*pikesetfilemenuitemchecked*/
00939 
00940 
00941 static void pikesetfilemenuitemenable (short ixmenu) {
00942 
00943     /*
00944     6.2a2 AR: Call the pike.isFileMenuItemEnabled script to determine whether
00945     the menu item should be enabled or disabled.
00946 
00947     7.1b4: Get script from resource, don't hard-code it.
00948     */
00949 
00950     bigstring bsscript, bsitem, bsresult;
00951 
00952     if (roottable == nil)
00953         return;
00954 
00955     getfilemenuitemidentifier (ixmenu, bsitem);
00956 
00957     /*copystring ("\x20""pike.isFileMenuItemEnabled(\"^0\")", bsscript);*/
00958 
00959     getsystemtablescript (idpikeisfilemenuitemenabledscript, bsscript);
00960 
00961     parsedialogstring (bsscript, bsitem, nil, nil, nil, bsscript);
00962 
00963     grabthreadglobals ();
00964     
00965     langrunstringnoerror (bsscript, bsresult);
00966     
00967     releasethreadglobals ();
00968     
00969     setmenuitemenable (shellmenuhandle (filemenu), ixmenu, equalstrings (bsresult, bstrue));
00970     }/*ccpikesetfilemenuitemenable*/
00971 
00972 
00973 #if 0
00974 
00975 static void pikesetfilemenuitemname (short ixmenu) {
00976 
00977     /*
00978     6.2a2 AR: Call the pike.getFileMenuItemName script to determine the name
00979     of the displayed name of the menu item.
00980     */
00981 
00982     bigstring bsscript, bsitem, bsresult;
00983 
00984     if (roottable == nil)
00985         return;
00986 
00987     getfilemenuitemidentifier (ixmenu, bsitem);
00988 
00989     copystring (BIGSTRING ("\x1e""pike.getFileMenuItemName(\"^0\")"), bsscript);
00990 
00991     parsedialogstring (bsscript, bsitem, nil, nil, nil, bsscript);
00992 
00993     grabthreadglobals ();
00994     
00995     langrunstringnoerror (bsscript, bsresult);
00996 
00997     releasethreadglobals ();
00998     
00999     setmenuitem (shellmenuhandle (filemenu), ixmenu, bsresult);
01000     }/*pikesetfilemenuitemname*/
01001 
01002 #endif
01003 
01004 
01005 boolean pikequit () {
01006 
01007     /*
01008     7.0 PBS: Called in Windows when the user clicks the X in the frame window.
01009 
01010     7.1b4 PBS: get script string from resource, don't hard-code.
01011     */
01012 
01013     bigstring bsscript, bsitem, bsresult;
01014 
01015     if (roottable == nil)
01016         return (true);
01017 
01018     getfilemenuitemidentifier (quititem, bsitem);
01019 
01020     getsystemtablescript (idrunfilemenuscript, bsscript); /*7.1b4: get from resource.*/
01021 
01022     /*copystring ("\x1c""pike.runFileMenuScript(\"^0\")", bsscript);*/
01023 
01024     parsedialogstring (bsscript, bsitem, nil, nil, nil, bsscript);
01025 
01026     grabthreadglobals ();
01027     
01028     langrunstringnoerror (bsscript, bsresult);
01029 
01030     releasethreadglobals ();
01031 
01032     return (bsresult == bsfalse);
01033     } /*pikequit*/
01034 
01035 #endif
01036 
01037 
01038 void shelladjustmenus (void) {
01039     
01040     /*
01041     2005-10-26 creedon: the file menu item that provides save as functionality now reads Save As... for database or file-object save for Frontier
01042     
01043     2005-09-25 creedon: added open recent menu
01044                      changed to support calling script for some file/edit menu commands on all targets
01045     
01046     8/1/90 dmb: call menuhooks with menu & item set to zero to give 
01047     hooks a chance to update their menus
01048     
01049     2/22/91 dmb: use new flcansetxxx fields in selectioninfo to handle enabling 
01050     of the corresponding submenus
01051     
01052     6.19.97 dmb: added spaghetti code for modal dialog menus.
01053     
01054     5.0d19 dmb: added save/save database toggle, changed enabling logic to experts
01055     
01056     5.0.2b6 dmb: when setting modaldialog menus, set the window menu dirty
01057 
01058     7.0b32 PBS: Handle Windows case when to the user there are no windows open,
01059     but actually the main root window is open but hidden. In this case it should act
01060     as if no windows are open.
01061     */
01062     
01063     register hdlmenu hmenu;
01064     register WindowPtr w = shellwindow;
01065     boolean flwindow = w != nil;
01066     boolean flchanges;
01067     boolean flanywindow = (getfrontwindow () != nil);
01068     hdlwindowinfo hrootinfo = nil;
01069     tyselectioninfo x;
01070 
01071 #ifndef PIKE
01072     Handle hdata;
01073 #endif
01074 
01075     /*7.0b32 PBS: if shellwindow is root window but it's hidden, act as
01076     if no windows are open -- because, to the user, no windows *are* open.*/
01077 
01078     if (shellwindowinfo == NULL) {
01079 
01080         flwindow = false;
01081 
01082         flanywindow = false;
01083         } /*if*/
01084 
01085     else {
01086 
01087         if ((**shellwindowinfo).configresnum == idcancoonconfig) {
01088             
01089             if ((**shellwindowinfo).flhidden) {
01090 
01091                 flwindow = false;
01092 
01093                 flanywindow = false;
01094                 } /*if*/
01095             } /*if*/
01096         } /*else*/
01097 
01098     
01099     if (menustate == modaldialogmenus) {
01100         
01101         visitmenuitems (&menudisablevisit); // disable all menu items
01102         
01103         shellwindowmenudirty (); // make sure it gets updated later
01104         
01105         goto L1;  // do the edit menu
01106         }
01107     
01108     if (flwindow) {
01109         
01110         getrootwindow (w, &hrootinfo);
01111         
01112         shellcheckfontsizestyle (); /*update checks on font/size/style menus*/
01113         
01114         x = (**shellwindowinfo).selectioninfo;
01115         }
01116     else {
01117         if (ccinexpertmode ())
01118             ccfindrootwindow (&hrootinfo);
01119         
01120         clearbytes (&x, sizeof (tyselectioninfo));
01121         }
01122         
01123     flchanges = hrootinfo && (**hrootinfo).flmadechanges;
01124     
01125     hmenu = shellmenuhandle (filemenu);
01126     
01127     if (hmenu == nil) /*skip file menu adjusting*/
01128         goto L1;    
01129 
01130 #ifdef PIKE
01131 
01132 /*7.0b1 PBS: Radio UserLand has a functioning About item in the Apple menu.*/
01133 
01134 /*#ifdef MACVERSION
01135     disablemenuitem (happlemenu, aboutitem); //disable this command until we have a splash screen
01136 #endif*/
01137 
01138     /*
01139     6.2a2 AR: For Pike, we want to manage the state of the items
01140     in the File menu by calling a UserTalk script.
01141 
01142     7.0d6 PBS: Pike's File menu has changed. It's more like a standard
01143     File menu. The names, number, and order of items have changed.
01144 
01145     7.0d10 PBS: Radio UserLand now has Update Radio.root... in the File menu.
01146     */
01147 
01148     enablemenuitem (hmenu, newitem);
01149 
01150     enablemenuitem (hmenu, openitem);
01151     
01152     pikesetfilemenuitemenable (openurlitem); /*7.0b17 PBS: enable/disable Open URL... menu item.*/
01153     
01154 #ifndef OPMLEDITOR
01155     pikesetfilemenuitemenable (openmanilasiteitem); /*7.0b27 PBS: enable/disable Open Manila Site item.*/
01156 #endif // OPMLEDITOR        
01157     pikesetfilemenuitemenable (closeitem);
01158         
01159     pikesetfilemenuitemenable (saveitem);
01160 
01161     pikesetfilemenuitemenable (saveasitem);
01162     
01163 #ifndef OPMLEDITOR
01164     pikesetfilemenuitemenable (saveashtmlitem); /*7.0b32 PBS: Save As HTML*/
01165     
01166     pikesetfilemenuitemenable (saveasplaintextitem); /*7.0b32 PBS: Save As Plain Text*/
01167 #endif // OPMLEDITOR
01168         
01169     pikesetfilemenuitemenable (revertitem);
01170 
01171     pikesetfilemenuitemenable (viewinbrowseritem);
01172 
01173     pikesetfilemenuitemenable (updateradiorootitem); /*7.0d10 PBS*/
01174     
01175     pikesetfilemenuitemenable (workofflineitem); /*7.0b25 PBS*/
01176     
01177     pikesetfilemenuitemchecked (workofflineitem); /*7.0b25 PBS*/
01178 
01179 #else
01180 
01181     enablemenuitem (hmenu, newitem);
01182     
01183     enablemenuitem (hmenu, openitem);
01184     
01185     enablemenuitem (hmenu, openrecentitem);
01186     
01187     setmenuitemenable (hmenu, closeitem, flwindow);
01188 
01189     /*3/30/90 DW -- saveitem is not dependent on flchanges.  this allows you to save
01190     even when there have been no changes -- needed because changes to the symbol table
01191     no longer dirty the window it lives in.
01192     
01193     11/8/90 DW -- it's nice to be able to save even if we haven't made any changes.
01194     
01195     setmenuitemenable (hmenu, saveitem, flchanges);
01196     
01197     5.0a18 dmb: only enable save runnable for scripts
01198     */
01199 
01200     setmenuitemenable (hmenu, saveitem, flwindow || hrootinfo);
01201 
01202     if ((hrootinfo != nil) && (!flwindow || (**hrootinfo).configresnum == iddefaultconfig)) {
01203         
01204         shellsetmenuitemstring (hmenu, saveitem, savedatabaseitemstring); // "Save Database");
01205         
01206         // shellsetmenuitemstring (hmenu, saveasitem, saveacopyitemstring); // "Save a CopyÉ");
01207         }
01208     else {
01209         shellsetmenuitemstring (hmenu, saveitem, saveitemstring); // "\x07" "Save");
01210         
01211         // shellsetmenuitemstring (hmenu, saveasitem, saveasitemstring); // "\x07" "Save AsÉ");
01212         }
01213     
01214     setmenuitemenable (hmenu, saveasitem, flwindow || hrootinfo);
01215     
01216     setmenuitemenable (hmenu, saverunnableitem, 
01217         flwindow && 
01218         shellgetexternaldata (shellwindowinfo, &hdata) && 
01219         (**(hdlexternalhandle) hdata).id == idscriptprocessor);
01220     
01221     setmenuitemenable (hmenu, revertitem, flchanges && ((**hrootinfo).fnum != 0) && !(**hrootinfo).flneversaved);
01222     
01223     setmenuitemenable (hmenu, pagesetupitem, flwindow);
01224     
01225     setmenuitemenable (hmenu, printitem, flwindow);
01226 
01227 #endif
01228     
01229     enablemenuitem (hmenu, quititem);
01230     
01231     L1: /*goto here to skip the adjustment of the file menu*/
01232     
01233     hmenu = shellmenuhandle (editmenu);
01234     
01235     if (hmenu == nil) /*skip edit menu adjusting*/
01236         goto L2;
01237     
01238     setmenuitemenable (hmenu, undoitem, flanywindow);
01239     
01240     setmenuitemenable (hmenu, cutitem, flanywindow);
01241     
01242     setmenuitemenable (hmenu, copyitem, flanywindow);
01243     
01244     setmenuitemenable (hmenu, pasteitem, flanywindow);
01245     
01246     setmenuitemenable (hmenu, clearitem, flanywindow);
01247     
01248     setmenuitemenable (hmenu, selectallitem, flwindow);
01249     
01250     setmenuitemenable (hmenu, insertdatetimeitem, flwindow); /* 2006-01-06 creedon: re-establish code, went missing in sf repository revision 1.9 */
01251     
01252 #ifdef PIKE
01253 #ifndef OPMLEDITOR
01254     setmenuitemenable (hmenu, opennotepaditem, true); /*7.0b27 PBS: enable/disable Open Notepad, Insert Date/Time.*/
01255 #endif // !OPMLEDITOR   
01256 #endif
01257     
01258     if (menustate == modaldialogmenus)
01259         return;
01260     
01261     /*
01262     setmenuitemenable (hmenu, windowsitem, flanywindow);
01263     */
01264 
01265     setmenuitemenable (hmenu, findandreplaceitem, flwindow);
01266 
01267     setmenuitemenable (hmenu, commonstylesitem, (x.flcansetfont && x.flcansetsize));
01268 
01269     setmenuitemenable (hmenu, fontitem, x.flcansetfont);
01270     
01271     setmenuitemenable (hmenu, sizeitem, x.flcansetsize);
01272     
01273 #ifndef PIKE
01274 
01275     setmenuitemenable (hmenu, styleitem, x.flcansetstyle);
01276     
01277     setmenuitemenable (hmenu, leadingitem, x.flcansetleading);
01278     
01279     setmenuitemenable (hmenu, justifyitem, x.flcansetjust);
01280 
01281 #endif
01282 
01283     hmenu = shellmenuhandle (findandreplacemenu); /*Find and Replace sub-menu*/
01284                 
01285     if (hmenu)
01286         enableallmenuitems (hmenu, flwindow);
01287 
01288     hmenu = shellmenuhandle (commonstylesmenu); /*Common Styles sub-menu*/
01289 
01290     if (hmenu) {
01291 
01292         short i = 0;
01293 
01294         enableallmenuitems (hmenu, (x.flcansetfont && x.flcansetsize));
01295         
01296         for (i = 1; i < 5; i++) {
01297 
01298             bigstring bsitem;
01299 
01300             setemptystring (bsitem);
01301 
01302             if (flwindow)
01303 
01304                 getcommonstylesmenuitemtext (i, bsitem);
01305             
01306             setmenuitem (hmenu, i, bsitem); /*Set item text.*/
01307             } /*for*/
01308 
01309         } /*if*/
01310 
01311     L2: /*goto here to skip the adjustment of the edit menu*/
01312     
01313     if (!x.flcansetsize)
01314         goto L3;
01315 
01316     hmenu = shellmenuhandle (sizemenu);
01317     
01318     if (hmenu == nil) /*skip edit menu adjusting*/
01319         goto L3;
01320         
01321     enablemenuitem (hmenu, point9item);
01322     
01323     enablemenuitem (hmenu, point10item);
01324     
01325     enablemenuitem (hmenu, point12item);
01326     
01327     enablemenuitem (hmenu, point14item);
01328     
01329     enablemenuitem (hmenu, point18item);
01330     
01331     enablemenuitem (hmenu, point24item);
01332     
01333     enablemenuitem (hmenu, pointupitem);
01334     
01335     enablemenuitem (hmenu, pointdownitem);
01336     
01337     enablemenuitem (hmenu, pointcustomitem);
01338     
01339     L3: /*goto here to skip the adjustment of the size menu*/
01340     
01341     if (!x.flcansetstyle)
01342         goto L4;
01343 
01344 #ifndef PIKE
01345 
01346     hmenu = shellmenuhandle (stylemenu);
01347     
01348     if (hmenu == nil) /*skip edit menu adjusting*/
01349         goto L4;
01350         
01351     enablemenuitem (hmenu, plainitem);
01352     
01353     enablemenuitem (hmenu, bolditem);
01354     
01355     enablemenuitem (hmenu, italicitem);
01356     
01357     enablemenuitem (hmenu, underlineitem);
01358     
01359     enablemenuitem (hmenu, outlineitem);
01360     
01361     enablemenuitem (hmenu, shadowitem);
01362     
01363     /*
01364     enablemenuitem (hmenu, condenseditem);
01365     */
01366     
01367     enablemenuitem (hmenu, superscriptitem);
01368     
01369     enablemenuitem (hmenu, subscriptitem);
01370 
01371 #endif  
01372 
01373     L4: /*goto here to skip the adjustment of the style menu*/
01374     
01375     if (!x.flcansetleading)
01376         goto L5;
01377 
01378 #ifndef PIKE
01379 
01380     hmenu = shellmenuhandle (leadingmenu);
01381     
01382     if (hmenu == nil) /*skip edit menu adjusting*/
01383         goto L5;
01384     
01385     enablemenuitem (hmenu, leading0item);
01386 
01387     enablemenuitem (hmenu, leading1item);
01388 
01389     enablemenuitem (hmenu, leading2item);
01390 
01391     enablemenuitem (hmenu, leading3item);
01392 
01393     enablemenuitem (hmenu, leading4item);
01394 
01395     enablemenuitem (hmenu, leading5item);
01396 
01397     enablemenuitem (hmenu, leadingcustomitem);
01398 
01399 #endif
01400 
01401     L5: /*goto here to skip the adjustment of the leading menu*/
01402     
01403     if (!x.flcansetjust)
01404         goto L6;
01405 
01406 #ifndef PIKE
01407 
01408     hmenu = shellmenuhandle (justifymenu);
01409     
01410     if (hmenu == nil) /*skip edit menu adjusting*/
01411         goto L6;
01412         
01413     enablemenuitem (hmenu, leftjustifyitem);
01414 
01415     enablemenuitem (hmenu, centerjustifyitem);
01416 
01417     enablemenuitem (hmenu, rightjustifyitem);
01418 
01419     enablemenuitem (hmenu, fulljustifyitem);
01420 
01421 #endif
01422 
01423     L6: /*goto here to skip the adjustment of the justify menu*/
01424 
01425 
01426     if (x.flcansetfont) {
01427         
01428         hmenu = shellmenuhandle (fontmenu);
01429         
01430         if (hmenu)
01431             enableallmenuitems (hmenu, flwindow);
01432         }
01433 
01434 #ifndef PIKE
01435 
01436     hmenu = shellmenuhandle (newobjectmenu);
01437     
01438     if (hmenu)
01439         enableallmenuitems (hmenu, true);
01440 
01441     /* 2005-09-25 creedon - open recent menu */
01442     
01443     hmenu = shellmenuhandle (openrecentmenu);
01444     
01445     if (hmenu)
01446         enableallmenuitems (hmenu, true);
01447 #endif
01448 
01449     #ifdef WIN95VERSION
01450         hmenu = shellmenuhandle (helpmenu);
01451         
01452         if (hmenu)
01453             enableallmenuitems (hmenu, true);
01454     #endif
01455     
01456     shelladjustundo ();
01457     
01458     shellcallmenuhooks (0, 0); /*let menu hooks update their menu items*/
01459     } /*shelladjustmenus*/
01460 
01461 
01462 void shellupdatemenus (void) {
01463     
01464     /*
01465     2006-02-19 aradke: enable open recent menu on classic Mac OS too
01466     */
01467     
01468     tymenustate newstate;
01469     
01470     if (optionkeydown ())
01471         newstate = optionmenus;
01472     else
01473         newstate = normalmenus;
01474     
01475     if (menustate != newstate) {
01476         
01477     //  grabthreadglobals ();
01478         
01479         shelladjustmenus ();
01480         
01481     //  releasethreadglobals ();
01482             
01483         menustate = newstate;
01484         }
01485     
01486     if (shellwindowinfo && (**shellwindowinfo).selectioninfo.fldirty) /*update style menus*/
01487         shellcheckfontsizestyle ();
01488     
01489     shellupdatewindowmenu ();
01490     
01491 #ifndef PIKE
01492     shellupdateopenrecentmenu ();   /* 2006-02-11 aradke */
01493 #endif
01494     } /*shellupdatemenus*/
01495     
01496     
01497 boolean shellhandlemenu (long menucode) {
01498 
01499     /*
01500     5/19/93 dmb: closefunc uses getfrontwindow, not shellwindow
01501 
01502     7.0d6 PBS: With Pike's now-standard File menu, it's necessary to use kernel routines for New and Open. Run scripts in Pike for everything else.
01503     
01504     2005-09-25 creedon: changed so that all targets can call scripts for some file/edit menu commands
01505                      added open recent menu
01506     
01507     2005-12-31 creedon: for host databases that don't have a Frontier.tools table, provide some of the basic file commands so that folks can work
01508                         with databases
01509 
01510     2006-02-11 aradke: enable open recent menu on win32
01511     */
01512     
01513     register short idmenu, iditem;
01514     
01515     /*
01516     if there's an open window, it should already be pushed.   we don't want 
01517     to push it again, since some operations (like close) will dispose 
01518     of it, and popping globals would then fail
01519     */
01520     
01521     iditem = LoWord (menucode);
01522     
01523     idmenu = HiWord (menucode); 
01524     
01525     // grabthreadglobals ();
01526     
01527     #ifdef WIN95VERSION
01528         iditem -= idmenu;
01529 
01530         if (idmenu == 0)
01531             idmenu = editmenu;
01532     #endif
01533 
01534     if (iditem == 0)
01535         goto exitmenu;
01536     
01537     if (!shellcallmenuhooks (idmenu, iditem)) /*intercepted by a hook*/
01538         goto exitmenu;
01539     
01540     if (iditem < 0) /*was a disabled item*/
01541         goto exitmenu;
01542     
01543     switch (idmenu) {
01544    
01545         #ifdef MACVERSION
01546         case applemenu: 
01547             switch (iditem) {
01548             
01549                 case aboutitem:
01550                     aboutcommand ();
01551                     
01552                     break;
01553                 
01554                 default: {
01555                 
01556                     bigstring bs;
01557                     
01558                     getmenuitem (happlemenu, iditem, bs);
01559                     
01560                     shellapplemenu (bs);
01561                     
01562                     break;
01563                     }
01564                 } /*switch*/
01565             
01566             break; /*applemenu*/
01567         #endif
01568 
01569         #ifdef WIN95VERSION
01570         case helpmenu: 
01571             switch (iditem) {
01572             
01573                 case aboutitem:
01574                     aboutcommand ();
01575                     
01576                     break;
01577                 } /*switch*/
01578             
01579             break; /*helpmenu*/
01580         #endif
01581 
01582         case filemenu: {
01583         
01584             boolean flkernelhandledcommand = false, flfoundrootwindow = false;
01585         
01586             WindowPtr w = shellwindow;
01587             Handle hdata;
01588             hdlwindowinfo hinfo;
01589             
01590             if (w == nil) {
01591                 flfoundrootwindow = ccfindrootwindow (&hinfo);
01592                 if (flfoundrootwindow)
01593                     w = (**hinfo).macwindow;
01594                 }
01595 
01596             switch (iditem) {
01597                 
01598                 case closeitem: /* possibly close an Error Info window */
01599             
01600                     if (shellfindwindow (idlangerrorconfig, &w, &hinfo, &hdata)) { /* is there an Error Info window? */
01601             
01602                         if (w == getfrontwindow ()) { /* is the Error Info window in front? */
01603                         
01604                             shellclose (w, true); /* close the Error Info window */
01605             
01606                             flkernelhandledcommand = true; /* the kernel handled the command */
01607                             } /* if */
01608                         } /* if */
01609             
01610                     break;
01611             
01612                 case quititem:
01613                     
01614                     if (!flfoundrootwindow) {
01615                         shellquit ();
01616                             
01617                         flkernelhandledcommand = true;
01618                         }
01619                         
01620                     break;
01621                     
01622                 #ifndef PIKE
01623             
01624                 case newitem:
01625                     shellnew ();
01626                     
01627                     flkernelhandledcommand = true;
01628                 
01629                     break;
01630             
01631                 case pagesetupitem:
01632                     shellpagesetup ();
01633                     
01634                     flkernelhandledcommand = true;
01635                 
01636                     break;
01637                 
01638                 case printitem:
01639                     shellprint (w, true);
01640                     
01641                     flkernelhandledcommand = true;
01642                 
01643                     break;
01644             
01645                 case saverunnableitem:
01646                     shellsaveas (w, nil, true);
01647                     
01648                     flkernelhandledcommand = true;
01649                 
01650                     break;
01651                 
01652                 #endif
01653             
01654                 } /*switch*/
01655             
01656             if (!flkernelhandledcommand) { /*Run the script if special cases weren't handled above. */
01657             
01658 #ifndef PIKE
01659             
01660                 bigstring bs;
01661                 boolean flrunfilemenuscript = langrunstringnoerror (BIGSTRING ("\x2C" "Frontier.tools.windowTypes.runFileMenuScript"), bs);             
01662                 
01663                 if (flrunfilemenuscript) {
01664             
01665 #endif
01666             
01667                     runfilemenuscript (iditem);
01668                     
01669 #ifndef PIKE
01670                     }
01671                 else { /* if the script is not defined then we try to do some menu items without the script */
01672                 
01673                     switch (iditem) {
01674                     
01675                         case openitem:
01676                             shellopen ();
01677                                             
01678                             break;
01679                     
01680                         case closeitem:
01681                             if (keyboardstatus.floptionkey)
01682                                 shellcloseall (w, true);
01683                             else
01684                                 shellclose (getfrontwindow (), true);
01685                             
01686                             break;
01687                         
01688                         case saveitem:
01689                             shellsave (w);
01690                             
01691                             break;
01692                     
01693                         case saveasitem:
01694                             shellsaveas (w, nil, false);
01695                             
01696                             break;
01697                     
01698                         case revertitem:
01699                             shellrevert (w, true);
01700                             
01701                             break;
01702                     
01703                         } /*switch*/
01704                     
01705                     } /* else */
01706                         
01707 #endif
01708                 } /* if(!flkernelhandledcommand) */
01709             
01710             break; /* file menu */
01711             }
01712         
01713         case editmenu:
01714             #if MACVERSION
01715             
01716             if (iditem <= clearitem) { /*standard edit menu command*/
01717                 //Code change by Timothy Paustian Friday, June 16, 2000 3:02:01 PM
01718                 //Changed to Opaque call for Carbon
01719                 //we don't need this for carbon.
01720                 #if !TARGET_API_MAC_CARBON
01721                 if (SystemEdit (iditem - 1)) /*consumed by desk accessory*/
01722                     break;
01723                 #endif
01724 
01725                 if (uisEdit (iditem - 1)) /*consumed by shared window*/
01726                     break;
01727                 }
01728 
01729             #endif
01730             
01731             if (iditem <= selectallitem) {
01732 
01733                 shelleditcommand ((tyeditcommand) (iditem - undoitem));
01734                 
01735                 break;
01736                 }
01737             
01738             runeditmenuscript (editmenu, iditem); /*7.0b27 PBS */
01739             
01740             break; /*edit menu*/
01741             
01742         case fontmenu: {
01743         
01744             bigstring bs;
01745             short fontnumber;
01746             
01747             if (shellwindowinfo == nil) {   /* 2006-02-25 aradke: defensive driving, requires front window */
01748                 ouch ();
01749                 break;
01750                 }
01751                 
01752             getmenuitem (shellmenuhandle (fontmenu), iditem, bs);
01753             
01754             fontgetnumber (bs, &fontnumber);
01755             
01756             (**shellwindowinfo).selectioninfo.fontnum = fontnumber;
01757             
01758             (*shellglobals.fontroutine) ();
01759             
01760             break;
01761             } /*font menu*/
01762             
01763         case windowsmenu:
01764             shellwindowmenuselect (iditem);
01765             
01766             break;
01767             
01768 #ifdef sizemenu
01769         case sizemenu: {
01770             
01771             short size = 0;
01772             
01773             if (shellwindowinfo == nil) {   /* 2006-02-25 aradke: defensive driving, requires front window */
01774                 ouch ();
01775                 break;
01776                 }
01777             
01778             switch (iditem) {
01779                 
01780                 case point9item:
01781                     size = 9;
01782                     
01783                     break;
01784                     
01785                 case point10item:
01786                     size = 10;
01787                     
01788                     break;
01789                     
01790                 case point12item:
01791                     size = 12;
01792                     
01793                     break;
01794                     
01795                 case point14item:
01796                     size = 14;
01797                     
01798                     break;
01799                     
01800                 case point18item:
01801                     size = 18;
01802                     
01803                     break;
01804                     
01805                 case point24item:
01806                     size = 24;
01807                     
01808                     break;
01809                 
01810                 case pointupitem:
01811                     size = (**shellwindowinfo).selectioninfo.fontsize + 1;
01812                     
01813                     break;
01814                     
01815                 case pointdownitem: 
01816                     size = (**shellwindowinfo).selectioninfo.fontsize;
01817                     
01818                     if (size == 1) /*can't get any smaller*/
01819                         ouch ();
01820                     else
01821                         size--;
01822             
01823                     break;
01824                     
01825                 case pointcustomitem: {
01826                 
01827                     short customsize = (**shellwindowinfo).selectioninfo.fontsize;
01828                     bigstring bs;
01829                     
01830                     shellgetstring (customsizestring, bs);
01831                     
01832                     if (!intdialog (bs, &customsize)) /*user hit Cancel*/
01833                         goto exitmenu;
01834                         
01835                     size = customsize;
01836                     
01837                     break;
01838                     }
01839                     
01840                 } /*switch*/
01841                 
01842             if (size != 0) {
01843                 
01844                 (**shellwindowinfo).selectioninfo.fontsize = size;
01845             
01846                 (*shellglobals.sizeroutine) ();
01847                 }
01848                 
01849             break;
01850             } /*size menu*/
01851 #endif
01852 
01853 #ifdef stylemenu            
01854         case stylemenu: {
01855             
01856             tyselectioninfo x;
01857             
01858             if (shellwindowinfo == nil) {   /* 2006-02-25 aradke: defensive driving, requires front window */
01859                 ouch ();
01860                 break;
01861                 }
01862             
01863             clearbytes (&x, sizeof (x)); /*set all flags to false*/
01864             
01865             switch (iditem) {
01866                 
01867                 case plainitem:
01868                     /*
01869                     x.flplain = true;
01870                     */
01871                     
01872                     break;
01873                     
01874                 case bolditem:
01875                     x.fontstyle |= bold;
01876                     
01877                     break;
01878                     
01879                 case italicitem:
01880                     x.fontstyle |= italic;
01881                     
01882                     break;
01883                     
01884                 case underlineitem:
01885                     x.fontstyle |= underline;
01886                     
01887                     break;
01888                     
01889                 case outlineitem:
01890                     x.fontstyle |= outline;
01891                     
01892                     break;
01893                     
01894                 case shadowitem:
01895                     x.fontstyle |= shadow;
01896                     
01897                     break;
01898                 /*
01899                 case condenseditem:
01900                     x.fontstyle |= condensed;
01901                     
01902                     break;
01903                 
01904                 case superscriptitem:
01905                     x.fontstyle |= superscript;
01906                     
01907                     break;
01908                     
01909                 case subscriptitem:
01910                     x.fontstyle |= subscript;
01911                     
01912                     break;
01913                 */  
01914                 } /*switch*/
01915             
01916             (**shellwindowinfo).selectioninfo = x;
01917             
01918             (*shellglobals.styleroutine) ();
01919             
01920             break;
01921             } /*style menu*/
01922 #endif
01923 
01924 #ifdef justifymenu      
01925         case justifymenu: {
01926             
01927             register tyjustification justification = unknownjustification;
01928             
01929             if (shellwindowinfo == nil) {   /* 2006-02-25 aradke: defensive driving, requires front window */
01930                 ouch ();
01931                 break;
01932                 }
01933             
01934             switch (iditem) {
01935                 
01936                 case leftjustifyitem:
01937                     justification = leftjustified;
01938                     
01939                     break;
01940                     
01941                 case centerjustifyitem:
01942                     justification = centerjustified;
01943                     
01944                     break;
01945                     
01946                 case rightjustifyitem:
01947                     justification = rightjustified;
01948                     
01949                     break;
01950                     
01951                 case fulljustifyitem:
01952                     justification = fulljustified;
01953                     
01954                     break;
01955                     
01956                 } /*switch*/
01957                 
01958             if (justification != unknownjustification) {
01959                 
01960                 (**shellwindowinfo).selectioninfo.justification = justification;
01961             
01962                 (*shellglobals.justifyroutine) ();
01963                 }
01964                 
01965             break;
01966             } /*justify menu*/
01967 #endif
01968 
01969 #ifdef leadingmenu          
01970         case leadingmenu: {
01971             
01972             register short leading = -1;
01973             
01974             if (shellwindowinfo == nil) {   /* 2006-02-25 aradke: defensive driving, requires front window */
01975                 ouch ();
01976                 break;
01977                 }
01978             
01979             switch (iditem) {
01980                 
01981                 case leading0item:
01982                     leading = 0;
01983                     
01984                     break;
01985                     
01986                 case leading1item:
01987                     leading = 1;
01988                     
01989                     break;
01990                     
01991                 case leading2item:
01992                     leading = 2;
01993                     
01994                     break;
01995                     
01996                 case leading3item:
01997                     leading = 3;
01998                     
01999                     break;
02000                     
02001                 case leading4item:
02002                     leading = 4;
02003                     
02004                     break;
02005                     
02006                 case leading5item:
02007                     leading = 5;
02008                     
02009                     break;
02010                     
02011                 case leadingcustomitem:{
02012                 
02013                     short customleading;
02014                     bigstring bs;
02015                     
02016                     shellgetstring (customleadingstring, bs);
02017                     
02018                     leading = (**shellwindowinfo).selectioninfo.leading;
02019                     
02020                     if (leading < 0) /*-1 means there's no consistent leading*/
02021                         leading = 0;
02022                         
02023                     customleading = leading;
02024                     
02025                     if (!intdialog (bs, &customleading)) /*user hit Cancel*/
02026                         goto exitmenu;
02027                         
02028                     leading = customleading;
02029                     
02030                     break;
02031                     }
02032                     
02033                 } /*switch*/
02034                 
02035             if (leading >= 0) {
02036                 
02037                 leading = min (leading, 144); /*max 2" leading*/
02038                 
02039                 (**shellwindowinfo).selectioninfo.leading = leading;
02040             
02041                 (*shellglobals.leadingroutine) ();
02042                 }
02043                 
02044             break;
02045             } /*leading menu*/
02046 #endif
02047         
02048             case findandreplacemenu:
02049             case commonstylesmenu:
02050 
02051                 runeditmenuscript (idmenu, iditem);
02052 
02053                 break;
02054 
02055         #ifdef MACVERSION
02056         case virtualmenu: { /*special key on the extended keyboard*/
02057             
02058             switch (iditem) {
02059                 
02060                 case helpitem:
02061                     aboutcommand (); /*until we have help...*/
02062                     
02063                     break;
02064                 
02065                 case homeitem:
02066                     (*shellglobals.scrollroutine) (down, false, longinfinity);
02067                     
02068                     break;
02069                 
02070                 case enditem:
02071                     (*shellglobals.scrollroutine) (up, false, longinfinity);
02072                     
02073                     break;
02074                 
02075                 case pageupitem:
02076                     (*shellglobals.scrollroutine) (down, true, 1);
02077                     
02078                     break;
02079                 
02080                 case pagedownitem:
02081                     (*shellglobals.scrollroutine) (up, true, 1);
02082                     
02083                     break;
02084                 }
02085                 
02086             break;
02087             } /* virtual menu */
02088 
02089         #endif  //MACVERSION
02090 
02091         #ifndef PIKE
02092         
02093         case openrecentmenu: {
02094         
02095             runopenrecentmenuscript (iditem);   /* 2006-02-11 aradke */
02096                 
02097             break;
02098             } /* openrecentmenu */
02099 
02100         #endif  
02101 
02102     #ifdef WIN95VERSION
02103     //  case defaultpopupmenuid:
02104     //      (*winpopupselectroutine) (NULL, iditem);
02105     //      break;
02106     #endif
02107         } /*switching*/
02108     
02109     exitmenu:
02110     
02111     hilitemenu (0);
02112     
02113 //  releasethreadglobals ();
02114 
02115     return (idmenu != 0);
02116     } /*shellhandlemenu*/
02117 
02118 
02119 void runfilemenuscript (short ixmenu) {
02120     
02121     /*
02122     2005-09-14 creedon: changed name from pikerunfilemenuscript to runfilemenuscript, all targets can now run a script associated with some of
02123                         the file menu commands
02124     
02125     7.1b4 PBS: get script string from resource, don't hard-code.
02126 
02127     6.2a2 AR: Call the pike.runFileMenuScript script to eventually run the script associated with the current menu command.
02128     */
02129 
02130     bigstring bsscript, bsitem, bsresult;
02131 
02132     if (roottable == nil)
02133         return;
02134 
02135     getfilemenuitemidentifier (ixmenu, bsitem);
02136 
02137     getsystemtablescript (idrunfilemenuscript, bsscript); /*7.1b4: get from resource.*/
02138     
02139     /*copystring ("\x1c""pike.runFileMenuScript(\"^0\")", bsscript);*/
02140 
02141     parsedialogstring (bsscript, bsitem, nil, nil, nil, bsscript);
02142 
02143     grabthreadglobals ();
02144     
02145     langrunstringnoerror (bsscript, bsresult);
02146 
02147     releasethreadglobals ();
02148     }/* runfilemenuscript */
02149 
02150 
02151 void getfilemenuitemidentifier (short ixmenu, bigstring bsitem) {
02152 
02153     /*
02154     2005-09-14 creedon: changed name from pikerunfilemenuscript to runfilemenuscript, all targets can now run a script associated with some of the file menu commands
02155     
02156     6.2a2 AR: Convert an index into Pike's File menu into the name of that item for use in a call to builtins.pike scripts.
02157 
02158     7.0d6 PBS: Pike's File menu has changed -- it's more like a standard File menu, with
02159     New and Open commands, no more What Is This? command.
02160 
02161     7.0d10 PBS: Added case for Radio UserLand's Update Radio.root... command.
02162     
02163     7.0b25 PBS: Added case for Radio UserLand's Work Offline command.
02164     
02165     7.0b32 PBS: Cases for Save As HTML and Save As Plain Text.
02166     */
02167 
02168     switch (ixmenu) {
02169 
02170         case openitem:
02171             copystring (BIGSTRING ("\x04""open"), bsitem);
02172             break;
02173         
02174         case closeitem:
02175             copystring (BIGSTRING ("\x05""close"), bsitem);
02176             break;
02177 
02178         case saveitem:
02179             copystring (BIGSTRING ("\x04""save"), bsitem);
02180             break;
02181 
02182         case saveasitem:
02183             copystring (BIGSTRING ("\x06""saveas"), bsitem);
02184             break;
02185         
02186         case revertitem:
02187             copystring (BIGSTRING ("\x06""revert"), bsitem);
02188             break;
02189         
02190         case quititem:
02191             copystring (BIGSTRING ("\x04""quit"), bsitem);
02192             break;
02193             
02194         #ifdef PIKE
02195 
02196         case newitem:
02197             copystring (BIGSTRING ("\x03""new"), bsitem);
02198             break;
02199         
02200         case openurlitem: /*7.0b17 PBS*/
02201             copystring (BIGSTRING ("\x07""openurl"), bsitem);
02202             break;
02203 
02204         #ifndef OPMLEDITOR
02205             
02206         case openmanilasiteitem: /*7.0b27 PBS*/
02207             copystring (BIGSTRING ("\x0e""openmanilasite"), bsitem);
02208             break;
02209         
02210         case saveashtmlitem:
02211             copystring (BIGSTRING ("\x0a""saveashtml"), bsitem);
02212             break;
02213             
02214         case saveasplaintextitem:
02215             copystring (BIGSTRING ("\x0f""saveasplaintext"), bsitem);
02216             break;
02217         
02218         #endif 
02219             
02220         case viewinbrowseritem:
02221             copystring (BIGSTRING ("\x0d""viewinbrowser"), bsitem);
02222             break;
02223 
02224         case updateradiorootitem:       /*7.0d10 PBS*/
02225             copystring (BIGSTRING ("\x06""update"), bsitem);
02226             break;
02227         
02228         case workofflineitem: /*7.0b25 PBS*/
02229             copystring (BIGSTRING ("\x0b""workoffline"), bsitem); 
02230             break;
02231 
02232         #endif //PIKE
02233 
02234         default:
02235             assert (false);
02236             break;
02237 
02238         }/*switch*/
02239 
02240     }/* getfilemenuitemidentifier */
02241 
02242 
02243 void runopenrecentmenuscript (short iditem) {
02244     
02245     /*
02246     2005-09-24 creedon: created
02247     */
02248 
02249     bigstring bsscript, bsitem, bsresult;
02250     
02251     // getfilemenuitemidentifier (ixmenu, bsitem);
02252 
02253     getsystemtablescript (idrunopenrecentmenuscript, bsscript); /* get from resource */
02254     
02255     // copystring ("\x39""Frontier.tools.windowTypes.runOpenRecentMenuScript (\"^0\")", bsscript);
02256 
02257     numbertostring (iditem, bsitem);
02258     
02259     parsedialogstring (bsscript, bsitem, nil, nil, nil, bsscript);
02260 
02261     grabthreadglobals ();
02262     
02263     langrunstringnoerror (bsscript, bsresult);
02264 
02265     releasethreadglobals ();
02266     } /* runopenrecentmenuscript */
02267 
02268 
02269 void getcommonstylesmenuitemtext (short ixmenu, bigstring bsmenuitem) {
02270     
02271     /*
02272     2005-09-25 creedon: changed name from pikegetcommonstylesmenuitemtext to getcommonstylesmenuitemtext, all targets can now run a script associated with some of the edit menu commands
02273     
02274     7.0b26 PBS: Get the text that appears in a Common Styles item.
02275     */
02276 
02277     bigstring bsscript, bsitem;
02278 
02279     setemptystring (bsitem);
02280 
02281     switch (ixmenu) {
02282 
02283         case 1:
02284 
02285             copystring (BIGSTRING ("\x04""tiny"), bsitem);
02286 
02287             break;
02288 
02289         case 2:
02290 
02291             copystring (BIGSTRING ("\x06""medium"), bsitem);
02292 
02293             break;
02294 
02295 
02296         case 3:
02297 
02298             copystring (BIGSTRING ("\x08""readable"), bsitem);
02299 
02300             break;
02301 
02302 
02303         case 4:
02304 
02305             copystring (BIGSTRING ("\x04""huge"), bsitem);
02306 
02307             break;      
02308         } /*switch*/
02309 
02310     copystring (BIGSTRING ("\x22""menus.scripts.styleMenuItem (\"^0\")"), bsscript);
02311 
02312     parsedialogstring (bsscript, bsitem, nil, nil, nil, bsscript);
02313 
02314     grabthreadglobals ();
02315     
02316     langrunstringnoerror (bsscript, bsmenuitem);
02317 
02318     releasethreadglobals ();
02319     } /* getcommonstylesmenuitemtext */
02320 
02321 
02322 void runeditmenuscript (short idmenu, short iditem) {
02323         
02324     /*
02325     2005-09-25 creedon: changed name from pikeruneditmenuscript to runeditmenuscript, all targets can now run a script associated with some of the edit menu commands
02326 
02327     7.1b4 PBS: get script from resource, don't hard-code.
02328 
02329     7.0b26 PBS: Call pike.runEditMenuScript to run the script associated with
02330     the current menu command.
02331     */
02332 
02333     bigstring bsscript, bsitem, bsresult;
02334 
02335     if (roottable == nil)
02336         return;
02337 
02338     geteditmenuitemidentifier (idmenu, iditem, bsitem);
02339 
02340     /*copystring ("\x1c""pike.runEditMenuScript(\"^0\")", bsscript);*/
02341 
02342     getsystemtablescript (idruneditmenuscript, bsscript); 
02343 
02344     parsedialogstring (bsscript, bsitem, nil, nil, nil, bsscript);
02345 
02346     grabthreadglobals ();
02347     
02348     langrunstringnoerror (bsscript, bsresult);
02349 
02350     releasethreadglobals ();
02351     } /* runeditmenuscript */
02352 
02353 void geteditmenuitemidentifier (short ixmenu, short ixitem, bigstring bsitem) {
02354 
02355     /*
02356     2005-09-25 creedon: changed name from pikegeteditmenuitemidentifier to geteditmenuitemidentifier, all targets can now run a script associated with some of the edit menu commands
02357 
02358     7.0b26 PBS: Get the identifier for an Edit menu item in the Find and Replace or Common Styles menu.
02359     */
02360     
02361     if (ixmenu == editmenu) {
02362         
02363         switch (ixitem) {
02364 
02365 #ifdef PIKE
02366 #ifndef OPMLEDITOR  
02367 
02368             case opennotepaditem:
02369                 copystring (BIGSTRING ("\x0b""opennotepad"), bsitem);
02370                 break;
02371 
02372 #endif // !OPMLEDITOR       
02373 #endif // PIKE
02374 
02375             case insertdatetimeitem:
02376                 copystring (BIGSTRING ("\x0e""insertdatetime"), bsitem);
02377                 break;
02378             } /*switch*/
02379         } /*if*/
02380             
02381     
02382     if (ixmenu == findandreplacemenu) {
02383 
02384         switch (ixitem) {
02385 
02386             case 1:
02387                 copystring (BIGSTRING ("\x04""find"), bsitem);
02388                 break;
02389 
02390             case 2:
02391                 copystring (BIGSTRING ("\x07""replace"), bsitem);
02392                 break;
02393 
02394             case 3:
02395                 copystring (BIGSTRING ("\x08""findnext"), bsitem);
02396                 break;
02397 
02398             case 4:
02399                 copystring (BIGSTRING ("\x12""replaceandfindnext"), bsitem);
02400                 break;
02401 
02402             } /*switch*/
02403         } /*if*/
02404 
02405     if (ixmenu == commonstylesmenu) {
02406 
02407         switch (ixitem) {
02408 
02409             case 1:
02410                 copystring (BIGSTRING ("\x04""tiny"), bsitem);
02411                 break;
02412 
02413             case 2:
02414                 copystring (BIGSTRING ("\x06""medium"), bsitem);
02415                 break;
02416 
02417             case 3:
02418                 copystring (BIGSTRING ("\x08""readable"), bsitem);
02419                 break;
02420 
02421             case 4:
02422                 copystring (BIGSTRING ("\x04""huge"), bsitem);
02423                 break;
02424 
02425             } /*switch*/
02426         } /*if*/
02427     }/* geteditmenuitemidentifier */
02428 
02429 
02430 #ifdef openrecentmenu
02431 
02432 static boolean openrecentmenuitemsvisit (bigstring bs, hdlhashnode hnode, tyvaluerecord val, ptrvoid refcon) {
02433 
02434     /*
02435     2005-09-24 creedon: created
02436     */
02437     
02438     register hdlmenu hmenu;
02439     
02440     deletestring (bs, 1, 9);
02441     
02442     hmenu = shellmenuhandle (openrecentmenu);
02443     
02444     // InsertMenuItemTextWithCFString (hmenu, CFStringCreateWithPascalString (NULL, bs, kCFStringEncodingMacRoman), 0, 0, 0);
02445     
02446     Insertmenuitem (hmenu, 1, bs);
02447     
02448     return (false); // always return false so that hashsortedinversesearch will visit all nodes
02449     } /* openrecentmenuitemsvisit */
02450 
02451 #endif
02452 
02453 void shellupdateopenrecentmenu (void) {
02454 
02455     /*
02456     2005-10-01 creedon: when no files are listed in the menu, disable all menu items
02457                made more accessible to windows platform
02458     
02459     2005-09-22 creedon: created
02460     */
02461     
02462 #ifdef openrecentmenu
02463 
02464     bigstring bs;
02465     boolean fl;
02466     hdlhashtable htable;
02467     register hdlmenu hmenu;
02468 
02469     hmenu = shellmenuhandle (openrecentmenu);
02470 
02471     deletemenuitems (hmenu, 1, countmenuitems (hmenu) - 2);
02472     
02473     getsystemtablescript (idopenrecentmenutable, bs); // "user.prefs.openrecentmenu.items"
02474 
02475     pushhashtable (roottable);
02476 
02477     disablelangerror ();
02478 
02479     fl = langexpandtodotparams (bs, &htable, bs);
02480 
02481     enablelangerror ();
02482 
02483     pophashtable ();
02484 
02485     if (fl)
02486         hashsortedinversesearch (htable, &openrecentmenuitemsvisit, nil);
02487     
02488     if (countmenuitems (hmenu) == 2)
02489         disableallmenuitems (hmenu);
02490 
02491 #endif
02492 
02493     } /* shellupdateopenrecentmenu */
02494 

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