2 Copyright © 2003-2011, 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.1 ("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
,
302 Child
, (IPTR
) TextObject
,
303 MUIA_Font
, MUIV_Font_Big
,
304 MUIA_Text_PreParse
, (IPTR
) "\0333\033b",
305 MUIA_Text_Contents
, (IPTR
) "SVN: " SVNREV
,
309 Child
, (IPTR
) HVSpace
,
311 Child
, (IPTR
) VSpace(4),
312 Child
, (IPTR
) TextObject
,
313 MUIA_Text_PreParse
, (IPTR
) "\0333\033c",
314 MUIA_Text_Contents
, __(MSG_COPYRIGHT
),
316 Child
, (IPTR
) HGroup
,
320 Child
, (IPTR
) HVSpace
,
321 Child
, (IPTR
) TextObject
,
322 MUIA_Text_PreParse
, (IPTR
) "\0333",
323 MUIA_Text_Contents
, __(MSG_LICENSE_1
),
326 Child
, (IPTR
) TextObject
,
327 MUIA_Text_Contents
, (IPTR
) " ",
330 Child
, (IPTR
) (licenseButton
= (Object
*)TextObject
,
331 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
332 MUIA_Text_PreParse
, (IPTR
) "\0333\033u",
333 MUIA_Text_Contents
, __(MSG_LICENSE_2
),
336 Child
, (IPTR
) TextObject
,
337 MUIA_Text_PreParse
, (IPTR
) "\0333",
338 MUIA_Text_Contents
, __(MSG_LICENSE_3
),
341 Child
, (IPTR
) HVSpace
,
343 Child
, (IPTR
) TextObject
,
344 MUIA_Text_PreParse
, (IPTR
) "\0333\033c",
345 MUIA_Text_Contents
, __(MSG_MORE_INFORMATION
),
347 Child
, (IPTR
) VSpace(4),
348 Child
, (IPTR
) VGroup
,
351 Child
, (IPTR
) RegisterGroup(pages
),
352 MUIA_Background
, REGISTER_BG
,
354 Child
, (IPTR
) ListviewObject
,
355 MUIA_Listview_List
, (IPTR
) (authorsList
= (Object
*)ListObject
,
357 MUIA_Background
, LIST_BG
,
360 Child
, (IPTR
) ListviewObject
,
361 MUIA_Listview_List
, (IPTR
) (sponsorsList
= (Object
*)ListObject
,
363 MUIA_Background
, LIST_BG
,
366 Child
, (IPTR
) ListviewObject
,
367 MUIA_Listview_List
, (IPTR
) (acknowledgementsList
= (Object
*)ListObject
,
369 MUIA_Background
, LIST_BG
,
384 data
->aad_Window
= window
;
385 data
->aad_Pool
= pool
;
387 /*-- Initialize lists --------------------------------------------------*/
388 NamesToList(authorsList
, AUTHORS
, data
);
389 NamesToList(sponsorsList
, SPONSORS
, data
);
393 acknowledgementsList
, MUIM_List_Insert
,
394 (IPTR
) ACKNOWLEDGEMENTS
, ACKNOWLEDGEMENTS_SIZE
, MUIV_List_Insert_Top
397 /*-- Setup notifications -----------------------------------------------*/
400 window
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
401 (IPTR
) self
, 2, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
406 licenseButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
407 (IPTR
) self
, 1, MUIM_AboutAROS_ShowLicense
414 IPTR
AboutAROS__OM_DISPOSE(Class
*CLASS
, Object
*self
, Msg message
)
418 if (data
->aad_Pool
!= NULL
) DeletePool(data
->aad_Pool
);
420 return DoSuperMethodA(CLASS
, self
, message
);
423 IPTR
AboutAROS__MUIM_Application_Execute(Class
*CLASS
, Object
*self
, Msg message
)
427 SET(data
->aad_Window
, MUIA_Window_Open
, TRUE
);
428 DoSuperMethodA(CLASS
, self
, message
);
429 SET(data
->aad_Window
, MUIA_Window_Open
, FALSE
);
434 IPTR
AboutAROS__MUIM_AboutAROS_ShowLicense(Class
*CLASS
, Object
*self
, Msg message
)
436 OpenWorkbenchObject("HELP:LICENSE", TAG_DONE
);
441 /*** Setup ******************************************************************/
444 AboutAROS
, NULL
, MUIC_Application
, NULL
,
445 OM_NEW
, struct opSet
*,
447 MUIM_Application_Execute
, Msg
,
448 MUIM_AboutAROS_ShowLicense
, Msg