void shutdownwnd_open(void) { if ((scr = LockPubScreen(NULL))) { char *filename; /* get a white pen for the color of our text */ pen = ObtainBestPenA(scr->ViewPort.ColorMap,0xffffffff,0xffffffff,0xffffffff,NULL); if ((filename = mycombinepath(gui_get_images_directory(),"shutdown"))) { if ((obj = LoadAndMapPicture("PROGDIR:Images/shutdown",scr))) { struct BitMapHeader *bmhd = NULL; struct BitMap *bitmap = NULL; GetDTAttrs(obj,PDTA_BitMapHeader,&bmhd,TAG_DONE); GetDTAttrs(obj,PDTA_DestBitMap,&bitmap,TAG_DONE); if (!bitmap) GetDTAttrs(obj,PDTA_BitMap,&bitmap,TAG_DONE); if (bmhd && bitmap) { int width = bmhd->bmh_Width; int height = bmhd->bmh_Height; int wndleft,wndtop; wndleft = (scr->Width - width)/2; wndtop = (scr->Height - height)/2; if ((shutdown_wnd = OpenWindowTags(NULL, WA_SmartRefresh, TRUE, WA_NoCareRefresh, TRUE, WA_Borderless, TRUE, WA_Width, width, WA_Height, height, WA_PubScreen, scr, WA_Left, wndleft, WA_Top, wndtop, WA_BackFill, LAYERS_NOBACKFILL, TAG_DONE))) { BltBitMapRastPort(bitmap,0,0, shutdown_wnd->RPort, 0, 0, width, height, 0xc0); if (!user.config.dont_show_shutdown_text) { struct TextExtent te; const char *txt = _("Shutting down..."); SetDrMd(shutdown_wnd->RPort,JAM1); SetAPen(shutdown_wnd->RPort,pen); TextExtent(shutdown_wnd->RPort,txt,strlen(txt),&te); if ((te.te_Width < width) && (te.te_Height < height)) { /* only draw the text if there is enought space for it */ Move(shutdown_wnd->RPort,(width - te.te_Width)/2, height - te.te_Height - 4 + shutdown_wnd->RPort->TxBaseline); Text(shutdown_wnd->RPort,txt,strlen(txt)); } } } } } free(filename); } } }
LONG ObtainBestPen( struct ColorMap *cm, ULONG r, ULONG g, ULONG b, Tag tag1Type, ... ) { return ObtainBestPenA(cm, r, g, b, (CONST struct TagItem *)&tag1Type); }