Object *CreateGUI(struct IClass *cl, Object *obj, struct ObjStore *os, struct DnetcLibrary *LibBase) { UBYTE about[512]; ULONG array[] = { (ULONG) LibBase->Version, LibBase->Library.lib_Version, LibBase->Library.lib_Revision }; //#define SysBase LibBase->MySysBase RawDoFmt( "\33cdistributed.net client - a product of distributed.net\n" "%s\n" "Copyright 1997-2011 distributed.net\n" "\n" "\n" "MorphOS client maintained by\n" "Harry Sintonen\n" "<*****@*****.**>\n" "\n" "\n" "MUI GUI module (v%ld.%ld) maintained by\n" "Ilkka Lehtoranta\n" "<*****@*****.**>", array, NULL, about); //#undef SysBase return (Object*)DoSuperNew(cl, obj, MUIA_Application_DiskObject, (IPTR)LibBase->dobj, MUIA_Application_Commands, (IPTR)commands, MUIA_Application_Version, (IPTR)&VerString[1], MUIA_Application_Copyright, (IPTR)"distributed.net", MUIA_Application_Author, (IPTR)"Ilkka Lehtoranta", MUIA_Application_Base, (IPTR)"DNETC", MUIA_Application_UsedClasses, (IPTR)ClassList, MUIA_Application_Title, (IPTR)"dnetc", MUIA_Application_Description, (IPTR)"GUI for distributed.net client", MUIA_Application_Window, (IPTR)(os->wnd = MUI_NewObject(MUIC_Window, MUIA_Window_Title, (IPTR)"distributed.net client", MUIA_Window_ID, MAKE_ID('M','A','I','N'), MUIA_Window_Width, MUIV_Window_Width_Visible(55), MUIA_Window_Height, MUIV_Window_Height_Visible(45), MUIA_Window_Menustrip, (IPTR)MUI_MakeObject(MUIO_MenustripNM, (IPTR)&Menus, 0), MUIA_Window_RootObject, (IPTR)MUI_NewObject(MUIC_Group, MUIA_Group_Child, (IPTR)(os->lst = NewObject(LibBase->ListMCC->mcc_Class, NULL, MUIA_Background, MUII_ReadListBack, MUIA_Frame, MUIV_Frame_ReadList, MUIA_CycleChain, TRUE, TAG_END)), TAG_END), TAG_END)), MUIA_Application_Window, (IPTR)(os->req = MUI_NewObject(MUIC_Aboutbox, MUIA_Aboutbox_Credits, (IPTR)about, TAG_END)), TAG_END); }
/*** Methods ****************************************************************/ Object *AboutWindow__OM_NEW ( Class *CLASS, Object *self, struct opSet *message ) { struct AboutWindow_DATA *data = NULL; const struct TagItem *tstate = message->ops_AttrList; struct TagItem *tag = NULL, *authorsTags = NULL, *sponsorsTags = NULL; struct Catalog *catalog = NULL; APTR pool; Object *rootGroup = NULL, *imageGroup = NULL, *imageObject = NULL, *versionObject = NULL, *copyrightObject = NULL, *descriptionGroup = NULL, *descriptionObject = NULL, *authorsList = NULL, *sponsorsList = NULL; STRPTR title = NULL, versionNumber = NULL, versionDate = NULL, versionExtra = NULL, description = NULL, copyright = NULL; CONST_STRPTR pages[] = { NULL, NULL, NULL }; UBYTE nextPage = 0; /* Allocate memory pool ------------------------------------------------*/ pool = CreatePool(MEMF_ANY, 4096, 4096); if (pool == NULL) return NULL; /* Initialize locale ---------------------------------------------------*/ catalog = OpenCatalogA ( NULL, "System/Classes/Zune/AboutWindow.catalog", NULL ); /* Parse initial attributes --------------------------------------------*/ while ((tag = NextTagItem(&tstate)) != NULL) { switch (tag->ti_Tag) { case MUIA_AboutWindow_Image: imageObject = (Object *) tag->ti_Data; break; case MUIA_AboutWindow_Title: title = StrDup((STRPTR) tag->ti_Data); if (title == NULL) title = IGNORE; break; case MUIA_AboutWindow_Version_Number: versionNumber = StrDup((STRPTR) tag->ti_Data); if (versionNumber == NULL) versionNumber = IGNORE; break; case MUIA_AboutWindow_Version_Date: versionDate = StrDup((STRPTR) tag->ti_Data); if (versionDate == NULL) versionDate = IGNORE; break; case MUIA_AboutWindow_Version_Extra: versionExtra = StrDup((STRPTR) tag->ti_Data); if (versionExtra == NULL) versionExtra = IGNORE; break; case MUIA_AboutWindow_Copyright: copyright = StrDup((STRPTR) tag->ti_Data); if (copyright == NULL) copyright = IGNORE; break; case MUIA_AboutWindow_Description: description = StrDup((STRPTR) tag->ti_Data); if (description == NULL) description = IGNORE; break; case MUIA_AboutWindow_Authors: authorsTags = (struct TagItem *) tag->ti_Data; break; case MUIA_AboutWindow_Sponsors: sponsorsTags = (struct TagItem *) tag->ti_Data; break; default: continue; /* Don't supress non-processed tags */ } tag->ti_Tag = TAG_IGNORE; } /* Setup image ---------------------------------------------------------*/ if (imageObject == NULL) { TEXT path[512], program[1024]; path[0] = '\0'; program[0] = '\0'; if (GetProgramName(program, 1024)) { strlcat(path, "PROGDIR:", 512); strlcat(path, FilePart(program), 512); imageObject = (Object *)IconImageObject, MUIA_IconImage_File, (IPTR) path, End; } if (imageObject == NULL) { imageObject = HVSpace; } } /* Setup pages ---------------------------------------------------------*/ if (authorsTags != NULL) { pages[nextPage] = _(MSG_AUTHORS); nextPage++; } if (sponsorsTags != NULL) { pages[nextPage] = _(MSG_SPONSORS); nextPage++; } self = (Object *) DoSuperNewTags ( CLASS, self, NULL, MUIA_Window_Activate, TRUE, MUIA_Window_NoMenus, TRUE, MUIA_Window_Height, MUIV_Window_Height_Visible(25), MUIA_Window_Width, MUIV_Window_Width_Visible(25), WindowContents, (IPTR) VGroup, GroupSpacing(6), Child, (IPTR) (imageGroup = (Object *)HGroup, MUIA_Weight, 0, Child, (IPTR) HVSpace, Child, (IPTR) imageObject, Child, (IPTR) HVSpace, End), Child, (IPTR) (versionObject = (Object *)TextObject, MUIA_Text_PreParse, (IPTR) MUIX_C, MUIA_Text_Contents, (IPTR) NULL, End), Child, (IPTR) (copyrightObject = (Object *)TextObject, MUIA_Text_PreParse, (IPTR) MUIX_C, MUIA_Text_Contents, (IPTR) NULL, End), Child, (IPTR) (descriptionGroup = (Object *)VGroup, Child, (IPTR) VSpace(6), Child, (IPTR) (descriptionObject = (Object *)TextObject, MUIA_Text_PreParse, (IPTR) MUIX_I MUIX_C, MUIA_Text_Contents, (IPTR) NULL, End), End), Child, (IPTR) VSpace(6), Child, (IPTR) RegisterGroup(pages), Child, (IPTR) ListviewObject, MUIA_Listview_List, (IPTR) (authorsList = (Object *)ListObject, ReadListFrame, End), End, Child, (IPTR) ListviewObject, MUIA_Listview_List, (IPTR) (sponsorsList = (Object *)ListObject, ReadListFrame, End), End, End, End, TAG_MORE, (IPTR) message->ops_AttrList ); if (self == NULL) goto error; data = INST_DATA(CLASS, self); data->awd_Catalog = catalog; data->awd_Pool = pool; data->awd_RootGroup = rootGroup; data->awd_ImageGroup = imageGroup; data->awd_ImageObject = imageObject; data->awd_VersionObject = versionObject; data->awd_CopyrightObject = copyrightObject; data->awd_DescriptionGroup = descriptionGroup; data->awd_DescriptionObject = descriptionObject; data->awd_Title = title; data->awd_VersionNumber = versionNumber; data->awd_VersionDate = versionDate; data->awd_VersionExtra = versionExtra; data->awd_Copyright = copyright; data->awd_Description = description; if (authorsTags != NULL) NamesToList(authorsList, authorsTags, data); if (sponsorsTags != NULL) NamesToList(sponsorsList, sponsorsTags, data); /* Setup notifications */ DoMethod ( self, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, (IPTR) self, 2, MUIA_Window_Open, FALSE ); return self; error: if (catalog != NULL) CloseCatalog(catalog); return NULL; }