2 Copyright © 2003-2008, 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/aros.h>
19 #include <proto/exec.h>
20 #include <proto/dos.h>
21 #include <proto/intuition.h>
22 #include <proto/utility.h>
23 #include <proto/muimaster.h>
24 #include <proto/workbench.h>
26 #include <zune/aboutwindow.h>
27 #include <zune/customclasses.h>
32 #include "aboutaros.h"
38 #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
);
90 Object
*list
, struct TagItem
*tags
, struct AboutAROS_DATA
*data
93 const struct TagItem
*tstate
= tags
;
94 struct TagItem
*tag
= NULL
;
96 IPTR section
= SID_NONE
;
97 STRPTR sectionName
= NULL
;
98 BOOL sectionFirst
= TRUE
;
103 if (tags
== NULL
) return FALSE
;
105 while ((tag
= NextTagItem(&tstate
)) != NULL
&& success
== TRUE
)
110 section
= tag
->ti_Data
;
111 sectionName
= Section2Name(section
);
113 if (sectionName
!= NULL
)
116 ? sectionFirst
= FALSE
119 list
, MUIM_List_InsertSingle
, (IPTR
) "",
120 MUIV_List_Insert_Bottom
123 length
= strlen(MUIX_B
) + strlen(sectionName
) + 1;
124 buffer
= AllocPooled(data
->aad_Pool
, length
);
128 strcat(buffer
, MUIX_B
);
129 strcat(buffer
, sectionName
);
133 list
, MUIM_List_InsertSingle
,
134 (IPTR
) buffer
, MUIV_List_Insert_Bottom
147 name
= (STRPTR
) tag
->ti_Data
;
149 length
= strlen(name
) + 1;
150 if (sectionName
!= NULL
) length
+= 4;
152 buffer
= AllocPooled(data
->aad_Pool
, length
);
156 if (sectionName
!= NULL
) strcat(buffer
, " ");
157 strcat(buffer
, name
);
161 list
, MUIM_List_InsertSingle
,
162 (IPTR
) buffer
, MUIV_List_Insert_Bottom
178 /*** Methods ****************************************************************/
179 Object
*AboutAROS__OM_NEW(Class
*CLASS
, Object
*self
, struct opSet
*message
)
185 *acknowledgementsList
;
187 STRPTR pages
[4] = { NULL
};
188 STRPTR str_builddate
;
191 STRPTR str_buildtype
;
196 /* Allocate memory pool ------------------------------------------------*/
197 pool
= CreatePool(MEMF_ANY
, 4096, 4096);
198 if (pool
== NULL
) return NULL
;
200 /* Check if the logotype is available ----------------------------------*/
201 if ((lock
= Lock(LOGOTYPE_IMAGE
, ACCESS_READ
)) != NULL
)
208 showLogotype
= FALSE
;
211 /* Retrieve the build date and the variant name ------------------------*/
212 ArosInquire(AI_ArosBuildDate
, (IPTR
) &str_builddate
,
213 AI_ArosVariant
, (IPTR
) &str_variant
,
214 AI_ArosArchitecture
, (IPTR
) &str_arosarch
,
217 str_buildtype
= AllocPooled(pool
, strlen(_(MSG_BUILD_TYPE
)) + strlen(str_arosarch
) + 1);
218 sprintf(str_buildtype
, _(MSG_BUILD_TYPE
), str_arosarch
);
220 /* Initialize page labels ----------------------------------------------*/
221 pages
[0] = _(MSG_PAGE_AUTHORS
);
222 pages
[1] = _(MSG_PAGE_SPONSORS
);
223 pages
[2] = _(MSG_PAGE_ACKNOWLEDGEMENTS
);
225 /* Create application and window objects -------------------------------*/
226 self
= (Object
*) DoSuperNewTags
230 MUIA_Application_Title
, __(MSG_TITLE
),
231 MUIA_Application_Version
, (IPTR
)VERSION
,
232 MUIA_Application_Copyright
, (IPTR
)"© 2006, The AROS Development Team",
233 MUIA_Application_Description
, __(MSG_TITLE
),
234 MUIA_Application_Base
, (IPTR
) "ABOUTAROS",
235 SubWindow
, (IPTR
) (window
= (Object
*)WindowObject
,
236 MUIA_Window_Title
, __(MSG_TITLE
),
237 MUIA_Window_Width
, MUIV_Window_Width_MinMax(0),
238 MUIA_Window_NoMenus
, TRUE
,
239 MUIA_Window_Activate
, TRUE
,
240 MUIA_Window_ID
, MAKE_ID('A','B','W','N'),
241 WindowContents
, (IPTR
) VGroup
,
244 MUIA_Background
, WINDOW_BG
,
247 ? (IPTR
) ImageObject
,
248 MUIA_Image_Spec
, (IPTR
) "3:"LOGOTYPE_IMAGE
,
251 MUIA_Font
, MUIV_Font_Fixed
,
252 MUIA_Text_PreParse
, (IPTR
) "\0333\033b\033c",
253 MUIA_Text_Contents
, (IPTR
) LOGOTYPE_ASCII
,
257 Child
, (IPTR
) VSpace(4),
258 Child
, (IPTR
) HGroup
,
262 Child
, (IPTR
) HVSpace
,
263 Child
, (IPTR
) TextObject
,
264 MUIA_Font
, MUIV_Font_Big
,
265 MUIA_Text_PreParse
, (IPTR
) "\0333\033b",
266 MUIA_Text_Contents
, (IPTR
) str_buildtype
,
270 Child
, (IPTR
) TextObject
,
271 MUIA_Font
, MUIV_Font_Big
,
272 MUIA_Text_PreParse
, (IPTR
) "\0333\033b",
273 MUIA_Text_Contents
, (IPTR
) str_variant
,
276 Child
, (IPTR
) TextObject
,
277 MUIA_Font
, MUIV_Font_Big
,
278 MUIA_Text_PreParse
, (IPTR
) "\0333\033b",
279 MUIA_Text_Contents
, (IPTR
) str_builddate
,
282 Child
, (IPTR
) TextObject
,
283 MUIA_Font
, MUIV_Font_Big
,
284 MUIA_Text_PreParse
, (IPTR
) "\0333\033b",
285 MUIA_Text_Contents
, (IPTR
) "SVN: " SVNREV
,
288 Child
, (IPTR
) HVSpace
,
290 Child
, (IPTR
) VSpace(4),
291 Child
, (IPTR
) TextObject
,
292 MUIA_Text_PreParse
, (IPTR
) "\0333\033c",
293 MUIA_Text_Contents
, __(MSG_COPYRIGHT
),
295 Child
, (IPTR
) HGroup
,
299 Child
, (IPTR
) HVSpace
,
300 Child
, (IPTR
) TextObject
,
301 MUIA_Text_PreParse
, (IPTR
) "\0333",
302 MUIA_Text_Contents
, __(MSG_LICENSE_1
),
305 Child
, (IPTR
) TextObject
,
306 MUIA_Text_Contents
, (IPTR
) " ",
309 Child
, (IPTR
) (licenseButton
= (Object
*)TextObject
,
310 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
311 MUIA_Text_PreParse
, (IPTR
) "\0333\033u",
312 MUIA_Text_Contents
, __(MSG_LICENSE_2
),
315 Child
, (IPTR
) TextObject
,
316 MUIA_Text_PreParse
, (IPTR
) "\0333",
317 MUIA_Text_Contents
, __(MSG_LICENSE_3
),
320 Child
, (IPTR
) HVSpace
,
322 Child
, (IPTR
) TextObject
,
323 MUIA_Text_PreParse
, (IPTR
) "\0333\033c",
324 MUIA_Text_Contents
, __(MSG_MORE_INFORMATION
),
326 Child
, (IPTR
) VSpace(4),
327 Child
, (IPTR
) VGroup
,
330 Child
, (IPTR
) RegisterGroup(pages
),
331 MUIA_Background
, REGISTER_BG
,
333 Child
, (IPTR
) ListviewObject
,
334 MUIA_Listview_List
, (IPTR
) (authorsList
= (Object
*)ListObject
,
336 MUIA_Background
, LIST_BG
,
339 Child
, (IPTR
) ListviewObject
,
340 MUIA_Listview_List
, (IPTR
) (sponsorsList
= (Object
*)ListObject
,
342 MUIA_Background
, LIST_BG
,
345 Child
, (IPTR
) ListviewObject
,
346 MUIA_Listview_List
, (IPTR
) (acknowledgementsList
= (Object
*)ListObject
,
348 MUIA_Background
, LIST_BG
,
363 data
->aad_Window
= window
;
364 data
->aad_Pool
= pool
;
366 /*-- Initialize lists --------------------------------------------------*/
367 NamesToList(authorsList
, AUTHORS
, data
);
368 NamesToList(sponsorsList
, SPONSORS
, data
);
372 acknowledgementsList
, MUIM_List_Insert
,
373 (IPTR
) ACKNOWLEDGEMENTS
, ACKNOWLEDGEMENTS_SIZE
, MUIV_List_Insert_Top
376 /*-- Setup notifications -----------------------------------------------*/
379 window
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
380 (IPTR
) self
, 2, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
385 licenseButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
386 (IPTR
) self
, 1, MUIM_AboutAROS_ShowLicense
393 IPTR
AboutAROS__OM_DISPOSE(Class
*CLASS
, Object
*self
, Msg message
)
397 if (data
->aad_Pool
!= NULL
) DeletePool(data
->aad_Pool
);
399 return DoSuperMethodA(CLASS
, self
, message
);
402 IPTR
AboutAROS__MUIM_Application_Execute(Class
*CLASS
, Object
*self
, Msg message
)
406 SET(data
->aad_Window
, MUIA_Window_Open
, TRUE
);
407 DoSuperMethodA(CLASS
, self
, message
);
408 SET(data
->aad_Window
, MUIA_Window_Open
, FALSE
);
413 IPTR
AboutAROS__MUIM_AboutAROS_ShowLicense(Class
*CLASS
, Object
*self
, Msg message
)
415 OpenWorkbenchObject("HELP:LICENSE", TAG_DONE
);
420 /*** Setup ******************************************************************/
423 AboutAROS
, NULL
, MUIC_Application
, NULL
,
424 OM_NEW
, struct opSet
*,
426 MUIM_Application_Execute
, Msg
,
427 MUIM_AboutAROS_ShowLicense
, Msg