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); } } }
STATIC ULONG transwnd_New(struct IClass *cl, Object *obj, struct opSet *msg) { Object *gauge1,/* *gauge2,*/*status,*abort,*mail_listview, *mail_list, *mail_group, *start, *ignore, *down, *del, *downdel, *ignore_check,*all,*none, *skip; Object *head; obj = (Object *) DoSuperNew(cl, obj, WindowContents, VGroup, Child, head = TextObject,End, Child, RectangleObject, MUIA_Weight, 1, End, Child, mail_group = VGroup, MUIA_ShowMe, FALSE, Child, mail_listview = NListviewObject, MUIA_NListview_NList, mail_list = NListObject, MUIA_NList_Title, TRUE, MUIA_NList_Format, "P=\033r,,,", End, End, Child, HGroup, Child, ignore = MakeButton(_("Ignore")), Child, down = MakeButton(_("Download")), Child, del = MakeButton(_("Delete")), Child, downdel = MakeButton(_("Download & Delete")), Child, start = MakeButton(_("_Start")), End, Child, HGroup, Child, all = MakeButton(_("Select All")), Child, none = MakeButton(_("Select None")), Child, MakeLabel(_("Ignore not listed mails")), Child, ignore_check = MakeCheck(_("Ignore not listed mails"),FALSE), Child, HVSpace, End, End, Child, gauge1 = GaugeObject, GaugeFrame, MUIA_Gauge_InfoText, _("Waiting..."), MUIA_Gauge_Horiz, TRUE, End, /* Child, gauge2 = GaugeObject, GaugeFrame, MUIA_Gauge_InfoText, _("Waiting..."), MUIA_Gauge_Horiz, TRUE, End,*/ Child, HGroup, Child, status = TextObject, TextFrame, MUIA_Text_Contents, "", MUIA_Background, MUII_TextBack, End, Child, skip = MakeButton(_("_Skip")), Child, abort = MakeButton(_("_Abort")), End, End, TAG_MORE, msg->ops_AttrList); if (obj != NULL) { struct transwnd_Data *data = (struct transwnd_Data *) INST_DATA(cl, obj); data->gauge1 = gauge1; /* data->gauge2 = gauge2; */ data->status = status; data->abort = abort; data->skip = skip; data->head = head; data->mail_listview = mail_listview; data->mail_list = mail_list; data->mail_group = mail_group; data->start = start; data->ignore_check = ignore_check; data->status_download = PictureButtonObject, MUIA_PictureButton_Directory, gui_get_images_directory(), MUIA_PictureButton_Filename, "status_download", End; data->status_trashcan = PictureButtonObject, MUIA_PictureButton_Directory, gui_get_images_directory(), MUIA_PictureButton_Filename, "status_trashcan", End; init_hook_with_data(&data->construct_hook, (HOOKFUNC)mail_construct, data); init_hook_with_data(&data->destruct_hook, (HOOKFUNC)mail_destruct, data); init_hook_with_data(&data->display_hook, (HOOKFUNC)mail_display, data); SetAttrs(mail_list, MUIA_NList_ConstructHook, &data->construct_hook, MUIA_NList_DestructHook, &data->destruct_hook, MUIA_NList_DisplayHook, &data->display_hook, MUIA_NList_MultiSelect, MUIV_NList_MultiSelect_Default, TAG_DONE); set(skip, MUIA_Weight, 0); set(abort, MUIA_Weight, 0); DoMethod(abort, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)obj, 3, MUIM_Set, MUIA_transwnd_Aborted, TRUE); DoMethod(skip, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)obj, 3, MUIM_Set, MUIA_transwnd_Skipped, TRUE); DoMethod(start, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)App, 3, MUIM_WriteLong, (1<<0), (ULONG)&data->start_pressed); DoMethod(obj, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, (ULONG)obj, 3, MUIM_Set, MUIA_transwnd_Aborted, TRUE); DoMethod(ignore, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)App, 5, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)transwnd_set_mail_flags, (ULONG)data, 0); DoMethod(down, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)App, 5, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)transwnd_set_mail_flags, (ULONG)data, MAILF_DOWNLOAD); DoMethod(del, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)App, 5, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)transwnd_set_mail_flags, (ULONG)data, MAILF_DELETE); DoMethod(downdel, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)App, 5, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)transwnd_set_mail_flags, (ULONG)data, MAILF_DOWNLOAD|MAILF_DELETE); DoMethod(all,MUIM_Notify,MUIA_Pressed, FALSE, (ULONG)mail_list, 4, MUIM_NList_Select, MUIV_NList_Select_All, MUIV_NList_Select_On, NULL); DoMethod(none,MUIM_Notify,MUIA_Pressed, FALSE, (ULONG)mail_list, 4, MUIM_NList_Select, MUIV_NList_Select_All, MUIV_NList_Select_Off, NULL); } return((ULONG) obj); }