home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************/
- /* misc.c --- Contains some intuition related functions that had to */
- /* be compiled separately due to faster debugging. */
- /************************************************************************/
-
- #include <exec/types.h>
- #include <exec/alerts.h>
- #include <intuition/intuitionbase.h>
- #include <intuition/intuition.h>
- #include <proto/intuition.h>
- #include <string.h>
-
- extern struct IntuitionBase *IntuitionBase;
-
- /* -------------------------------------------------------------------- */
- /* Make an Gadget "active", selected by window - ptr and Gadget ID. */
- /* Used to make the cursor appear in the next String Gadget for */
- /* convenience of the user. */
- /* -------------------------------------------------------------------- */
-
- void __regargs Activate_Gadget(struct Window *w, USHORT ID)
- {
- struct Gadget *g;
-
- g = w->FirstGadget;
- while ( g && g->GadgetID != ID ) { g = g->NextGadget; }
- if ( g ) { ActivateGadget(g, w, NULL); }
- }
-
- /* -------------------------------------------------------------------- */
- /* Show a warning message by using a recoverable alert. Text is */
- /* selected by an offset to message array below. */
- /* -------------------------------------------------------------------- */
-
- char *Apfel_Text[] = {
- " Everything OK\0",
- " Can't open intuition.library -- aborting\0",
- " Can't open graphics.library -- aborting\0",
- " Can't open iff.library V18.5+ -- aborting\0",
- " Can't open asl.library -- aborting\0",
- " Can't open color.library V1.0+ -- aborting\0",
- " No memory for filerequester -- aborting\0",
- " Can't open printer port -- aborting\0",
- " Can't open IORequest for printer -- aborting\0",
- " Can't open window -- trying to recover\0",
- " Can't open screen -- trying to recover\0",
- " Can't find configuration file --- using build in defaults\0",
- " IFF file not found -- Load aborted\0",
- " Not an IFF/ILBM file -- Load aborted\0",
- " Scrambled IFF file -- Load aborted\0",
- " Can't open gadtools.library -- aborting\0"
- };
-
- void __regargs Apfel_Alert(long num)
- {
- short x;
-
- x = IntuitionBase->ActiveScreen->Width;
- if ( x > 740 ) x /= 2;
- x = ( x - strlen(Apfel_Text[num]+3) * 8 ) / 2;
- Apfel_Text[num][0] = x >> 8;
- Apfel_Text[num][1] = x & 0xFF;
- Apfel_Text[num][2] = 14;
-
- DisplayAlert(RECOVERY_ALERT, Apfel_Text[num], 23);
- }
-