home *** CD-ROM | disk | FTP | other *** search
- static void show_alert(void);
-
- void main(void)
- {
- #if __option(a4_globals)
- asm { ; Segment loader info
- dc.w 0 ; This CODE resource's offset in the jump table
- dc.w 1 ; Number of entries this CODE resource has in the jump table
- jsr @1 ; push known address onto the stack
- @1 move.l (sp)+, a4 ; pop it into a4
- lea -8(a4), a4 ; adjust it back to base address of code segment
- MaxApplZone
- pea -4(a5)
- InitGraf
- }
- #else
- MaxApplZone();
- InitGraf(&qd.thePort);
- #endif
-
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(NULL);
- InitCursor();
- FlushEvents(everyEvent,0);
- ParamText(LMGetCurApName(), NULL, NULL, NULL);
- show_alert();
- }
-
- static pascal void OutlineOK(DialogPtr dlg, short item)
- {
- short di_type;
- Handle di_handle;
- Rect di_box;
- PenSize(3,3);
- GetDItem(dlg, 1, &di_type, &di_handle, &di_box);
- InsetRect(&di_box,-4,-4);
- FrameRoundRect(&di_box,16,16);
- PenNormal();
- }
-
- static void set_OutlineOK(DialogPtr d, short item)
- {
- short di_type;
- Handle di_handle;
- Rect di_box;
- GetDItem(d, item, &di_type, &di_handle, &di_box);
- SetDItem(d, item, di_type, (Handle)OutlineOK, &di_box);
- }
-
- typedef struct
- {
- short count;
- short item1_unknown1;
- short item1_unknown2;
- Rect item1_DisplayRect;
- char item1_type;
- char item1_info[0x03]; // "OK" text
- short item2_unknown1;
- short item2_unknown2;
- Rect item2_DisplayRect;
- char item2_type;
- char item2_info[0x01]; // No data
- short item3_unknown1;
- short item3_unknown2;
- Rect item3_DisplayRect;
- char item3_type;
- char item3_info[0x03]; // Icon Resource ID (zero)
- short item4_unknown1;
- short item4_unknown2;
- Rect item4_DisplayRect;
- char item4_type;
- char item4_info[0xFF]; // Message Text (length must be odd for proper alignment!)
- } DITL;
-
- static const Rect wRect = { 0, 0, 100, 420 };
- static const DITL theDITL =
- {
- 3,
- 0, 0, { 70, 16, 90, 76 }, 0x04, "\pOK",
- 0, 0, { 40, 0, 50, 10 }, 0x80, "\p",
- 0, 0, { 20, 30, 52, 62 }, 0xA0, "\p\0\0",
- 0, 0, { 10, 100, 90, 400 }, 0x88,
- "\p^0 can only run on a Macintosh computer that has a PowerPC processor."
- " This Macintosh computer has a 680x0 series processor, which cannot run"
- " native PowerPC applications."
- };
-
- static void show_alert(void)
- {
- DialogRecord dStorage;
- DialogPtr theDialog;
- short itemHit;
- BitMap *winbm;
- short xmove, ymove;
- Handle theDITLhand = NewHandle(sizeof(theDITL));
- BlockMoveData(&theDITL, *theDITLhand, sizeof(theDITL));
- theDialog = NewDialog(&dStorage, &wRect, NULL, FALSE,
- dBoxProc, (WindowPtr)(-1), FALSE, 0, theDITLhand);
- winbm = &theDialog->portBits;
- if (winbm->rowBytes & 0x8000) winbm = *((BitMapHandle)(winbm->baseAddr));
- xmove = (winbm->bounds.right - winbm->bounds.left - wRect.right ) / 2;
- ymove = (winbm->bounds.bottom - winbm->bounds.top - wRect.bottom) / 4;
- MoveWindow(theDialog, xmove, ymove, TRUE);
- set_OutlineOK(theDialog, 2);
- ShowWindow(theDialog);
- ModalDialog(NULL, &itemHit);
- CloseDialog(theDialog);
- }
-