langmodeless.c

Go to the documentation of this file.
00001 
00002 /*  $Id: langmodeless.c 1218 2006-04-07 15:25:44Z 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 "cursor.h"
00033 #include "dialogs.h"
00034 #include "kb.h"
00035 #include "mouse.h"
00036 #include "frontierconfig.h"
00037 #include "ops.h"
00038 #include "scrap.h"
00039 #include "strings.h"
00040 #include "timedate.h"
00041 #include "frontierwindows.h"
00042 #include "shell.h"
00043 #include "lang.h"
00044 #include "langinternal.h"
00045 #include "process.h"
00046 
00047 
00048 
00049 typedef struct tydialogrecord {
00050     
00051     boolean flactive: 1; /*determines whether items are drawn as active or inactive*/
00052     
00053     boolean flwindowopen: 1;
00054     
00055     boolean flstillalive: 1;
00056     
00057     short dialogid;
00058     
00059     short defaultitem;
00060     
00061     short itemhit;
00062     
00063     hdltreenode itemhitroutine; /*itemhit handler script*/
00064     
00065     DialogPtr pdialog;
00066     
00067     hdlprocessrecord hprocess;
00068     
00069     long dialogrefcon; /*optional data for the next layer up*/
00070     } tydialogrecord, *ptrdialogrecord, **hdldialogrecord;
00071     
00072 
00073 
00074 WindowPtr langdialogwindow = nil;
00075 
00076 hdlwindowinfo langdialogwindowinfo = nil;
00077 
00078 hdldialogrecord langdialogdata = nil;
00079 
00080 
00081 
00082 
00083 static boolean langdialogselectall (void) {
00084     
00085     DialogPtr pdialog = GetDialogFromWindow (langdialogwindow);
00086     
00087     return (dialogselectall (pdialog));
00088     } /*langdialogselectall*/
00089 
00090 
00091 static boolean langdialogsearch (void) {
00092     
00093     /*
00094     we don't want to handle search commands, but don't want them to fail
00095     either.  instead, we'll find the window behind us and let it handle it
00096     */
00097     
00098     WindowPtr nextwindow;
00099     boolean fl;
00100     
00101     nextwindow = shellnextwindow (langdialogwindow);
00102     
00103     if (nextwindow == nil)
00104         return (false);
00105     
00106     shellpushglobals (nextwindow);
00107     
00108     fl = (*shellglobals.searchroutine) ();
00109     
00110     shellpopglobals ();
00111     
00112     return (fl);
00113     } /*langdialogsearch*/
00114 
00115 
00116 static boolean langdialoggettargetdata (short id) {
00117     
00118     /*
00119     2.1b3 dmb: use new hprocess field to allow modeless dialog to be the 
00120     target of another process
00121     */
00122     
00123     register hdldialogrecord hd = langdialogdata;
00124     
00125     if (currentprocess == (**hd).hprocess) /*don't want our script to operate on our window*/
00126         return (false);
00127     
00128     return (id == -1); /*true if target type is generic -- a shell verb*/
00129     
00130     } /*langdialoggettargetdata*/
00131 
00132 
00133 static boolean langdialogmousedown (Point pt, tyclickflags flags){
00134 #pragma unused (pt, flags)
00135 
00136     register hdldialogrecord hd = langdialogdata;
00137     short item;
00138     
00139     #if TARGET_API_MAC_CARBON
00140     DialogPtr   theDial = GetDialogFromWindow(langdialogwindow);
00141     if(dialogevent (&shellevent, theDial, &item))
00142     #else
00143     if (dialogevent (&shellevent, langdialogwindow, &item))
00144     #endif
00145     { /*mouse in text item*/
00146         
00147         (**hd).itemhit = item;
00148         
00149         shellevent.when = gettickcount ();
00150         
00151         mouseup (shellevent.when, shellevent.where.h, shellevent.where.v, shellevent.what); /*textedit may swallow the mouseup event when tracking click*/
00152         }
00153     
00154     return (true);
00155     } /*langdialogmousedown*/
00156 
00157 
00158 static boolean langdialogkeystroke (void) {
00159     
00160     register hdldialogrecord hd = langdialogdata;
00161     short item;
00162     #if TARGET_API_MAC_CARBON
00163     DialogPtr theDial = GetDialogFromWindow(langdialogwindow);
00164     if (dialogevent (&shellevent, theDial, &item)) 
00165     #else
00166     if (dialogevent (&shellevent, langdialogwindow, &item))
00167     #endif
00168     {
00169         (**hd).itemhit = item;
00170     }
00171     
00172     return (true);
00173     } /*langdialogkeystroke*/
00174 
00175 
00176 static boolean langdialogitemhit (hdltreenode, short, boolean); /*forward*/
00177 
00178 
00179 static boolean langdialogclose (void) {
00180     
00181     /*
00182     2.1b3 dmb: special case for no threads
00183     
00184     5.0.2b13 dmb: pay attention to processyield return
00185     
00186     7.0b36 PBS: Carbon change. The dialog will be disposed while yielding during the while loop.
00187     So the reference to (**hd).flstillalive at the top of the loop causes a crash, as hd is no longer valid.
00188     The work-around is to check (in the Carbon version) that (*hd) != -1.
00189     Though this works, it's not very nice. A better answer requires more serious re-architecting.
00190     */
00191     
00192     register hdldialogrecord hd = langdialogdata;
00193     
00194     (**hd).flwindowopen = false;
00195     
00196     if (flcanusethreads) {
00197         
00198         (**hd).itemhit = -2; /*close*/
00199         
00200         #if TARGET_API_MAC_CARBON
00201 
00202             while (((char)((long)*hd) != -1) && ((**hd).flstillalive)) { /*make sure it's handled before window is disposed*/
00203                 
00204                 processchecktimeouts ();
00205                 
00206                 if (!processyield ())
00207                     return (false);
00208                 }
00209             
00210         #else
00211         
00212             while ((**hd).flstillalive) { /*make sure it's handled before window is disposed*/
00213                 
00214                 processchecktimeouts ();
00215                 
00216                 if (!processyield ())
00217                     return (false);
00218                 }
00219             
00220         #endif
00221         
00222         }
00223     else {
00224         langdialogitemhit ((**hd).itemhitroutine, -2, false);
00225         }
00226     
00227     return (true);
00228     } /*langdialogclose*/
00229 
00230 
00231 static void langdialogupdate (void) {
00232     
00233     /*
00234     2.1b5 dmb: make sure the event we pass is an update event; shellevent 
00235     may be an activate or os event
00236     */
00237     
00238     EventRecord event = shellevent;
00239     
00240     event.what = updateEvt;
00241     #if TARGET_API_MAC_CARBON
00242     {
00243     DialogPtr   theDial = GetDialogFromWindow(langdialogwindow);
00244     dialogupdate (&event, theDial);
00245     }
00246     #else
00247     dialogupdate (&event, (DialogPtr) langdialogwindow);
00248     #endif
00249     } /*langdialogupdate*/
00250 
00251 
00252 static void langdialogactivate (boolean flactivate) {
00253     
00254     (**langdialogdata).flactive = flactivate;
00255     #if TARGET_API_MAC_CARBON
00256     {
00257     DialogPtr   theDial = GetDialogFromWindow(langdialogwindow);
00258     dialogactivate (theDial, flactivate);
00259     }
00260     #else
00261     dialogactivate (langdialogwindow, flactivate);
00262     #endif
00263     } /*langdialogactivate*/
00264 
00265 
00266 static boolean langdialogadjustcursor (Point pt){
00267 #pragma unused (pt)
00268 
00269     setcursortype (cursorisarrow);
00270     
00271     return (true);
00272     } /*langdialogadjustcursor*/
00273     
00274 
00275 /*
00276 static boolean langdialogsetfontsize (void) {
00277     
00278     register hdlwindowinfo hw = langdialogwindowinfo;
00279     
00280     dialogsetfontsize (langdialogwindow, (**hw).defaultfont, (**hw).defaultsize);
00281     
00282     return (true);
00283     } /%langdialogsetfontsize%/
00284 
00285 
00286 static boolean langdialogsetfont (void) {
00287     
00288     shelldefaultfontroutine (); /%set windowinfo record defaultfont field%/
00289     
00290     return (langdialogsetfontsize ());
00291     } /%langdialogsetfont%/
00292     
00293 
00294 static boolean langdialogsetsize (void) {
00295     
00296     shelldefaultsizeroutine (); /%set windowinfo record defaultfont field%/
00297     
00298     return (langdialogsetfontsize ());
00299     } /%langdialogsetsize%/
00300 */
00301 
00302 
00303 static boolean langdialogsetselectioninfo (void) {
00304     
00305     clearbytes (&(**langdialogwindowinfo).selectioninfo, longsizeof (tyselectioninfo)); /*can't set font/size/style*/
00306     
00307     return (true);
00308     } /*langdialogsetselectioninfo*/
00309 
00310 
00311 static void langdialogidle (void) {
00312     
00313     #if TARGET_API_MAC_CARBON
00314     {
00315     DialogPtr   theDial = GetDialogFromWindow(langdialogwindow);
00316     dialogidle (theDial);
00317     }
00318     #else
00319     dialogidle (langdialogwindow);
00320     #endif
00321     } /*langdialogidle*/
00322 
00323 
00324 static boolean langdialogcopy (void) {
00325     
00326     Handle htext;
00327     
00328     #if TARGET_API_MAC_CARBON
00329     DialogPtr   theDial = GetDialogFromWindow(langdialogwindow);
00330     DialogCopy (theDial);
00331     #else
00332     DialogCopy (langdialogwindow);
00333     #endif
00334     
00335     if (!copyhandle (TEScrapHandle (), &htext))
00336         return (false);
00337     
00338     return (shellsetscrap (htext, textscraptype, (shelldisposescrapcallback) &disposehandle, nil));
00339     } /*langdialogcopy*/
00340 
00341 
00342 static boolean langdialogpaste (void) {
00343     
00344     Handle htext;
00345     boolean fltempscrap;
00346     
00347     if (!shellconvertscrap (textscraptype, &htext, &fltempscrap))
00348         return (false);
00349     
00350     copyhandlecontents (htext, TEScrapHandle ());
00351     
00352     TESetScrapLength (gethandlesize (htext));
00353     
00354     if (fltempscrap)
00355         DisposeHandle (htext);
00356     
00357     shellwritescrap (textscraptype); // 5.1.6: Mac OS 8.5 fix?
00358     
00359     #if TARGET_API_MAC_CARBON
00360     {
00361     DialogPtr   theDial = GetDialogFromWindow(langdialogwindow);
00362     DialogPaste (theDial);
00363     }
00364     #else
00365     DialogPaste (langdialogwindow);
00366     #endif
00367     return (true);
00368     } /*langdialogpaste*/
00369 
00370 
00371 static boolean langdialogclear (void) {
00372     
00373     #if TARGET_API_MAC_CARBON
00374     DialogPtr   theDial = GetDialogFromWindow(langdialogwindow);
00375     DialogDelete (theDial);
00376     #else
00377     DialogDelete (langdialogwindow);
00378     #endif
00379     return (true);
00380     } /*langdialogclear*/
00381 
00382 
00383 static boolean langdialogcut (void) {
00384     
00385     if (!langdialogcopy ())
00386         return (false);
00387     
00388     return (langdialogclear ());
00389     } /*langdialogcut*/
00390 
00391 
00392 static langtreenodecallback savedebugger;
00393 
00394 
00395 static boolean langdialogdebugger (hdltreenode hnode) {
00396     
00397     /*
00398     show the line that's about to be executed.  then restore the 
00399     debugger callback so we don't get called again.
00400     
00401     return false so that the routine stops running
00402     
00403     5/20/92 dmb: debuggercallback now gets hdltreenode parameter
00404     */
00405     
00406     register hdlerrorstack hs = langcallbacks.scripterrorstack;
00407     tyerrorrecord errorrecord = (**hs).stack [(**hs).toperror - 1];
00408     
00409     (*errorrecord.errorcallback) (errorrecord.errorrefcon, (**hnode).lnum, -1, nil, nil);
00410     
00411     langcallbacks.debuggercallback = savedebugger;
00412     
00413     return (false);
00414     } /*langdialogdebugger*/
00415 
00416 
00417 static boolean langdialogitemhit (hdltreenode htree, short itemnumber, boolean flzoomscript) {
00418     
00419     /*
00420     we're going to call the handler code with itemnumber as a parameter.
00421     
00422     we'll form the code tree for the parameter list (itemnumber) by hand.
00423     */
00424     
00425     hdltreenode hparam;
00426     tyvaluerecord val;
00427     register boolean fl;
00428     DialogPtr savedialogwindow;
00429     
00430     cleartmpstack ();
00431     
00432     setintvalue (itemnumber, &val);
00433     
00434     if (!newconstnode (val, &hparam))
00435         return (false);
00436     
00437     savedialogwindow = langmodaldialog; /*save in local stack*/
00438     
00439     if (flzoomscript) {
00440         
00441         savedebugger = langcallbacks.debuggercallback;
00442         
00443         langcallbacks.debuggercallback = &langdialogdebugger;
00444         }
00445     #if TARGET_API_MAC_CARBON
00446     langmodaldialog = GetDialogFromWindow(langdialogwindow); /*make current for langdialog verbs*/
00447     #else
00448     langmodaldialog = langdialogwindow; /*make current for langdialog verbs*/
00449     #endif
00450     fl = langhandlercall (htree, hparam, &val);
00451     
00452     langmodaldialog = savedialogwindow; /*restore*/
00453     
00454     if (flzoomscript) { /*make sure it's restored*/
00455         
00456         langcallbacks.debuggercallback = savedebugger;
00457         
00458         return (true);
00459         }
00460     
00461     langdisposetree (hparam);
00462     
00463     if (!fl)
00464         return (false);
00465     
00466     if (!coercetoboolean (&val))
00467         return (false);
00468     
00469     return (val.data.flvalue);
00470     } /*langdialogitemhit*/
00471 
00472 
00473 static void langdialogdispose (hdldialogrecord hdialog) {
00474     
00475     register hdldialogrecord hd = hdialog;
00476     
00477     if ((**hd).flwindowopen)
00478     {   
00479         #if TARGET_API_MAC_CARBON
00480         shellclosewindow (GetDialogWindow((**hd).pdialog));
00481         #else
00482         shellclosewindow ((**hd).pdialog);
00483         #endif
00484     }
00485     disposehandle ((Handle) hdialog);
00486     } /*langdialogdispose*/
00487 
00488 
00489 typedef struct finddialoginfo {
00490 
00491     short idtofind;
00492 
00493     hdldialogrecord hdialogfound;
00494     } tyfinddialoginfo, *ptrfinddialoginfo;
00495 
00496 
00497 static boolean finddialogvisit (WindowPtr w, ptrvoid refcon) {
00498     
00499     ptrfinddialoginfo findinfo = (ptrfinddialoginfo) refcon;
00500     hdlwindowinfo hinfo;
00501     hdldialogrecord hd;
00502     
00503     getwindowinfo (w, &hinfo);
00504     
00505     hd = (hdldialogrecord) (**hinfo).hdata;
00506     
00507     if (hd == nil) /*paranoia -- if it's nil, keep visiting*/
00508         return (true);
00509     
00510     if ((**hd).dialogid != (*findinfo).idtofind) /*it's not the right one*/
00511         return (true);
00512     
00513     (*findinfo).hdialogfound = hd;
00514     
00515     return (false);
00516     } /*finddialogvisit*/
00517 
00518 
00519 static boolean langdialogfindwindow (short dialogid, hdldialogrecord *hdialog) {
00520     
00521     tyfinddialoginfo findinfo;
00522     
00523     findinfo.idtofind = dialogid;
00524     
00525     if (shellvisittypedwindows (idlangdialogconfig, &finddialogvisit, &findinfo)) /*didn't find it*/
00526         return (false);
00527     
00528     *hdialog = findinfo.hdialogfound;
00529     
00530     return (true);
00531     } /*langdialogfindwindow*/
00532 
00533 
00534 static boolean langdialognewwindow (short dialogid, short defaultitem, hdltreenode htree, hdldialogrecord *hdialog) {
00535     
00536     /*
00537     2.1b3 dmb: set the hprocess new field to the current process
00538     
00539     5.0.2b10 dmb: for 5.0, we need to pass in the window title
00540     */
00541     
00542     register hdldialogrecord hd;
00543     Rect rzoom, rwindow;
00544     hdlwindowinfo hparent;
00545     tyconfigrecord lconfig;
00546     DialogTHndl hdlog;
00547     bigstring bstitle;
00548     
00549     if (!shellgetfrontrootinfo (&hparent)) /*our parent is the frontmost root window*/
00550         return (false);
00551     
00552     if (!newclearhandle (longsizeof (tydialogrecord), (Handle *) hdialog))
00553         return (false);
00554     
00555     hd = langdialogdata = *hdialog; /*copy into register*/
00556     
00557     (**hd).dialogid = dialogid;
00558     
00559     (**hd).defaultitem = defaultitem;
00560     
00561     (**hd).itemhitroutine = htree;
00562     
00563     (**hd).hprocess = currentprocess; /*2.1b3*/
00564     
00565     rzoom.top = -1; /*zoom from default rect*/
00566     
00567     rwindow.top = -1; /*by default, use default*/
00568     
00569     hdlog = (DialogTHndl) GetResource ('DLOG', dialogid);
00570     
00571     if (hdlog != nil) {
00572         
00573         copystring ((**hdlog).title, bstitle);
00574         
00575         rwindow = (**hdlog).boundsRect;
00576         }
00577     
00578     shellgetconfig (idlangdialogconfig, &lconfig);
00579     
00580     lconfig.templateresnum = dialogid;
00581     
00582     shellsetconfig (idlangdialogconfig, lconfig);
00583     
00584     if (!newchildwindow (idlangdialogconfig, hparent, &rwindow, &rzoom, bstitle, &langdialogwindow)) {
00585         
00586         disposehandle ((Handle) hd);
00587         
00588         return (false);
00589         }
00590     {
00591     #if TARGET_API_MAC_CARBON == 1
00592     DialogPtr   theDial = GetDialogFromWindow(langdialogwindow);
00593     setdefaultitem (theDial, defaultitem);
00594     (**hd).pdialog = theDial;
00595     #else
00596     setdefaultitem(langdialogwindow, defaultitem);
00597     (**hd).pdialog = langdialogwindow;
00598     #endif
00599         
00600     }
00601     (**hd).flwindowopen = true;
00602     
00603     getwindowinfo (langdialogwindow, &langdialogwindowinfo);
00604     
00605     (**langdialogwindowinfo).hdata = (Handle) hd;
00606     
00607     return (true);
00608     } /*langdialognewwindow*/
00609 
00610 
00611 static boolean langdialogsleepexpired (void) {
00612     
00613     /*
00614     9/11/92 dmb: late-breaking feature: support clock.sleepFor in modeless 
00615     dialogs. unlike agents, dialogs sleep forever by default. but if they 
00616     establish a sleep period, they'll get send a itemhit (-3) if it expires 
00617     before any other itemhit
00618     */
00619     
00620     unsigned long x = (**currentprocess).sleepuntil;
00621     
00622     if (x == 0)
00623         return (false);
00624     
00625     return (timenow () >= x);
00626     } /*langdialogsleepexpired*/
00627 
00628 
00629 boolean langrunmodeless (hdltreenode hparam1, tyvaluerecord *vreturned) {
00630     
00631     /*
00632     run a modeless dialog.  we're expecting to be called with three arguments:
00633         
00634         rundialog (dialogid, defaultitem, itemhitcallback)
00635     
00636     after extracting these value, we construct a code tree for:
00637         
00638         itemhitcallback^
00639         
00640     and place the result in the langdialog record.  langdialogitemhit will 
00641     construct a parameter list for each call, and call back to the item 
00642     hit routine.
00643     
00644     11/5/91 dmb: added call to languserescaped
00645     
00646     12/4/91 dmb: call processnotbusy before loop, not in it.
00647     
00648     2.1b3 dmb: special case for no threads
00649     */
00650     
00651     short dialogid;
00652     short defaultitem;
00653     tyvaluerecord val;
00654     hdltreenode htree;
00655     hdldialogrecord hdialog;
00656     register hdldialogrecord hd;
00657     register short itemhit;
00658     register boolean fl;
00659     boolean flzoomscript;
00660     
00661     if (!getintvalue (hparam1, 1, &dialogid))
00662         return (false);
00663     
00664     if (!getintvalue (hparam1, 2, &defaultitem))
00665         return (false);
00666     
00667     flnextparamislast = true;
00668     
00669     if (!getaddressparam (hparam1, 3, &val))
00670         return (false);
00671     
00672     if (langdialogfindwindow (dialogid, &hdialog)) { /*already running -- just bring to front*/
00673         
00674         #if TARGET_API_MAC_CARBON
00675         windowbringtofront (GetDialogWindow((**hdialog).pdialog)); /***should use windowinfo*/
00676         #else
00677         windowbringtofront ((**hdialog).pdialog); /***should use windowinfo*/
00678         #endif
00679         setbooleanvalue (true, vreturned);
00680         
00681         return (true);
00682         }
00683     
00684     if (!pushfunctionreference (val, &htree))
00685         return (false);
00686     
00687     if (!langdialognewwindow (dialogid, defaultitem, htree, &hdialog)) {
00688         
00689         langlongparamerror (cantloaddialogerror, dialogid);
00690         
00691         langdisposetree (htree);
00692         
00693         return (false);
00694         }
00695     
00696     hd = hdialog; /*copy into register*/
00697     
00698     if (!langdialogitemhit (htree, -1, false)) /*initialization failed*/
00699         goto exit;
00700     
00701     #if TARGET_API_MAC_CARBON
00702     shellpushglobals (GetDialogWindow((**hd).pdialog));
00703     dialogselectall(GetDialogFromWindow(shellwindow));
00704     #else
00705     shellpushglobals ((**hd).pdialog);
00706     dialogselectall (shellwindow); /*in case there's a text item*/
00707     #endif
00708     
00709     windowzoom (shellwindow);
00710     
00711     shellbringtofront (shellwindowinfo); /*in case we're running under the debugger*/
00712     
00713     shellpopglobals ();
00714     
00715     (**hd).flstillalive = true;
00716     
00717     processnotbusy (); /*un-dim menus*/
00718     
00719     while (true) {
00720         
00721         if (flcanusethreads) {
00722             
00723             if (!processsleep (nil, 10)) {
00724                 
00725                 fllangerror = true; /*make sure we return false*/
00726                 
00727                 break;
00728                 }
00729             }
00730         else {
00731             
00732             shellshorteventloop ();
00733             
00734             if (!(**hd).flwindowopen)
00735                 break;
00736             }
00737         
00738         if (languserescaped (true)) /*script was killed by user*/
00739             break;
00740         
00741         itemhit = (**hd).itemhit;
00742         
00743         if (itemhit == 0) {
00744             
00745             if (langdialogsleepexpired ())
00746                 itemhit = -3;
00747             }
00748         
00749         if (itemhit != 0) {
00750             
00751             flzoomscript = (itemhit > 0) && keyboardstatus.floptionkey;
00752             
00753             #if TARGET_API_MAC_CARBON == 1
00754             
00755                 flzoomscript = false;   /*7.1b37 PBS: wiring off a feature that: 1. no one knows about and 2. crashes anyway.*/
00756                                         /*Attempting to support this feature also causes crashes.*/
00757                                         /*That's why it's gone.*/
00758             
00759             #endif
00760             
00761             (**hd).itemhit = 0; /*clear for next time*/
00762             
00763             (**currentprocess).sleepuntil = 0; /*script must reestablish sleep each time*/
00764             
00765             if (dialogitemisbutton ((**hd).pdialog, itemhit))
00766                 dialogselectall ((**hd).pdialog);
00767             
00768             fl = langdialogitemhit (htree, itemhit, flzoomscript);
00769             
00770             if (itemhit == -2) { /*window was closed*/
00771                 
00772                 (**hd).flstillalive = false;
00773                 
00774                 processyield (); /*let langdialogclose finish executing*/
00775                 
00776                 break;
00777                 }
00778             
00779             if (!fl) /*itemhit routine returned false*/
00780                 break;
00781             
00782             if (!flzoomscript) {
00783                 
00784                 if (debuggingcurrentprocess ())
00785                 {
00786                     #if TARGET_API_MAC_CARBON
00787                     windowbringtofront (GetDialogWindow((**hd).pdialog)); /***should use windowinfo*/
00788                     #else
00789                     windowbringtofront ((**hd).pdialog); /***should use windowinfo*/
00790                     #endif
00791                 }
00792                 }
00793             }
00794         }
00795     
00796     exit:
00797     
00798     (**hd).flstillalive = false;
00799     
00800     langdialogdispose (hd);
00801     
00802     langdisposetree (htree);
00803     
00804     setbooleanvalue (true, vreturned);
00805     
00806     return (!fllangerror);
00807     } /*langrunmodeless*/
00808 
00809 
00810 boolean langdialogstart (void) {
00811     
00812     /*
00813     set up callback routines record, and link our data into the shell's 
00814     data structure.
00815     */
00816     
00817     ptrcallbacks langdialogcallbacks;
00818     register ptrcallbacks cb;
00819     
00820     shellnewcallbacks (&langdialogcallbacks);
00821     
00822     cb = langdialogcallbacks; /*copy into register*/
00823     
00824     loadconfigresource (idlangdialogconfig, &(*cb).config);
00825     
00826     (*cb).configresnum = idlangdialogconfig;
00827     
00828     (*cb).windowholder = &langdialogwindow;
00829     
00830     (*cb).dataholder = (Handle *) &langdialogdata;
00831     
00832     (*cb).infoholder = &langdialogwindowinfo; 
00833     
00834     (*cb).activateroutine = &langdialogactivate;
00835     
00836     (*cb).updateroutine = &langdialogupdate;
00837     
00838     (*cb).mouseroutine = &langdialogmousedown;
00839     
00840     (*cb).keystrokeroutine = &langdialogkeystroke;
00841     
00842     (*cb).closeroutine = &langdialogclose;
00843     
00844     (*cb).adjustcursorroutine = &langdialogadjustcursor;
00845     
00846     (*cb).idleroutine = &langdialogidle;
00847     
00848     (*cb).cutroutine = &langdialogcut;
00849     
00850     (*cb).copyroutine = &langdialogcopy;
00851     
00852     (*cb).pasteroutine = &langdialogpaste;
00853     
00854     (*cb).clearroutine = &langdialogclear;
00855     
00856     /*
00857     (*cb).fontroutine = &langdialogsetfont;
00858     
00859     (*cb).sizeroutine = &langdialogsetsize;
00860     */
00861     
00862     (*cb).setselectioninforoutine = &langdialogsetselectioninfo;
00863     
00864     (*cb).selectallroutine = &langdialogselectall;
00865     
00866     (*cb).searchroutine = &langdialogsearch;
00867     
00868     (*cb).gettargetdataroutine = &langdialoggettargetdata;
00869     
00870     return (true);
00871     } /*langdialogstart*/
00872 
00873 
00874 

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