ioa.c

Go to the documentation of this file.
00001 
00002 /*  $Id: ioa.c 1197 2006-04-05 22:01:22Z karstenw $    */
00003 
00004 /******************************************************************************
00005 
00006     UserLand Frontier(tm) -- High performance Web content management,
00007     object database, system-level and Internet scripting environment,
00008     including source code editing and debugging.
00009 
00010     Copyright (C) 1992-2004 UserLand Software, Inc.
00011 
00012     This program is free software; you can redistribute it and/or modify
00013     it under the terms of the GNU General Public License as published by
00014     the Free Software Foundation; either version 2 of the License, or
00015     (at your option) any later version.
00016 
00017     This program is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020     GNU General Public License for more details.
00021 
00022     You should have received a copy of the GNU General Public License
00023     along with this program; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 
00026 ******************************************************************************/
00027 
00028 /*
00029     7/31/96 dmb: fixed debugobjectcommandProcInfo
00030 */
00031 
00032 #include "frontier.h"
00033 #include "standard.h"
00034 
00035 #include "ioa.h"
00036   
00037 #ifdef THINK_C
00038     
00039     #include <SetUpA4.h>
00040     #define EnterCodeResource() do {RememberA0 ();SetUpA4();} while (0)
00041     #define ExitCodeResource()  RestoreA4()
00042 
00043 #endif
00044 
00045 #ifdef IOAinsideApp
00046 
00047     #include <appletmemory.h>
00048         
00049 #endif
00050 
00051 
00052 typedef pascal ComponentResult (*ComponentRoutine) (ComponentParameters *, Handle); // dmb 1/23/96
00053 
00054 typedef void (*setupcallback) (tyioaconfigrecord *);
00055     
00056 static ComponentInstance selfinstance = 0;
00057 
00058 static short resfilenum = 0;
00059 
00060 static hdlcard hcard = nil;
00061 
00062 static tyioaconfigrecord config;
00063 
00064 
00065 void IOAclearbytes (void *pclear, long ctclear) {
00066     
00067     /*
00068     fill memory with 0's.
00069     */
00070     
00071     memset(pclear, 0, ctclear);
00072     } /*IOAclearbytes*/
00073     
00074 
00075 short IOAmakemultiple (short val, short factor) {
00076     
00077     /*
00078     return a multiple of factor, round up in all cases -- that is, if
00079     it's even one more than the nearest multiple, return the next one.
00080     */
00081     
00082     if ((val % factor) == 0) /*it's already a multiple, nothing to do*/
00083         return (val);
00084         
00085     val = ((val / factor) + 1) * factor;
00086     
00087     if (val == 0)
00088         val = factor;
00089         
00090     return (val);
00091     } /*IOAmakemultiple*/
00092     
00093     
00094 short IOAclosestmultiple (short val, short factor) {
00095     
00096     /*
00097     return a multiple of factor, round to the nearest multiple.
00098     */
00099     
00100     short x, diff;
00101     
00102     if ((val % factor) == 0) /*it's already a multiple, nothing to do*/
00103         return (val);
00104     
00105     x = (val / factor) * factor;
00106     
00107     diff = val - x;
00108     
00109     if (diff >= (factor / 2)) /*move to the next stop up*/
00110         x += factor;
00111         
00112     return (x);
00113     } /*IOAclosestmultiple*/
00114     
00115 
00116 boolean IOAvisitobjects (hdlobject listhead, tyobjectvisitroutine visit) {
00117     
00118     /*
00119     visits all terminal nodes at all levels. we don't call the visit routine
00120     on group nodes.
00121     */
00122     
00123     hdlobject nomad = listhead;
00124     hdlobject nextnomad;
00125     
00126     while (nomad != nil) {
00127         
00128         nextnomad = (**nomad).nextobject;
00129         
00130         if ((**nomad).objecttype == grouptype) {
00131         
00132             if (!IOAvisitobjects ((**nomad).childobjectlist, visit))
00133                 return (false);
00134             }
00135             
00136         if (!(*visit) (nomad))
00137             return (false);
00138             
00139         nomad = nextnomad;
00140         } /*while*/
00141     
00142     return (true);
00143     } /*IOAvisitobjects*/
00144     
00145     
00146 void IOAcopystring (bssource, bsdest) void *bssource, *bsdest; {
00147 
00148     /*
00149     create a copy of bssource in bsdest.  copy the length byte and
00150     all the characters in the source string.
00151 
00152     assume the strings are pascal strings, with the length byte in
00153     the first character of the string.
00154     */
00155 
00156     short i, len;
00157     
00158     len = (short) ((char *) bssource) [0];
00159     
00160     for (i = 0; i <= len; i++) 
00161         ((char *) bsdest) [i] = ((char *) bssource) [i];
00162     } /*IOAcopystring*/
00163 
00164 
00165 boolean IOApushstring (bssource, bsdest) bigstring bssource, bsdest; {
00166 
00167     /*
00168     insert the source string at the end of the destination string.
00169     
00170     assume the strings are pascal strings, with the length byte in
00171     the first character of the string.
00172     */
00173     
00174     unsigned short lensource = stringlength (bssource);
00175     unsigned short lendest = stringlength (bsdest);
00176     char *psource, *pdest;
00177     
00178     if ((lensource + lendest) > lenbigstring)
00179         return (false);
00180         
00181     pdest = (ptrchar) bsdest + (unsigned char) lendest + 1;
00182     
00183     psource = (ptrchar) bssource + 1;
00184     
00185     bsdest [0] += (unsigned char) lensource;
00186     
00187     while (lensource--) *pdest++ = *psource++;
00188     
00189     return (true);
00190     } /*IOApushstring*/
00191     
00192     
00193 void IOAtexthandletostring (Handle htext, bigstring bs) {
00194     
00195     long len;
00196     
00197     if (htext == nil) {
00198         
00199         setstringlength (bs, 0);
00200         
00201         return;
00202         }
00203     
00204     len = GetHandleSize (htext);
00205     
00206     if (len > lenbigstring)
00207         len = lenbigstring;
00208     
00209     setstringlength (bs, len);
00210     
00211     BlockMove (*htext, &bs [1], len);
00212     } /*IOAtexthandletostring*/
00213     
00214     
00215 boolean IOAnewtexthandle (bigstring bs, Handle *htext) {
00216     
00217     /*
00218     create a new handle to hold the text of the string.
00219     
00220     if the string is "\pABC" -- you get a handle of size 3.
00221     */
00222     
00223     long len;
00224     Handle h;
00225     
00226     h = NewHandle (len = stringlength (bs));
00227     
00228     if (h == nil)
00229         return (false);
00230     
00231     if (len > 0)
00232         BlockMove (&bs [1], *h, len);
00233     
00234     *htext = h; /*pass handle back to caller*/
00235     
00236     return (true);
00237     } /*IOAnewtexthandle*/
00238 
00239 
00240 void IOAellipsize (Str255 bs, short width) {
00241 
00242     /*
00243     if the string fits inside the given number of pixels, fine -- do nothing
00244     and return.
00245     
00246     if not, return a string that does fit, with ellipses representing the 
00247     deleted characters.  ellipses are generated by pressing option-semicolon.
00248     */
00249     
00250     long len;
00251     short newwidth;
00252     
00253     if ((newwidth = StringWidth (bs)) <= width) /*nothing to do, the string fits*/
00254         return;
00255     
00256     len = (long) bs [0]; /* current length in characters*/
00257     
00258     width -= CharWidth (''); /* subtract width of ellipses*/
00259         
00260     do { /*until it fits (or we run out of characters)*/
00261     
00262         newwidth -= CharWidth (bs [len]);
00263         
00264         --len;
00265     } while ((newwidth > width) && (len != 0));
00266     
00267     ++len; /*make room for the ellipses*/
00268     
00269     bs [len] = ''; 
00270     
00271     bs [0] = (char) len;
00272     } /*IOAellipsize*/
00273     
00274 
00275 void IOAcenterstring (Rect r, bigstring bs) {
00276     
00277     /*
00278     draw the string in the current font, size and style, centered inside
00279     the indicated rectangle.
00280     */
00281     
00282     short lh; 
00283     short rh = r.bottom - r.top;
00284     short rw = r.right - r.left;
00285     short h, v;
00286     RgnHandle rgn;
00287     Rect rorigclip;
00288     FontInfo fi;
00289     
00290     GetFontInfo (&fi);
00291     
00292     lh = fi.ascent + fi.descent;
00293     
00294     IOAellipsize (bs, rw); /*make sure it fits inside the rectangle, width-wise*/
00295     
00296     h = r.left + ((rw - StringWidth (bs)) / 2);
00297     
00298     v = r.top + ((rh - lh) / 2) + fi.ascent;
00299     
00300     MoveTo (h, v);
00301     
00302     GetClip (rgn = NewRgn ());
00303     //Code change by Timothy Paustian Sunday, May 7, 2000 9:11:46 PM
00304     //Changed to Opaque call for Carbon
00305     //This is a simple one, but untested.
00306     #if ACCESSOR_CALLS_ARE_FUNCTIONS == 1
00307     GetRegionBounds(rgn, &rorigclip);
00308     #else
00309     rorigclip = (**rgn).rgnBBox;
00310     #endif
00311     DisposeRgn (rgn);
00312 
00313     ClipRect (&r);
00314     
00315     DrawString (bs);
00316     
00317     ClipRect (&rorigclip);
00318     } /*IOAcenterstring*/
00319 
00320 
00321 void IOAcenterrect (Rect *rcentered, Rect rcontains) {
00322     
00323     /*
00324     center the first rectangle within the second rectangle.
00325     */
00326     
00327     short height, width;
00328     Rect r;
00329     
00330     r = *rcentered;
00331     
00332     width = r.right - r.left;
00333     
00334     r.left = rcontains.left + ((rcontains.right - rcontains.left - width) / 2);
00335     
00336     r.right = r.left + width;
00337     
00338     height = r.bottom - r.top;
00339     
00340     r.top = rcontains.top + ((rcontains.bottom - rcontains.top - height) / 2);
00341     
00342     r.bottom = r.top + height;
00343     
00344     *rcentered = r;
00345     } /*IOAcenterrect*/
00346 
00347 
00348 void IOAgetobjectsize (hdlobject h, short *height, short *width) {
00349     
00350     (*(**hcard).IOAgetobjectsizeCallback) (h, height, width);
00351     } /*IOAgetobjectsize*/
00352     
00353 
00354 boolean IOAgetstringvalue (hdlobject h, Handle *hvalue) {
00355     
00356     return ((*(**hcard).IOAgetstringvalueCallback) (h, hvalue));
00357     } /*IOAgetstringvalue*/
00358 
00359 
00360 boolean IOApushforecolor (RGBColor *rgb) {
00361     
00362     return ((*(**hcard).IOApushforecolorCallback) (rgb));
00363     } /*IOApushforecolor*/
00364 
00365 
00366 boolean IOApopforecolor (void) {
00367     
00368     return ((*(**hcard).IOApopforecolorCallback) ());
00369     } /*IOApopforecolor*/
00370 
00371 
00372 boolean IOApushbackcolor (RGBColor *rgb) {
00373     
00374     return ((*(**hcard).IOApushbackcolorCallback) (rgb));
00375     } /*IOApushbackcolor*/
00376 
00377 
00378 boolean IOApopbackcolor (void) {
00379     
00380     return ((*(**hcard).IOApopbackcolorCallback) ());
00381     } /*IOApopbackcolor*/
00382 
00383 
00384 boolean IOArunbuttonscript (hdlobject h) {
00385     
00386     return ((*(**hcard).IOArunbuttonscriptCallback) (h));
00387     } /*IOArunbuttonscript*/
00388     
00389 
00390 boolean IOAgetbooleanvalue (hdlobject h, Handle *hvalue) {
00391     
00392     return ((*(**hcard).IOAgetbooleanvalueCallback) (h, hvalue));
00393     } /*IOAgetbooleanvalue*/
00394     
00395 
00396 boolean IOAsetbooleanvalue (hdlobject h, Handle hvalue) {
00397     
00398     return ((*(**hcard).IOAsetbooleanvalueCallback) (h, hvalue));
00399     } /*IOAsetbooleanvalue*/
00400     
00401 
00402 void IOAeditdrawtexthandle (Handle htext, Rect r, tyjustification j) {
00403     
00404     (*(**hcard).IOAeditdrawtexthandleCallback) (htext, r, j);
00405     } /*IOAeditdrawtexthandle*/
00406     
00407 
00408 boolean IOArecalcobjectvalue (hdlobject h) {
00409     
00410     return ((*(**hcard).IOArecalcobjectvalueCallback) (h));
00411     } /*IOArecalcobjectvalue*/
00412     
00413 
00414 boolean IOAevalscript (hdlobject hself, Handle hscript, Handle *hvalue, OSType idlanguage, bigstring errorstring) {
00415     
00416     return ((*(**hcard).IOAevalscriptCallback) (hself, hscript, hvalue, idlanguage, errorstring));
00417     } /*IOAevalscript*/
00418     
00419 
00420 boolean IOAsetobjectvalue (hdlobject h, Handle hvalue) {
00421     
00422     return ((*(**hcard).IOAsetobjectvalueCallback) (h, hvalue));
00423     } /*IOAsetobjectvalue*/
00424     
00425     
00426 boolean IOAgetnthstring (hdlobject h, short n, bigstring bs) {
00427 
00428     return ((*(**hcard).IOAgetnthstringCallback) (h, n, bs));
00429     } /*IOAgetnthstring*/
00430     
00431 
00432 void IOAinvalobject (hdlobject h) {
00433     
00434     (*(**hcard).IOAinvalobjectCallback) (h);
00435     } /*IOAinvalobject*/
00436     
00437 
00438 boolean IOAclearactivetextobject (void) {
00439     
00440     return ((*(**hcard).IOAclearactivetextobjectCallback) ());
00441     } /*IOAclearactivetextobject*/
00442     
00443 
00444 boolean IOAsetactivetextobject (hdlobject h) {
00445     
00446     return ((*(**hcard).IOAsetactivetextobjectCallback) (h));
00447     } /*IOAsetactivetextobject*/
00448     
00449 
00450 boolean IOAeditclick (Point pt, boolean fl, Handle h) {
00451     
00452     return ((*(**hcard).IOAeditclickCallback) (pt, fl, h));
00453     } /*IOAeditclick*/
00454     
00455 
00456 boolean IOAeditselectall (Handle h) {
00457     
00458     return ((*(**hcard).IOAeditselectallCallback) (h));
00459     } /*IOAeditselectall*/
00460     
00461 
00462 boolean IOAeditidle (Handle h) {
00463     
00464     return ((*(**hcard).IOAeditidleCallback) (h));
00465     } /*IOAeditidle*/
00466     
00467 
00468 boolean IOAeditkeystroke (char ch, Handle h) {
00469     
00470     return ((*(**hcard).IOAeditkeystrokeCallback) (ch, h));
00471     } /*IOAeditkeystroke*/
00472     
00473 
00474 Handle IOAgetactiveeditrecord (void) {
00475     
00476     return ((*(**hcard).IOAgetactiveeditrecordCallback) ());
00477     } /*IOAgetactiveeditrecord*/
00478     
00479     
00480 boolean IOAincolorwindow (hdlobject h) {
00481 #pragma unused(h)
00482 
00483     return (true); /*need to fill this in*/
00484     } /*IOAincolorwindow*/
00485     
00486 
00487 boolean IOAopenresfile (void) {
00488 
00489     resfilenum = OpenComponentResFile ((Component) selfinstance);
00490     
00491     return (resfilenum != 0);
00492     } /*IOAopenresfile*/
00493     
00494     
00495 void IOAcloseresfile (void) {
00496     
00497     if (resfilenum != 0)
00498         CloseComponentResFile (resfilenum);
00499     
00500     resfilenum = 0;
00501     } /*IOAcloseresfile*/
00502     
00503 
00504 static boolean defaultGetObjectInvalRectCallback (hdlobject h, Rect *r) {
00505     
00506     *r = (**h).objectrect;
00507     
00508     return (true);
00509     } /*defaultGetObjectInvalRectCallback*/
00510     
00511 
00512 static boolean defaultDebugObjectCallback (hdlobject h, bigstring errorstring) {
00513 #pragma unused(h)
00514 
00515     IOAcopystring ("\pbad object type", errorstring);
00516     
00517     return (false);
00518     } /*defaultDebugObjectCallback*/
00519     
00520     
00521 static boolean defaultRecalcObjectCallback (hdlobject h, boolean flmajorrecalc) {
00522 #pragma unused(h, flmajorrecalc)
00523 
00524     return (true);
00525     } /*defaultRecalcObjectCallback*/
00526     
00527 
00528 static boolean defaultClickObjectCallback (hdlobject listhead, hdlobject h, Point pt, boolean flshiftkey, boolean fl2click) {
00529 #pragma unused(h, listhead, pt, flshiftkey, fl2click)
00530 
00531     return (false); /*don't do a minor recalc*/
00532     } /*defaultClickObjectCallback*/
00533     
00534 
00535 static boolean defaultSetObjectCursorCallback (hdlobject h, Point pt) {
00536 #pragma unused(h, pt)
00537 
00538     return (false); /*we accept the default cursor*/
00539     } /*defaultSetObjectCursorCallback*/
00540     
00541     
00542 static boolean defaultCatchReturnCallback (hdlobject h) {
00543 #pragma unused(h)
00544 
00545     return (false); /*we don't want to intercept the Return key*/
00546     } /*defaultCatchReturnCallback*/
00547     
00548     
00549 static boolean defaultUnpackDataCallback (hdlobject h) {
00550 #pragma unused(h)
00551 
00552     return (true); /*do nothing*/
00553     } /*defaultUnpackDataCallback*/
00554     
00555     
00556 static boolean defaultAppleEventCallback (hdlobject h, AppleEvent *event) {
00557 #pragma unused(h, event)
00558 
00559     return (true); /*do nothing*/
00560     } /*defaultAppleEventCallback*/
00561     
00562     
00563 static boolean defaultPackDataCallback (hdlobject h, Handle *hpackeddata) {
00564     
00565     *hpackeddata = (**h).objectdata; /*return a copy of the objectdata handle*/
00566     
00567     if (*hpackeddata != nil)
00568         HandToHand (hpackeddata);
00569     
00570     return (true);
00571     } /*defaultPackDataCallback*/
00572     
00573     
00574 static boolean defaultDisposeDataCallback (hdlobject h) {
00575 #pragma unused(h)
00576 
00577     return (true);
00578     } /*defaultDisposeDataCallback*/
00579     
00580     
00581 static void callsetuproutine (setupcallback pcallback, tyioaconfigrecord *pconfig) {
00582 // 2006-04-03 - kw --- renamed parameter config -> pconfig  
00583     IOAclearbytes (pconfig, longsizeof (tyioaconfigrecord));
00584     
00585     (*pconfig).setValueFromScriptCallback = IOAsetobjectvalue;
00586     
00587     (*pconfig).getObjectInvalRectCallback = defaultGetObjectInvalRectCallback;
00588     
00589     (*pconfig).recalcObjectCallback = defaultRecalcObjectCallback;
00590     
00591     (*pconfig).debugObjectCallback = defaultDebugObjectCallback;
00592     
00593     (*pconfig).clickObjectCallback = defaultClickObjectCallback;
00594     
00595     (*pconfig).setObjectCursorCallback = defaultSetObjectCursorCallback;
00596     
00597     (*pconfig).catchReturnCallback = defaultCatchReturnCallback;
00598     
00599     (*pconfig).getAttributesCallback = defaultAppleEventCallback;
00600     
00601     (*pconfig).setAttributesCallback = defaultAppleEventCallback;
00602     
00603     (*pconfig).packDataCallback = defaultPackDataCallback;
00604     
00605     (*pconfig).unpackDataCallback = defaultUnpackDataCallback;
00606     
00607     (*pconfig).disposeDataCallback = defaultDisposeDataCallback;
00608     
00609     (*pconfig).handlesMouseTrack = false;
00610     
00611     (*pconfig).editableInRunMode = false;
00612     
00613     (*pconfig).isFontAware = true;
00614     
00615     (*pcallback) (pconfig);
00616     } /*callsetuproutine*/
00617 
00618 
00619 void name_of_IOA_setup_routine (tyioaconfigrecord *); /*forward declaration*/
00620     
00621     
00622 static pascal ComponentResult IOAopen (ComponentInstance self) {
00623     
00624     selfinstance = self; /*copy into global*/
00625     
00626     #ifndef IOAinsideApp
00627     
00628         callsetuproutine (name_of_IOA_setup_routine, &config);
00629         
00630     #endif
00631     
00632     return (noErr);
00633     } /*IOAopen*/
00634 
00635 
00636 static pascal ComponentResult IOAclose (ComponentInstance self) {
00637 #pragma unused(self)
00638 
00639     return (noErr);
00640     } /*IOAclose*/
00641 
00642 
00643 static pascal ComponentResult IOAcando (short selector) {
00644 
00645     switch (selector) {
00646     
00647         case kComponentOpenSelect: 
00648         case kComponentCloseSelect:
00649         case kComponentCanDoSelect: 
00650         case kComponentVersionSelect:
00651         
00652         case IOAgetconfigcommand:
00653         case IOAinitobjectcommand:
00654         case IOAdrawobjectcommand:
00655         case IOAeditobjectcommand:
00656         case IOAkeystrokecommand:
00657         case IOAidlecommand:
00658         case IOAclickcommand:
00659         case IOAcleanupcommand:
00660         case IOArecalccommand:
00661         case IOAcanreplicatcommand:
00662         case IOAcatchreturncommand:
00663         case IOAgetobjectinvalrectcommand:
00664         case IOAgetobjecteditrectcommand:
00665         case IOAgetvaluecommand:
00666         case IOAsetvaluecommand:
00667         case IOAsetcursorcommand:
00668         case IOAunpackdatacommand:
00669         case IOAdebugobjectcommand:
00670         case IOAgetattributescommand:
00671         case IOAsetattributescommand:
00672         case IOAgeticoncommand:
00673         case IOAgetcardcommand:
00674         case IOApackdatacommand:
00675         case IOAdisposedatacommand:
00676         
00677             return (true);
00678         
00679         } /*switch*/
00680         
00681     return (false);
00682     } /*IOAcando*/
00683 
00684 
00685 static pascal ComponentResult IOAversion (void) {
00686 
00687     return (1);
00688     } /*IOAversion*/
00689 
00690 
00691 static pascal ComponentResult getconfigcommand (tyioaconfigrecord *stackedconfig) {
00692     
00693     BlockMove (&config, stackedconfig, longsizeof (tyioaconfigrecord));
00694 
00695     return (true);
00696     } /*getconfigcommand*/
00697 
00698 
00699 static pascal ComponentResult initobjectcommand (tyobject *obj) {
00700     
00701     return ((*config.initObjectCallback) (obj));
00702     } /*initobjectcommand*/
00703 
00704 
00705 static pascal ComponentResult drawobjectcommand (hdlobject h) {
00706     
00707     hcard = (**h).owningcard; /*set global for callbacks*/
00708     
00709     return ((*config.drawObjectCallback) (h));
00710     } /*drawobjectcommand*/
00711 
00712 
00713 static pascal ComponentResult editobjectcommand (hdlobject h, boolean flgoin) {
00714     
00715     hcard = (**h).owningcard; /*set global for callbacks*/
00716     
00717     return ((*config.editObjectCallback) (h, flgoin));
00718     } /*editobjectcommand*/
00719 
00720 
00721 static pascal ComponentResult keystrokecommand (hdlobject h, short ch) {
00722     
00723     hcard = (**h).owningcard; /*set global for callbacks*/
00724     
00725     return ((*config.keystrokeObjectCallback) (h, (char) ch));
00726     } /*keystrokecommand*/
00727 
00728 
00729 static pascal ComponentResult idleobjectcommand (hdlobject h) {
00730     
00731     hcard = (**h).owningcard; /*set global for callbacks*/
00732     
00733     return ((*config.idleObjectCallback) (h));
00734     } /*idleobjectcommand*/
00735 
00736 
00737 static pascal ComponentResult clickobjectcommand (hdlobject listhead, hdlobject h, Point pt, boolean flshiftkey, boolean fl2click) {
00738     
00739     hcard = (**h).owningcard; /*set global for callbacks*/
00740     
00741     return ((*config.clickObjectCallback) (listhead, h, pt, flshiftkey, fl2click));
00742     } /*clickobjectcommand*/
00743 
00744 
00745 static pascal ComponentResult cleanupobjectcommand (hdlobject h, short height, short width, Rect *r) {
00746     
00747     hcard = (**h).owningcard; /*set global for callbacks*/
00748     
00749     return ((*config.cleanupObjectCallback) (h, height, width, r));
00750     } /*cleanupobjectcommand*/
00751 
00752 
00753 static pascal ComponentResult recalcobjectcommand (hdlobject h, boolean flmajorrecalc) {
00754     
00755     hcard = (**h).owningcard; /*set global for callbacks*/
00756     
00757     return ((*config.recalcObjectCallback) (h, flmajorrecalc));
00758     } /*recalcobjectcommand*/
00759 
00760 
00761 static pascal ComponentResult canreplicateobjectcommand (hdlobject h) {
00762     
00763     hcard = (**h).owningcard; /*set global for callbacks*/
00764     
00765     return ((*config.canReplicateObjectCallback) (h));
00766     } /*canreplicateobjectcommand*/
00767 
00768 
00769 static pascal ComponentResult catchreturncommand (hdlobject h) {
00770     
00771     hcard = (**h).owningcard; /*set global for callbacks*/
00772     
00773     return ((*config.catchReturnCallback) (h));
00774     } /*catchreturncommand*/
00775 
00776 
00777 static pascal ComponentResult getinvalrectcommand (hdlobject h, Rect *r) {
00778     
00779     hcard = (**h).owningcard; /*set global for callbacks*/
00780     
00781     return ((*config.getObjectInvalRectCallback) (h, r));
00782     } /*getinvalrectcommand*/
00783 
00784 
00785 static pascal ComponentResult geteditrectcommand (hdlobject h, Rect *r) {
00786     
00787     hcard = (**h).owningcard; /*set global for callbacks*/
00788     
00789     return ((*config.getObjectEditRectCallback) (h, r));
00790     } /*geteditrectcommand*/
00791 
00792 
00793 static pascal ComponentResult getvaluecommand (hdlobject h, Handle *hvalue) {
00794     
00795     hcard = (**h).owningcard; /*set global for callbacks*/
00796     
00797     return ((*config.getValueForScriptCallback) (h, hvalue));
00798     } /*getvaluecommand*/
00799 
00800 
00801 static pascal ComponentResult setvaluecommand (hdlobject h, Handle hvalue) {
00802     
00803     hcard = (**h).owningcard; /*set global for callbacks*/
00804     
00805     return ((*config.setValueFromScriptCallback) (h, hvalue));
00806     } /*setvaluecommand*/
00807 
00808 
00809 static pascal ComponentResult setcursorcommand (hdlobject h, Point pt) {
00810     
00811     hcard = (**h).owningcard; /*set global for callbacks*/
00812     
00813     return ((*config.setObjectCursorCallback) (h, pt));
00814     } /*setcursorcommand*/
00815 
00816 
00817 static pascal ComponentResult unpackdatacommand (hdlobject h) {
00818     
00819     hcard = (**h).owningcard; /*set global for callbacks*/
00820     
00821     return ((*config.unpackDataCallback) (h));
00822     } /*unpackdatacommand*/
00823 
00824 
00825 static pascal ComponentResult disposedatacommand (hdlobject h) {
00826     
00827     hcard = (**h).owningcard; /*set global for callbacks*/
00828     
00829     return ((*config.disposeDataCallback) (h));
00830     } /*disposedatacommand*/
00831 
00832 
00833 static pascal ComponentResult getattributescommand (hdlobject h, AppleEvent *event) {
00834     
00835     hcard = (**h).owningcard; /*set global for callbacks*/
00836     
00837     return ((*config.getAttributesCallback) (h, event));
00838     } /*getattributescommand*/
00839 
00840 
00841 static pascal ComponentResult setattributescommand (hdlobject h, AppleEvent *event) {
00842     
00843     hcard = (**h).owningcard; /*set global for callbacks*/
00844     
00845     return ((*config.setAttributesCallback) (h, event));
00846     } /*setattributescommand*/
00847 
00848 
00849 static pascal ComponentResult geticoncommand (Handle *hicon) {
00850     
00851     Handle h;
00852     
00853     #ifdef IOAinsideApp
00854     
00855         h = GetResource ('SICN', 512 + config.objectTypeID);
00856         
00857         DetachResource (h);
00858     
00859     #else
00860     
00861         if (!IOAopenresfile ())
00862             return (false);
00863     
00864         h = GetResource ('SICN', 130);
00865         
00866         DetachResource (h);
00867     
00868         IOAcloseresfile ();
00869     
00870     #endif
00871     
00872     *hicon = h;
00873     
00874     return (true);
00875     } /*geticoncommand*/
00876     
00877 
00878 
00879 static pascal ComponentResult getcardcommand (Handle *hpackedcard) {
00880     
00881     Handle h;
00882     
00883     #ifdef IOAinsideApp
00884         h = GetResource ('CARD', 512 + config.objectTypeID);
00885         
00886         DetachResource (h);
00887     #else
00888         if (!IOAopenresfile ())
00889             return (false);
00890     
00891         h = GetResource ('CARD', 128);
00892         
00893         DetachResource (h);
00894     
00895         IOAcloseresfile ();
00896     #endif
00897 
00898     *hpackedcard = h;
00899     
00900     return (true);
00901     } /*getcardcommand*/
00902 
00903 
00904 static pascal ComponentResult packdatacommand (hdlobject h, Handle *hpackeddata) {
00905     
00906     hcard = (**h).owningcard; /*set global for callbacks*/
00907     
00908     return ((*config.packDataCallback) (h, hpackeddata));
00909     } /*packdatacommand*/
00910 
00911 
00912 static pascal ComponentResult debugobjectcommand (hdlobject h, Str255 errorstring) {
00913     
00914     hcard = (**h).owningcard; /*set global for callbacks*/
00915     
00916     return ((*config.debugObjectCallback) (h, errorstring));
00917     } /*debugobjectcommand*/
00918 
00919 //Code change by Timothy Paustian Sunday, June 25, 2000 10:29:27 PM
00920 //watch out, will this work?, I may have to check this.
00921 #if 0
00922     
00923     // UPPs are just the routine addresses
00924     #define IOAopenUPP ((ComponentFunctionUPP) &IOAopen)
00925     #define IOAcloseUPP ((ComponentFunctionUPP) &IOAclose)
00926     #define IOAcandoUPP ((ComponentFunctionUPP) &IOAcando)
00927     #define IOAversionUPP ((ComponentFunctionUPP) &IOAversion)
00928     #define getconfigcommandUPP ((ComponentFunctionUPP) &getconfigcommand)
00929     #define initobjectcommandUPP ((ComponentFunctionUPP) &initobjectcommand)
00930     #define drawobjectcommandUPP ((ComponentFunctionUPP) &drawobjectcommand)
00931     #define editobjectcommandUPP ((ComponentFunctionUPP) &editobjectcommand)
00932     #define keystrokecommandUPP ((ComponentFunctionUPP) &keystrokecommand)
00933     #define idleobjectcommandUPP ((ComponentFunctionUPP) &idleobjectcommand)
00934     #define clickobjectcommandUPP ((ComponentFunctionUPP) &clickobjectcommand)
00935     #define cleanupobjectcommandUPP ((ComponentFunctionUPP) &cleanupobjectcommand)
00936     #define recalcobjectcommandUPP ((ComponentFunctionUPP) &recalcobjectcommand)
00937     #define canreplicateobjectcommandUPP ((ComponentFunctionUPP) &canreplicateobjectcommand)
00938     #define catchreturncommandUPP ((ComponentFunctionUPP) &catchreturncommand)
00939     #define getinvalrectcommandUPP ((ComponentFunctionUPP) &getinvalrectcommand)
00940     #define geteditrectcommandUPP ((ComponentFunctionUPP) &geteditrectcommand)
00941     #define getvaluecommandUPP ((ComponentFunctionUPP) &getvaluecommand)
00942     #define setvaluecommandUPP ((ComponentFunctionUPP) &setvaluecommand)
00943     #define setcursorcommandUPP ((ComponentFunctionUPP) &setcursorcommand)
00944     #define unpackdatacommandUPP ((ComponentFunctionUPP) &unpackdatacommand)
00945     #define disposedatacommandUPP ((ComponentFunctionUPP) &disposedatacommand)
00946     #define getattributescommandUPP ((ComponentFunctionUPP) &getattributescommand)
00947     #define setattributescommandUPP ((ComponentFunctionUPP) &setattributescommand)
00948     #define geticoncommandUPP ((ComponentFunctionUPP) &geticoncommand)
00949     #define getcardcommandUPP ((ComponentFunctionUPP) &getcardcommand)
00950     #define packdatacommandUPP ((ComponentFunctionUPP) &packdatacommand)
00951     #define debugobjectcommandUPP ((ComponentFunctionUPP) &debugobjectcommand)
00952 
00953 #else
00954 
00955     // define all of the ProcInfos
00956     enum {
00957         IOAopenProcInfo = kPascalStackBased
00958             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
00959             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ComponentInstance)))
00960         };
00961     
00962     enum {
00963         IOAcloseProcInfo = kPascalStackBased
00964             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
00965             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ComponentInstance)))
00966         };
00967     
00968     enum {
00969         IOAcandoProcInfo = kPascalStackBased
00970             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
00971             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
00972         };
00973     
00974     enum {
00975         IOAversionProcInfo = kPascalStackBased
00976             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
00977         };
00978     
00979     enum {
00980         getconfigcommandProcInfo = kPascalStackBased
00981             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
00982             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(tyioaconfigrecord *)))
00983         };
00984     
00985     enum {
00986         initobjectcommandProcInfo = kPascalStackBased
00987             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
00988             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(tyobject *)))
00989         };
00990     
00991     enum {
00992         drawobjectcommandProcInfo = kPascalStackBased
00993             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
00994             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
00995         };
00996     
00997     enum {
00998         editobjectcommandProcInfo = kPascalStackBased
00999             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01000             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01001             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(boolean)))
01002         };
01003     
01004     enum {
01005         keystrokecommandProcInfo = kPascalStackBased
01006             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01007             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01008             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short)))
01009         };
01010     
01011     enum {
01012         idleobjectcommandProcInfo = kPascalStackBased
01013             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01014             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01015         };
01016     
01017     enum {
01018         clickobjectcommandProcInfo = kPascalStackBased
01019             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01020             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01021             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(hdlobject)))
01022             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Point)))
01023             | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(boolean)))
01024             | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(boolean)))
01025         };
01026     
01027     enum {
01028         cleanupobjectcommandProcInfo = kPascalStackBased
01029             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01030             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01031             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short)))
01032             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short)))
01033             | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Rect *)))
01034         };
01035     
01036     enum {
01037         recalcobjectcommandProcInfo = kPascalStackBased
01038             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01039             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01040             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(boolean)))
01041         };
01042     
01043     enum {
01044         canreplicateobjectcommandProcInfo = kPascalStackBased
01045             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01046             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01047         };
01048     
01049     enum {
01050         catchreturncommandProcInfo = kPascalStackBased
01051             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01052             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01053         };
01054     
01055     enum {
01056         getinvalrectcommandProcInfo = kPascalStackBased
01057             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01058             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01059             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Rect *)))
01060         };
01061     
01062     enum {
01063         geteditrectcommandProcInfo = kPascalStackBased
01064             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01065             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01066             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Rect *)))
01067         };
01068     
01069     enum {
01070         getvaluecommandProcInfo = kPascalStackBased
01071             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01072             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01073             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle *)))
01074         };
01075     
01076     enum {
01077         setvaluecommandProcInfo = kPascalStackBased
01078             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01079             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01080             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle)))
01081         };
01082     
01083     enum {
01084         setcursorcommandProcInfo = kPascalStackBased
01085             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01086             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01087             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Point)))
01088         };
01089     
01090     enum {
01091         unpackdatacommandProcInfo = kPascalStackBased
01092             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01093             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01094         };
01095     
01096     enum {
01097         disposedatacommandProcInfo = kPascalStackBased
01098             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01099             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01100         };
01101     
01102     enum {
01103         getattributescommandProcInfo = kPascalStackBased
01104             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01105             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01106             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(AppleEvent *)))
01107         };
01108     
01109     enum {
01110         setattributescommandProcInfo = kPascalStackBased
01111             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01112             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01113             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(AppleEvent *)))
01114         };
01115     
01116     enum {
01117         geticoncommandProcInfo = kPascalStackBased
01118             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01119             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Handle *)))
01120         };
01121     
01122     enum {
01123         getcardcommandProcInfo = kPascalStackBased
01124             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01125             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Handle *)))
01126         };
01127     
01128     enum {
01129         packdatacommandProcInfo = kPascalStackBased
01130             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01131             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01132             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle *)))
01133         };
01134     
01135     enum {
01136         debugobjectcommandProcInfo = kPascalStackBased
01137             | RESULT_SIZE(SIZE_CODE(sizeof(ComponentResult)))
01138             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlobject)))
01139             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(StringPtr)))
01140         };
01141     
01142         
01143     #if !TARGET_API_MAC_CARBON
01144     static RoutineDescriptor IOAopenDesc = BUILD_ROUTINE_DESCRIPTOR (IOAopenProcInfo, IOAopen);
01145     static RoutineDescriptor IOAcloseDesc = BUILD_ROUTINE_DESCRIPTOR (IOAcloseProcInfo, IOAclose);
01146     static RoutineDescriptor IOAcandoDesc = BUILD_ROUTINE_DESCRIPTOR (IOAcandoProcInfo, IOAcando);
01147     static RoutineDescriptor IOAversionDesc = BUILD_ROUTINE_DESCRIPTOR (IOAversionProcInfo, IOAversion);
01148     static RoutineDescriptor getconfigcommandDesc = BUILD_ROUTINE_DESCRIPTOR (getconfigcommandProcInfo, getconfigcommand);
01149     static RoutineDescriptor initobjectcommandDesc = BUILD_ROUTINE_DESCRIPTOR (initobjectcommandProcInfo, initobjectcommand);
01150     static RoutineDescriptor drawobjectcommandDesc = BUILD_ROUTINE_DESCRIPTOR (drawobjectcommandProcInfo, drawobjectcommand);
01151     static RoutineDescriptor editobjectcommandDesc = BUILD_ROUTINE_DESCRIPTOR (editobjectcommandProcInfo, editobjectcommand);
01152     static RoutineDescriptor keystrokecommandDesc = BUILD_ROUTINE_DESCRIPTOR (keystrokecommandProcInfo, keystrokecommand);
01153     static RoutineDescriptor idleobjectcommandDesc = BUILD_ROUTINE_DESCRIPTOR (idleobjectcommandProcInfo, idleobjectcommand);
01154     static RoutineDescriptor clickobjectcommandDesc = BUILD_ROUTINE_DESCRIPTOR (clickobjectcommandProcInfo, clickobjectcommand);
01155     static RoutineDescriptor cleanupobjectcommandDesc = BUILD_ROUTINE_DESCRIPTOR (cleanupobjectcommandProcInfo, cleanupobjectcommand);
01156     static RoutineDescriptor recalcobjectcommandDesc = BUILD_ROUTINE_DESCRIPTOR (recalcobjectcommandProcInfo, recalcobjectcommand);
01157     static RoutineDescriptor canreplicateobjectcommandDesc = BUILD_ROUTINE_DESCRIPTOR (canreplicateobjectcommandProcInfo, canreplicateobjectcommand);
01158     static RoutineDescriptor catchreturncommandDesc = BUILD_ROUTINE_DESCRIPTOR (catchreturncommandProcInfo, catchreturncommand);
01159     static RoutineDescriptor getinvalrectcommandDesc = BUILD_ROUTINE_DESCRIPTOR (getinvalrectcommandProcInfo, getinvalrectcommand);
01160     static RoutineDescriptor geteditrectcommandDesc = BUILD_ROUTINE_DESCRIPTOR (geteditrectcommandProcInfo, geteditrectcommand);
01161     static RoutineDescriptor getvaluecommandDesc = BUILD_ROUTINE_DESCRIPTOR (getvaluecommandProcInfo, getvaluecommand);
01162     static RoutineDescriptor setvaluecommandDesc = BUILD_ROUTINE_DESCRIPTOR (setvaluecommandProcInfo, setvaluecommand);
01163     static RoutineDescriptor setcursorcommandDesc = BUILD_ROUTINE_DESCRIPTOR (setcursorcommandProcInfo, setcursorcommand);
01164     static RoutineDescriptor unpackdatacommandDesc = BUILD_ROUTINE_DESCRIPTOR (unpackdatacommandProcInfo, unpackdatacommand);
01165     static RoutineDescriptor disposedatacommandDesc = BUILD_ROUTINE_DESCRIPTOR (disposedatacommandProcInfo, disposedatacommand);
01166     static RoutineDescriptor getattributescommandDesc = BUILD_ROUTINE_DESCRIPTOR (getattributescommandProcInfo, getattributescommand);
01167     static RoutineDescriptor setattributescommandDesc = BUILD_ROUTINE_DESCRIPTOR (setattributescommandProcInfo, setattributescommand);
01168     static RoutineDescriptor geticoncommandDesc = BUILD_ROUTINE_DESCRIPTOR (geticoncommandProcInfo, geticoncommand);
01169     static RoutineDescriptor getcardcommandDesc = BUILD_ROUTINE_DESCRIPTOR (getcardcommandProcInfo, getcardcommand);
01170     static RoutineDescriptor packdatacommandDesc = BUILD_ROUTINE_DESCRIPTOR (packdatacommandProcInfo, packdatacommand);
01171     static RoutineDescriptor debugobjectcommandDesc = BUILD_ROUTINE_DESCRIPTOR (debugobjectcommandProcInfo, debugobjectcommand);
01172     
01173     // UPPs are descriptor addresses
01174     #define IOAopenUPP (&IOAopenDesc)
01175     #define IOAcloseUPP (&IOAcloseDesc)
01176     #define IOAcandoUPP (&IOAcandoDesc)
01177     #define IOAversionUPP (&IOAversionDesc)
01178     #define getconfigcommandUPP (&getconfigcommandDesc)
01179     #define initobjectcommandUPP (&initobjectcommandDesc)
01180     #define drawobjectcommandUPP (&drawobjectcommandDesc)
01181     #define editobjectcommandUPP (&editobjectcommandDesc)
01182     #define keystrokecommandUPP (&keystrokecommandDesc)
01183     #define idleobjectcommandUPP (&idleobjectcommandDesc)
01184     #define clickobjectcommandUPP (&clickobjectcommandDesc)
01185     #define cleanupobjectcommandUPP (&cleanupobjectcommandDesc)
01186     #define recalcobjectcommandUPP (&recalcobjectcommandDesc)
01187     #define canreplicateobjectcommandUPP (&canreplicateobjectcommandDesc)
01188     #define catchreturncommandUPP (&catchreturncommandDesc)
01189     #define getinvalrectcommandUPP (&getinvalrectcommandDesc)
01190     #define geteditrectcommandUPP (&geteditrectcommandDesc)
01191     #define getvaluecommandUPP (&getvaluecommandDesc)
01192     #define setvaluecommandUPP (&setvaluecommandDesc)
01193     #define setcursorcommandUPP (&setcursorcommandDesc)
01194     #define unpackdatacommandUPP (&unpackdatacommandDesc)
01195     #define disposedatacommandUPP (&disposedatacommandDesc)
01196     #define getattributescommandUPP (&getattributescommandDesc)
01197     #define setattributescommandUPP (&setattributescommandDesc)
01198     #define geticoncommandUPP (&geticoncommandDesc)
01199     #define getcardcommandUPP (&getcardcommandDesc)
01200     #define packdatacommandUPP (&packdatacommandDesc)
01201     #define debugobjectcommandUPP (&debugobjectcommandDesc)
01202     
01203     #else //TARGET_API_MAC_CARBON
01204     /*ComponentRoutineUPP   IOAopenDesc;
01205     ComponentRoutineUPP IOAcloseDesc;
01206     ComponentRoutineUPP IOAcandoDesc;
01207     ComponentRoutineUPP IOAversionDesc;
01208     ComponentRoutineUPP getconfigcommandDesc;
01209     ComponentRoutineUPP initobjectcommandDesc;
01210     ComponentRoutineUPP drawobjectcommandDesc;
01211     ComponentRoutineUPP editobjectcommandDesc;
01212     ComponentRoutineUPP keystrokecommandDesc;
01213     ComponentRoutineUPP idleobjectcommandDesc;
01214     ComponentRoutineUPP clickobjectcommandDesc;
01215     ComponentRoutineUPP cleanupobjectcommandDesc;
01216     ComponentRoutineUPP recalcobjectcommandDesc;
01217     ComponentRoutineUPP canreplicateobjectcommandDesc;
01218     ComponentRoutineUPP catchreturncommandDesc;
01219     ComponentRoutineUPP getinvalrectcommandDesc;
01220     ComponentRoutineUPP geteditrectcommandDesc;
01221     ComponentRoutineUPP getvaluecommandDesc;
01222     ComponentRoutineUPP setvaluecommandDesc;
01223     ComponentRoutineUPP setcursorcommandDesc;
01224     ComponentRoutineUPP unpackdatacommandDesc;
01225     ComponentRoutineUPP disposedatacommandDesc;
01226     ComponentRoutineUPP getattributescommandDesc;
01227     ComponentRoutineUPP setattributescommandDesc;
01228     ComponentRoutineUPP geticoncommandDesc;
01229     ComponentRoutineUPP getcardcommandDesc;
01230     ComponentRoutineUPP packdatacommandDesc;
01231     ComponentRoutineUPP debugobjectcommandDesc;
01232     
01233     // UPPs are descriptor addresses
01234     #define IOAopenUPP (IOAopenDesc)
01235     #define IOAcloseUPP (IOAcloseDesc)
01236     #define IOAcandoUPP (IOAcandoDesc)
01237     #define IOAversionUPP (IOAversionDesc)
01238     #define getconfigcommandUPP (getconfigcommandDesc)
01239     #define initobjectcommandUPP (initobjectcommandDesc)
01240     #define drawobjectcommandUPP (drawobjectcommandDesc)
01241     #define editobjectcommandUPP (editobjectcommandDesc)
01242     #define keystrokecommandUPP (keystrokecommandDesc)
01243     #define idleobjectcommandUPP (idleobjectcommandDesc)
01244     #define clickobjectcommandUPP (clickobjectcommandDesc)
01245     #define cleanupobjectcommandUPP (cleanupobjectcommandDesc)
01246     #define recalcobjectcommandUPP (recalcobjectcommandDesc)
01247     #define canreplicateobjectcommandUPP (canreplicateobjectcommandDesc)
01248     #define catchreturncommandUPP (catchreturncommandDesc)
01249     #define getinvalrectcommandUPP (getinvalrectcommandDesc)
01250     #define geteditrectcommandUPP (geteditrectcommandDesc)
01251     #define getvaluecommandUPP (getvaluecommandDesc)
01252     #define setvaluecommandUPP (setvaluecommandDesc)
01253     #define setcursorcommandUPP (setcursorcommandDesc)
01254     #define unpackdatacommandUPP (unpackdatacommandDesc)
01255     #define disposedatacommandUPP (disposedatacommandDesc)
01256     #define getattributescommandUPP (getattributescommandDesc)
01257     #define setattributescommandUPP (setattributescommandDesc)
01258     #define geticoncommandUPP (geticoncommandDesc)
01259     #define getcardcommandUPP (getcardcommandDesc)
01260     #define packdatacommandUPP (packdatacommandDesc)
01261     #define debugobjectcommandUPP (debugobjectcommandDesc)*/
01262     #endif
01263     
01264 
01265 #endif
01266 
01267 #ifndef IOAinsideApp
01268 
01269     #if __powerc
01270     
01271     /*
01272         on the powerPC, our main entry point is a actually a routine descriptor, 
01273         pointing to our native main code. the global __procinfo is used by the 
01274         MWC startup code to build the descriptor.
01275     */
01276         ProcInfoType __procinfo = uppComponentRoutineProcInfo;
01277         
01278         void __sinit (void);
01279     
01280     #endif
01281     
01282     pascal ComponentResult main (ComponentParameters *params, Handle hstorage) {
01283 
01284 #else
01285 
01286     //Code change by Timothy Paustian Saturday, July 8, 2000 8:23:29 AM
01287     //I changed this to plain pascal instead of static. Will this shoot things?
01288 static  pascal ComponentResult IOAmain (ComponentParameters *params, Handle hstorage) {
01289 #pragma unused (hstorage)
01290 
01291 #endif
01292     
01293     ComponentResult result;
01294     
01295     #ifndef IOAinsideApp
01296     
01297         #if _powerc
01298         
01299             __sinit ();     /*initialize static data*/
01300         
01301         #endif
01302     
01303         EnterCodeResource ();
01304     
01305     #endif
01306     
01307     result = noErr;
01308     
01309     switch ((*params).what) {
01310         
01311         case kComponentOpenSelect:
01312             
01313             #if TARGET_API_MAC_CARBON
01314             {
01315             ComponentFunctionUPP IOAopenUPP = NewComponentFunctionUPP(IOAopen, IOAopenProcInfo);
01316             result = CallComponentFunction(params, IOAopenUPP);
01317             DisposeComponentFunctionUPP(IOAopenUPP);
01318             }
01319             #else
01320             result = CallComponentFunction(params, IOAopenUPP);
01321             #endif
01322             break;
01323             
01324         case kComponentCloseSelect:
01325             
01326             #if TARGET_API_MAC_CARBON
01327             {
01328             ComponentFunctionUPP IOAcloseUPP  = NewComponentFunctionUPP((ProcPtr) &IOAclose, IOAcloseProcInfo);
01329             result = CallComponentFunction(params, IOAcloseUPP);
01330             DisposeComponentFunctionUPP(IOAcloseUPP);
01331             }
01332             #else
01333             result = CallComponentFunction(params, IOAcloseUPP);
01334             #endif
01335             
01336             break;
01337             
01338         case kComponentCanDoSelect:
01339             
01340             #if TARGET_API_MAC_CARBON
01341             {
01342             ComponentFunctionUPP IOAcandoUPP  = NewComponentFunctionUPP((ProcPtr) &IOAcando, IOAcandoProcInfo);
01343             result = CallComponentFunction(params, IOAcandoUPP);
01344             DisposeComponentFunctionUPP(IOAcandoUPP);
01345             }
01346             #else
01347             result = CallComponentFunction(params, IOAcandoUPP);
01348             #endif
01349             break;
01350             
01351         case kComponentVersionSelect:
01352             
01353             #if TARGET_API_MAC_CARBON
01354             {
01355             ComponentFunctionUPP IOAversionUPP  = NewComponentFunctionUPP((ProcPtr) &IOAversion, IOAversionProcInfo);
01356             result = CallComponentFunction(params, IOAversionUPP);
01357             DisposeComponentFunctionUPP(IOAversionUPP);
01358             }
01359             #else
01360             result = CallComponentFunction(params, IOAversionUPP);
01361             #endif
01362             break;
01363             
01364         case IOAgetconfigcommand:
01365             
01366             #if TARGET_API_MAC_CARBON
01367             {
01368             ComponentFunctionUPP getconfigcommandUPP  = NewComponentFunctionUPP((ProcPtr) &getconfigcommand, getconfigcommandProcInfo);
01369             result = CallComponentFunction(params, getconfigcommandUPP);
01370             DisposeComponentFunctionUPP(getconfigcommandUPP);
01371             }
01372             #else
01373             result = CallComponentFunction(params, getconfigcommandUPP);
01374             #endif
01375             break;
01376             
01377         case IOAinitobjectcommand:
01378             
01379             #if TARGET_API_MAC_CARBON
01380             {
01381             ComponentFunctionUPP initobjectcommandUPP  = NewComponentFunctionUPP((ProcPtr) &initobjectcommand, initobjectcommandProcInfo);
01382             result = CallComponentFunction(params, initobjectcommandUPP);
01383             DisposeComponentFunctionUPP(initobjectcommandUPP);
01384             }
01385             #else
01386             result = CallComponentFunction(params, initobjectcommandUPP);
01387             #endif
01388             break;
01389             
01390         case IOAdrawobjectcommand:
01391             
01392             #if TARGET_API_MAC_CARBON
01393             {
01394             ComponentFunctionUPP drawobjectcommandUPP  = NewComponentFunctionUPP((ProcPtr) &drawobjectcommand, drawobjectcommandProcInfo);
01395             result = CallComponentFunction(params, drawobjectcommandUPP);
01396             DisposeComponentFunctionUPP(drawobjectcommandUPP);
01397             }
01398             #else
01399             result = CallComponentFunction(params, drawobjectcommandUPP);
01400             #endif
01401             break;
01402             
01403         case IOAeditobjectcommand:
01404             
01405             #if TARGET_API_MAC_CARBON
01406             {
01407             ComponentFunctionUPP editobjectcommandUPP  = NewComponentFunctionUPP((ProcPtr) &editobjectcommand, editobjectcommandProcInfo);
01408             result = CallComponentFunction(params, editobjectcommandUPP);
01409             DisposeComponentFunctionUPP(editobjectcommandUPP);
01410             }
01411             #else
01412             result = CallComponentFunction(params, editobjectcommandUPP);
01413             #endif
01414             break;
01415             
01416         case IOAkeystrokecommand:
01417             
01418             #if TARGET_API_MAC_CARBON
01419             {
01420             ComponentFunctionUPP keystrokecommandUPP  = NewComponentFunctionUPP((ProcPtr) &keystrokecommand, keystrokecommandProcInfo);
01421             result = CallComponentFunction(params, keystrokecommandUPP);
01422             DisposeComponentFunctionUPP(keystrokecommandUPP);
01423             }
01424             #else
01425             result = CallComponentFunction(params, keystrokecommandUPP);
01426             #endif
01427             break;
01428             
01429         case IOAidlecommand:
01430         
01431             #if TARGET_API_MAC_CARBON
01432             {
01433             ComponentFunctionUPP idleobjectcommandUPP  = NewComponentFunctionUPP((ProcPtr) &idleobjectcommand, idleobjectcommandProcInfo);
01434             result = CallComponentFunction(params, idleobjectcommandUPP);
01435             DisposeComponentFunctionUPP(idleobjectcommandUPP);
01436             }
01437             #else
01438             result = CallComponentFunction(params, idleobjectcommandUPP);
01439             #endif
01440             break;
01441             
01442         case IOAclickcommand:
01443             #if TARGET_API_MAC_CARBON
01444             {
01445             ComponentFunctionUPP clickobjectcommandUPP  = NewComponentFunctionUPP((ProcPtr) &clickobjectcommand, clickobjectcommandProcInfo);
01446             result = CallComponentFunction(params, clickobjectcommandUPP);
01447             DisposeComponentFunctionUPP(clickobjectcommandUPP);
01448             }
01449             #else
01450             result = CallComponentFunction(params, clickobjectcommandUPP);
01451             #endif
01452             break;
01453             
01454         case IOAcleanupcommand:
01455             #if TARGET_API_MAC_CARBON
01456             {
01457             ComponentFunctionUPP cleanupobjectcommandUPP  = NewComponentFunctionUPP((ProcPtr) &cleanupobjectcommand, cleanupobjectcommandProcInfo);
01458             result = CallComponentFunction(params, cleanupobjectcommandUPP);
01459             DisposeComponentFunctionUPP(cleanupobjectcommandUPP);
01460             }
01461             #else
01462             result = CallComponentFunction(params, cleanupobjectcommandUPP);
01463             #endif
01464             break;
01465             
01466         case IOArecalccommand:
01467             #if TARGET_API_MAC_CARBON
01468             {
01469             ComponentFunctionUPP recalcobjectcommandUPP  = NewComponentFunctionUPP((ProcPtr) &recalcobjectcommand, recalcobjectcommandProcInfo);
01470             result = CallComponentFunction(params, recalcobjectcommandUPP);
01471             DisposeComponentFunctionUPP(recalcobjectcommandUPP);
01472             }
01473             #else
01474             result = CallComponentFunction(params, recalcobjectcommandUPP);
01475             #endif
01476             break;
01477             
01478         case IOAcanreplicatcommand:
01479             #if TARGET_API_MAC_CARBON
01480             {
01481             ComponentFunctionUPP canreplicateobjectcommandUPP  = NewComponentFunctionUPP((ProcPtr) &canreplicateobjectcommand, canreplicateobjectcommandProcInfo);
01482             result = CallComponentFunction(params, canreplicateobjectcommandUPP);
01483             DisposeComponentFunctionUPP(canreplicateobjectcommandUPP);
01484             }
01485             #else
01486             result = CallComponentFunction(params, canreplicateobjectcommandUPP);
01487             #endif
01488             break;
01489             
01490         case IOAcatchreturncommand:
01491             #if TARGET_API_MAC_CARBON
01492             {
01493             ComponentFunctionUPP catchreturncommandUPP  = NewComponentFunctionUPP((ProcPtr) &catchreturncommand, catchreturncommandProcInfo);
01494             result = CallComponentFunction(params, catchreturncommandUPP);
01495             DisposeComponentFunctionUPP(catchreturncommandUPP);
01496             }
01497             #else
01498             result = CallComponentFunction(params, catchreturncommandUPP);
01499             #endif
01500             break;
01501             
01502         case IOAgetobjectinvalrectcommand:
01503             #if TARGET_API_MAC_CARBON
01504             {
01505             ComponentFunctionUPP getinvalrectcommandUPP  = NewComponentFunctionUPP((ProcPtr) &getinvalrectcommand, getinvalrectcommandProcInfo);
01506             result = CallComponentFunction(params, getinvalrectcommandUPP);
01507             DisposeComponentFunctionUPP(getinvalrectcommandUPP);
01508             }
01509             #else
01510             result = CallComponentFunction(params, getinvalrectcommandUPP);
01511             #endif
01512             break;
01513             
01514         case IOAgetobjecteditrectcommand:
01515             #if TARGET_API_MAC_CARBON
01516             {
01517             ComponentFunctionUPP geteditrectcommandUPP  = NewComponentFunctionUPP((ProcPtr) &geteditrectcommand, geteditrectcommandProcInfo);
01518             result = CallComponentFunction(params, geteditrectcommandUPP);
01519             DisposeComponentFunctionUPP(geteditrectcommandUPP);
01520             }
01521             #else
01522             result = CallComponentFunction(params, geteditrectcommandUPP);
01523             #endif
01524             break;
01525             
01526         case IOAgetvaluecommand:
01527             #if TARGET_API_MAC_CARBON
01528             {
01529             ComponentFunctionUPP getvaluecommandUPP  = NewComponentFunctionUPP((ProcPtr) &getvaluecommand, getvaluecommandProcInfo);
01530             result = CallComponentFunction(params, getvaluecommandUPP);
01531             DisposeComponentFunctionUPP(getvaluecommandUPP);
01532             }
01533             #else
01534             result = CallComponentFunction(params, getvaluecommandUPP);
01535             #endif
01536             break;
01537             
01538         case IOAsetvaluecommand:
01539             #if TARGET_API_MAC_CARBON
01540             {
01541             ComponentFunctionUPP setvaluecommandUPP  = NewComponentFunctionUPP((ProcPtr) &setvaluecommand, setvaluecommandProcInfo);
01542             result = CallComponentFunction(params, setvaluecommandUPP);
01543             DisposeComponentFunctionUPP(setvaluecommandUPP);
01544             }
01545             #else
01546             result = CallComponentFunction(params, setvaluecommandUPP);
01547             #endif
01548             break;
01549             
01550         case IOAsetcursorcommand:
01551             #if TARGET_API_MAC_CARBON
01552             {
01553             ComponentFunctionUPP setcursorcommandUPP  = NewComponentFunctionUPP((ProcPtr) &setcursorcommand, setcursorcommandProcInfo);
01554             result = CallComponentFunction(params, setcursorcommandUPP);
01555             DisposeComponentFunctionUPP(setcursorcommandUPP);
01556             }
01557             #else
01558             result = CallComponentFunction(params, setcursorcommandUPP);
01559             #endif
01560             break;
01561             
01562         case IOAunpackdatacommand:
01563             #if TARGET_API_MAC_CARBON
01564             {
01565             ComponentFunctionUPP unpackdatacommandUPP  = NewComponentFunctionUPP((ProcPtr) &unpackdatacommand, unpackdatacommandProcInfo);
01566             result = CallComponentFunction(params, unpackdatacommandUPP);
01567             DisposeComponentFunctionUPP(unpackdatacommandUPP);
01568             }
01569             #else
01570             result = CallComponentFunction(params, unpackdatacommandUPP);
01571             #endif
01572             break;
01573             
01574         case IOAdebugobjectcommand:
01575             #if TARGET_API_MAC_CARBON
01576             {
01577             ComponentFunctionUPP debugobjectcommandUPP  = NewComponentFunctionUPP((ProcPtr) &debugobjectcommand, debugobjectcommandProcInfo);
01578             result = CallComponentFunction(params, debugobjectcommandUPP);
01579             DisposeComponentFunctionUPP(debugobjectcommandUPP);
01580             }
01581             #else
01582             result = CallComponentFunction(params, debugobjectcommandUPP);
01583             #endif
01584             break;
01585             
01586         case IOAgetattributescommand:
01587             #if TARGET_API_MAC_CARBON
01588             {
01589             ComponentFunctionUPP getattributescommandUPP  = NewComponentFunctionUPP((ProcPtr) &getattributescommand, getattributescommandProcInfo);
01590             result = CallComponentFunction(params, getattributescommandUPP);
01591             DisposeComponentFunctionUPP(getattributescommandUPP);
01592             }
01593             #else
01594             result = CallComponentFunction(params, getattributescommandUPP);
01595             #endif
01596             break;
01597             
01598         case IOAsetattributescommand:
01599             #if TARGET_API_MAC_CARBON
01600             {
01601             ComponentFunctionUPP setattributescommandUPP  = NewComponentFunctionUPP((ProcPtr) &setattributescommand, setattributescommandProcInfo);
01602             result = CallComponentFunction(params, setattributescommandUPP);
01603             DisposeComponentFunctionUPP(setattributescommandUPP);
01604             }
01605             #else
01606             result = CallComponentFunction(params, setattributescommandUPP);
01607             #endif
01608             break;
01609             
01610         case IOAgeticoncommand:
01611             #if TARGET_API_MAC_CARBON
01612             {
01613             ComponentFunctionUPP geticoncommandUPP  = NewComponentFunctionUPP((ProcPtr) &geticoncommand, geticoncommandProcInfo);
01614             result = CallComponentFunction(params, geticoncommandUPP);
01615             DisposeComponentFunctionUPP(geticoncommandUPP);
01616             }
01617             #else
01618             result = CallComponentFunction(params, geticoncommandUPP);
01619             #endif
01620             break;
01621             
01622         case IOAgetcardcommand:
01623             #if TARGET_API_MAC_CARBON
01624             {
01625             ComponentFunctionUPP getcardcommandUPP  = NewComponentFunctionUPP((ProcPtr) &getcardcommand, getcardcommandProcInfo);
01626             result = CallComponentFunction(params, getcardcommandUPP);
01627             DisposeComponentFunctionUPP(getcardcommandUPP);
01628             }
01629             #else
01630             result = CallComponentFunction(params, getcardcommandUPP);
01631             #endif
01632             break;
01633             
01634         case IOApackdatacommand:
01635             #if TARGET_API_MAC_CARBON
01636             {
01637             ComponentFunctionUPP packdatacommandUPP  = NewComponentFunctionUPP((ProcPtr) &packdatacommand, packdatacommandProcInfo);
01638             result = CallComponentFunction(params, packdatacommandUPP);
01639             DisposeComponentFunctionUPP(packdatacommandUPP);
01640             }
01641             #else
01642             result = CallComponentFunction(params, packdatacommandUPP);
01643             #endif
01644             break;
01645             
01646         case IOAdisposedatacommand:
01647             #if TARGET_API_MAC_CARBON
01648             {
01649             ComponentFunctionUPP disposedatacommandUPP  = NewComponentFunctionUPP((ProcPtr) &disposedatacommand, disposedatacommandProcInfo);
01650             result = CallComponentFunction(params, disposedatacommandUPP);
01651             DisposeComponentFunctionUPP(disposedatacommandUPP);
01652             }
01653             #else
01654             result = CallComponentFunction(params, disposedatacommandUPP);
01655             #endif
01656             break;
01657             
01658         default:
01659             result = paramErr;          
01660             break;
01661         } /*switch*/
01662         
01663     #ifndef IOAinsideApp
01664 
01665         ExitCodeResource ();
01666         
01667     #endif
01668         
01669     return (result);
01670     } /*IOAmain*/
01671     
01672     
01673 #ifdef IOAinsideApp
01674 
01675     boolean IOAregistercomponents (void); /*prototype*/
01676 
01677     void IOAunregistercomponents (void); /*prototype*/
01678     
01679     void setupbutton (tyioaconfigrecord *); /*prototype*/
01680         
01681     void setupcolorpopup (tyioaconfigrecord *); /*prototype*/
01682         
01683     void setupcheckbox (tyioaconfigrecord *); /*prototype*/
01684         
01685     void setupedittext (tyioaconfigrecord *); /*prototype*/
01686         
01687     void setupframe (tyioaconfigrecord *); /*prototype*/
01688         
01689     void setupicon (tyioaconfigrecord *); /*prototype*/
01690         
01691     void setuppicture (tyioaconfigrecord *); /*prototype*/
01692         
01693     void setuppopup (tyioaconfigrecord *); /*prototype*/
01694         
01695     void setupradio (tyioaconfigrecord *); /*prototype*/
01696         
01697     void setuprect (tyioaconfigrecord *); /*prototype*/
01698         
01699     void setupstatic (tyioaconfigrecord *); /*prototype*/
01700         
01701     void setupscrollbar (tyioaconfigrecord *); /*prototype*/
01702     
01703     #define ioacount 13
01704         
01705     static tyioaconfigrecord configarray [ioacount];
01706     
01707     static Component componentarray [ioacount];
01708     
01709     
01710     
01711     static pascal ComponentResult buttonmain (ComponentParameters *params, Handle hstorage) {
01712         
01713         config = configarray [1];
01714         
01715         return (IOAmain (params, hstorage));
01716         } /*buttonmain*/
01717         
01718     
01719     static pascal ComponentResult colorpopupmain (ComponentParameters *params, Handle hstorage) {
01720         
01721         config = configarray [2];
01722         
01723         return (IOAmain (params, hstorage));
01724         } /*colorpopupmain*/
01725         
01726     
01727     static pascal ComponentResult checkboxmain (ComponentParameters *params, Handle hstorage) {
01728         
01729         config = configarray [3];
01730         
01731         return (IOAmain (params, hstorage));
01732         } /*checkboxmain*/
01733         
01734     
01735     static pascal ComponentResult edittextmain (ComponentParameters *params, Handle hstorage) {
01736         
01737         config = configarray [4];
01738         
01739         return (IOAmain (params, hstorage));
01740         } /*edittextmain*/
01741         
01742     
01743     static pascal ComponentResult framemain (ComponentParameters *params, Handle hstorage) {
01744         
01745         config = configarray [5];
01746         
01747         return (IOAmain (params, hstorage));
01748         } /*framemain*/
01749         
01750     
01751     static pascal ComponentResult iconmain (ComponentParameters *params, Handle hstorage) {
01752         
01753         config = configarray [6];
01754         
01755         return (IOAmain (params, hstorage));
01756         } /*iconmain*/
01757         
01758     
01759     static pascal ComponentResult picturemain (ComponentParameters *params, Handle hstorage) {
01760         
01761         config = configarray [7];
01762         
01763         return (IOAmain (params, hstorage));
01764         } /*picturemain*/
01765         
01766     
01767     static pascal ComponentResult popupmain (ComponentParameters *params, Handle hstorage) {
01768         
01769         config = configarray [8];
01770         
01771         return (IOAmain (params, hstorage));
01772         } /*popupmain*/
01773         
01774     
01775     static pascal ComponentResult radiomain (ComponentParameters *params, Handle hstorage) {
01776         
01777         config = configarray [9];
01778         
01779         return (IOAmain (params, hstorage));
01780         } /*radiomain*/
01781         
01782     
01783     static pascal ComponentResult rectmain (ComponentParameters *params, Handle hstorage) {
01784         
01785         config = configarray [10];
01786         
01787         return (IOAmain (params, hstorage));
01788         } /*rectmain*/
01789         
01790     
01791     static pascal ComponentResult staticmain (ComponentParameters *params, Handle hstorage) {
01792         
01793         config = configarray [11];
01794         
01795         return (IOAmain (params, hstorage));
01796         } /*staticmain*/
01797         
01798     
01799     static pascal ComponentResult scrollbarmain (ComponentParameters *params, Handle hstorage) {
01800         
01801         config = configarray [12];
01802         
01803         return (IOAmain (params, hstorage));
01804         } /*scrollbarmain*/
01805         
01806     
01807     static boolean IOAregister (short ixarray, OSType subtype, ComponentRoutine main, setupcallback pcallback) {
01808         
01809         ComponentDescription desc;
01810         Component comp;
01811         ComponentRoutineUPP routinePtr;
01812         
01813         callsetuproutine (pcallback, &configarray [ixarray]);
01814         
01815         IOAclearbytes (&desc, longsizeof (desc));
01816         
01817         desc.componentType = 'IOAb';
01818         
01819         desc.componentSubType = subtype;
01820         
01821         desc.componentManufacturer = 'LAND';
01822         //Code change by Timothy Paustian Saturday, July 8, 2000 9:42:17 PM
01823         //Just doing some testing. Split this out so I could look at it.
01824         
01825         #if TARGET_API_MAC_CARBON == 1
01826         
01827             routinePtr = NewComponentRoutineUPP (main);
01828         
01829         #else
01830 
01831             routinePtr = NewComponentRoutineProc (main);
01832                 
01833         #endif
01834         
01835         comp = RegisterComponent (&desc, routinePtr, false, nil, nil, nil);
01836         
01837         componentarray [ixarray] = comp;
01838             
01839         return (comp != 0);
01840         } /*IOAregister*/
01841     
01842 
01843     boolean IOAregistercomponents (void) {
01844     
01845         IOAregister (1, 'bttn', &buttonmain, &setupbutton);
01846         
01847         IOAregister (2, 'cpop', &colorpopupmain, &setupcolorpopup);
01848         
01849         IOAregister (3, 'ckbx', &checkboxmain, &setupcheckbox);
01850         
01851         IOAregister (4, 'edtx', &edittextmain, &setupedittext);
01852         
01853         IOAregister (5, 'fram', &framemain, &setupframe);
01854         
01855         IOAregister (6, 'icon', &iconmain, &setupicon);
01856         
01857         IOAregister (7, 'pict', &picturemain, &setuppicture);
01858         
01859         IOAregister (8, 'popu', &popupmain, &setuppopup);
01860         
01861         IOAregister (9, 'rdio', &radiomain, &setupradio);
01862         
01863         IOAregister (10, 'rect', &rectmain, &setuprect);
01864         
01865         IOAregister (11, 'text', &staticmain, &setupstatic);
01866         
01867         IOAregister (12, 'scro', &scrollbarmain, &setupscrollbar);
01868 
01869         return (true);
01870         } /*IOAregistercomponents*/
01871         
01872 
01873     void IOAunregistercomponents (void) {
01874         
01875         short i;
01876         
01877         for (i = 1; i <= ioacount; i++)
01878             UnregisterComponent (componentarray [i]);
01879         
01880         } /*IOAunregistercomponents*/
01881 
01882 #endif

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