2 Copyright © 2003-2019, The AROS Development Team. All rights reserved.
3 This file is part of the About program, which is distributed under
4 the terms of version 2 of the GNU General Public License.
9 #define MUIMASTER_YES_INLINE_STDARG
11 #include <aros/debug.h>
12 #include <aros/build.h>
13 #include <aros/inquire.h>
14 #include <exec/types.h>
15 #include <utility/tagitem.h>
16 #include <libraries/mui.h>
18 #include <proto/alib.h>
19 #include <proto/aros.h>
20 #include <proto/exec.h>
21 #include <proto/dos.h>
22 #include <proto/intuition.h>
23 #include <proto/utility.h>
24 #include <proto/muimaster.h>
25 #include <proto/workbench.h>
27 #include <zune/aboutwindow.h>
28 #include <zune/customclasses.h>
33 #include "aboutaros.h"
39 #include "acknowledgements.h"
41 #define VERSION "$VER: AboutAROS 0.2 ("ADATE") ©AROS Dev Team"
43 #define WINDOW_BG ((IPTR) "2:00000000,00000000,00000000")
44 #define REGISTER_BG ((IPTR) "7:V,00000000,92000000,91000000-00000000,82000000,81000000")
45 #define LIST_BG ((IPTR) "2:00000000,82000000,81000000")
47 #define SETUP_INST_DATA struct AboutAROS_DATA *data = INST_DATA(CLASS, self)
49 /*** Private methods ********************************************************/
50 #define MUIM_AboutAROS_ShowLicense (TAG_USER | 0x20000000)
52 /*** Instance Data **********************************************************/
59 /*** Utility Functions ******************************************************/
60 STRPTR
Section2Name(ULONG section
)
64 case SID_COORDINATION
: return _(MSG_SECTION_COORDINATION
);
65 case SID_EVANGELISM
: return _(MSG_SECTION_EVANGELISM
);
66 case SID_HIDD
: return _(MSG_SECTION_HIDD
);
67 case SID_INTUITION
: return _(MSG_SECTION_INTUITION
);
68 case SID_GRAPHICS
: return _(MSG_SECTION_GRAPHICS
);
69 case SID_SHELL_COMMANDS
: return _(MSG_SECTION_SHELL_COMMANDS
);
70 case SID_WORKBENCH
: return _(MSG_SECTION_WORKBENCH
);
71 case SID_TOOLS
: return _(MSG_SECTION_TOOLS
);
72 case SID_PREFERENCES
: return _(MSG_SECTION_PREFERENCES
);
73 case SID_BGUI
: return _(MSG_SECTION_BGUI
);
74 case SID_ZUNE
: return _(MSG_SECTION_ZUNE
);
75 case SID_KERNEL
: return _(MSG_SECTION_KERNEL
);
76 case SID_DOS
: return _(MSG_SECTION_DOS
);
77 case SID_NETWORKING
: return _(MSG_SECTION_NETWORK
);
78 case SID_LIBC_POSIX
: return _(MSG_SECTION_LIBC_POSIX
);
79 case SID_DOCUMENTATION
: return _(MSG_SECTION_DOCUMENTATION
);
80 case SID_TRANSLATION
: return _(MSG_SECTION_TRANSLATION
);
81 case SID_ARTISTRY
: return _(MSG_SECTION_ARTISTRY
);
82 case SID_WEBSITE
: return _(MSG_SECTION_WEBSITE
);
83 case SID_DATATYPES
: return _(MSG_SECTION_DATATYPES
);
84 case SID_TESTING
: return _(MSG_SECTION_TESTING
);
91 Object
*list
, struct TagItem
*tags
, struct AboutAROS_DATA
*data
94 struct TagItem
*tstate
= tags
;
95 struct TagItem
*tag
= NULL
;
97 IPTR section
= SID_NONE
;
98 STRPTR sectionName
= NULL
;
99 BOOL sectionFirst
= TRUE
;
104 if (tags
== NULL
) return FALSE
;
106 while ((tag
= NextTagItem(&tstate
)) != NULL
&& success
== TRUE
)
111 section
= tag
->ti_Data
;
112 sectionName
= Section2Name(section
);
114 if (sectionName
!= NULL
)
117 ? sectionFirst
= FALSE
120 list
, MUIM_List_InsertSingle
, (IPTR
) "",
121 MUIV_List_Insert_Bottom
124 length
= strlen(MUIX_B
) + strlen(sectionName
) + 1;
125 buffer
= AllocPooled(data
->aad_Pool
, length
);
129 strcat(buffer
, MUIX_B
);
130 strcat(buffer
, sectionName
);
134 list
, MUIM_List_InsertSingle
,
135 (IPTR
) buffer
, MUIV_List_Insert_Bottom
148 name
= (STRPTR
) tag
->ti_Data
;
150 length
= strlen(name
) + 1;
151 if (sectionName
!= NULL
) length
+= 4;
153 buffer
= AllocPooled(data
->aad_Pool
, length
);
157 if (sectionName
!= NULL
) strcat(buffer
, " ");
158 strcat(buffer
, name
);
162 list
, MUIM_List_InsertSingle
,
163 (IPTR
) buffer
, MUIV_List_Insert_Bottom
179 /*** Methods ****************************************************************/
180 Object
*AboutAROS__OM_NEW(Class
*CLASS
, Object
*self
, struct opSet
*message
)
186 *acknowledgementsList
;
188 STRPTR pages
[4] = { NULL
};
189 STRPTR str_builddate
= NULL
;
190 STRPTR str_variant
= NULL
;
191 STRPTR str_arosarch
= NULL
;
192 STRPTR str_buildtype
;
199 /* Allocate memory pool ------------------------------------------------*/
200 pool
= CreatePool(MEMF_ANY
, 4096, 4096);
201 if (pool
== NULL
) return NULL
;
203 /* Check if the logotype is available ----------------------------------*/
204 if ((lock
= Lock(LOGOTYPE_IMAGE
, ACCESS_READ
)) != BNULL
)
211 showLogotype
= FALSE
;
214 /* Retrieve the build date and the variant name ------------------------*/
215 ArosInquire(AI_ArosBuildDate
, (IPTR
) &str_builddate
,
216 AI_ArosVariant
, (IPTR
) &str_variant
,
217 AI_ArosArchitecture
, (IPTR
) &str_arosarch
,
218 AI_ArosABIMajor
, (IPTR
) &abiversion
,
221 str_buildtype
= AllocPooled(pool
, strlen(_(MSG_BUILD_TYPE
)) + strlen(str_arosarch
) + 1);
222 sprintf(str_buildtype
, _(MSG_BUILD_TYPE
), str_arosarch
);
223 if (abiversion
!= -1)
225 str_abi
= AllocPooled(pool
, 7 + 1);
226 sprintf(str_abi
, "ABI_V%d", (int)abiversion
);
232 /* Initialize page labels ----------------------------------------------*/
233 pages
[0] = _(MSG_PAGE_AUTHORS
);
234 pages
[1] = _(MSG_PAGE_SPONSORS
);
235 pages
[2] = _(MSG_PAGE_ACKNOWLEDGEMENTS
);
237 /* Create application and window objects -------------------------------*/
238 self
= (Object
*) DoSuperNewTags
242 MUIA_Application_Title
, __(MSG_TITLE
),
243 MUIA_Application_Version
, (IPTR
)VERSION
,
244 MUIA_Application_Copyright
, (IPTR
)"© 2010, The AROS Development Team",
245 MUIA_Application_Description
, __(MSG_TITLE
),
246 MUIA_Application_Base
, (IPTR
) "ABOUTAROS",
247 SubWindow
, (IPTR
) (window
= (Object
*)WindowObject
,
248 MUIA_Window_Title
, __(MSG_TITLE
),
249 MUIA_Window_Width
, MUIV_Window_Width_MinMax(0),
250 MUIA_Window_NoMenus
, TRUE
,
251 MUIA_Window_Activate
, TRUE
,
252 MUIA_Window_ID
, MAKE_ID('A','B','W','N'),
253 WindowContents
, (IPTR
) VGroup
,
256 MUIA_Background
, WINDOW_BG
,
259 ? (IPTR
) ImageObject
,
260 MUIA_Image_Spec
, (IPTR
) "3:"LOGOTYPE_IMAGE
,
263 MUIA_Font
, MUIV_Font_Fixed
,
264 MUIA_Text_PreParse
, (IPTR
) "\0333\033b\033c",
265 MUIA_Text_Contents
, (IPTR
) LOGOTYPE_ASCII
,
269 Child
, (IPTR
) VSpace(4),
270 Child
, (IPTR
) HGroup
,
274 Child
, (IPTR
) HVSpace
,
275 Child
, (IPTR
) TextObject
,
276 MUIA_Font
, MUIV_Font_Big
,
277 MUIA_Text_PreParse
, (IPTR
) "\0333\033b",
278 MUIA_Text_Contents
, (IPTR
) str_buildtype
,
282 Child
, (IPTR
) TextObject
,
283 MUIA_Font
, MUIV_Font_Big
,
284 MUIA_Text_PreParse
, (IPTR
) "\0333\033b",
285 MUIA_Text_Contents
, (IPTR
) str_abi
,
289 Child
, (IPTR
) TextObject
,
290 MUIA_Font
, MUIV_Font_Big
,
291 MUIA_Text_PreParse
, (IPTR
) "\0333\033b",
292 MUIA_Text_Contents
, (IPTR
) str_variant
,
295 Child
, (IPTR
) TextObject
,
296 MUIA_Font
, MUIV_Font_Big
,
297 MUIA_Text_PreParse
, (IPTR
) "\0333\033b",
298 MUIA_Text_Contents
, (IPTR
) str_builddate
,
301 Child
, (IPTR
) HVSpace
,
304 Child
, (IPTR
) HGroup
,
308 Child
, (IPTR
) TextObject
,
309 MUIA_Text_PreParse
, (IPTR
) "\0333\033b",
310 MUIA_Text_Contents
, (IPTR
) "" REPOTYPE
" ID: " REPOREVISION
,
314 Child
, (IPTR
) TextObject
,
315 MUIA_Text_PreParse
, (IPTR
) "\0333\033b",
316 MUIA_Text_Contents
, (IPTR
) " (" REPOID
")",
322 Child
, (IPTR
) VSpace(4),
323 Child
, (IPTR
) TextObject
,
324 MUIA_Text_PreParse
, (IPTR
) "\0333\033c",
325 MUIA_Text_Contents
, __(MSG_COPYRIGHT
),
327 Child
, (IPTR
) HGroup
,
331 Child
, (IPTR
) HVSpace
,
332 Child
, (IPTR
) TextObject
,
333 MUIA_Text_PreParse
, (IPTR
) "\0333",
334 MUIA_Text_Contents
, __(MSG_LICENSE_1
),
337 Child
, (IPTR
) TextObject
,
338 MUIA_Text_Contents
, (IPTR
) " ",
341 Child
, (IPTR
) (licenseButton
= (Object
*)TextObject
,
342 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
343 MUIA_Text_PreParse
, (IPTR
) "\0333\033u",
344 MUIA_Text_Contents
, __(MSG_LICENSE_2
),
347 Child
, (IPTR
) TextObject
,
348 MUIA_Text_PreParse
, (IPTR
) "\0333",
349 MUIA_Text_Contents
, __(MSG_LICENSE_3
),
352 Child
, (IPTR
) HVSpace
,
354 Child
, (IPTR
) TextObject
,
355 MUIA_Text_PreParse
, (IPTR
) "\0333\033c",
356 MUIA_Text_Contents
, __(MSG_MORE_INFORMATION
),
358 Child
, (IPTR
) VSpace(4),
359 Child
, (IPTR
) VGroup
,
362 Child
, (IPTR
) RegisterGroup(pages
),
363 MUIA_Background
, REGISTER_BG
,
365 Child
, (IPTR
) ListviewObject
,
366 MUIA_Listview_List
, (IPTR
) (authorsList
= (Object
*)ListObject
,
368 MUIA_Background
, LIST_BG
,
371 Child
, (IPTR
) ListviewObject
,
372 MUIA_Listview_List
, (IPTR
) (sponsorsList
= (Object
*)ListObject
,
374 MUIA_Background
, LIST_BG
,
377 Child
, (IPTR
) ListviewObject
,
378 MUIA_Listview_List
, (IPTR
) (acknowledgementsList
= (Object
*)ListObject
,
380 MUIA_Background
, LIST_BG
,
395 data
->aad_Window
= window
;
396 data
->aad_Pool
= pool
;
398 /*-- Initialize lists --------------------------------------------------*/
399 NamesToList(authorsList
, AUTHORS
, data
);
400 NamesToList(sponsorsList
, SPONSORS
, data
);
404 acknowledgementsList
, MUIM_List_Insert
,
405 (IPTR
) ACKNOWLEDGEMENTS
, ACKNOWLEDGEMENTS_SIZE
, MUIV_List_Insert_Top
408 /*-- Setup notifications -----------------------------------------------*/
411 window
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
412 (IPTR
) self
, 2, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
417 licenseButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
418 (IPTR
) self
, 1, MUIM_AboutAROS_ShowLicense
425 IPTR
AboutAROS__OM_DISPOSE(Class
*CLASS
, Object
*self
, Msg message
)
429 if (data
->aad_Pool
!= NULL
) DeletePool(data
->aad_Pool
);
431 return DoSuperMethodA(CLASS
, self
, message
);
434 IPTR
AboutAROS__MUIM_Application_Execute(Class
*CLASS
, Object
*self
, Msg message
)
438 SET(data
->aad_Window
, MUIA_Window_Open
, TRUE
);
439 DoSuperMethodA(CLASS
, self
, message
);
440 SET(data
->aad_Window
, MUIA_Window_Open
, FALSE
);
445 IPTR
AboutAROS__MUIM_AboutAROS_ShowLicense(Class
*CLASS
, Object
*self
, Msg message
)
447 OpenWorkbenchObject("HELP:LICENSE", TAG_DONE
);
452 /*** Setup ******************************************************************/
455 AboutAROS
, NULL
, MUIC_Application
, NULL
,
456 OM_NEW
, struct opSet
*,
458 MUIM_Application_Execute
, Msg
,
459 MUIM_AboutAROS_ShowLicense
, Msg