2 Copyright © 2003-2004, 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"
40 #define VERSION "$VER: AboutAROS 0.1 ("ADATE") ©AROS Dev Team"
42 #define WINDOW_BG ((IPTR) "2:00000000,00000000,00000000")
43 #define REGISTER_BG ((IPTR) "7:V,00000000,92000000,91000000-00000000,82000000,81000000")
44 #define LIST_BG ((IPTR) "2:00000000,82000000,81000000")
46 #define SETUP_INST_DATA struct AboutAROS_DATA *data = INST_DATA(CLASS, self)
48 /*** Private methods ********************************************************/
49 #define MUIM_AboutAROS_ShowLicense (TAG_USER | 0x20000000)
51 /*** Instance Data **********************************************************/
58 /*** Utility Functions ******************************************************/
59 STRPTR
Section2Name(ULONG section
)
63 case SID_COORDINATION
: return _(MSG_SECTION_COORDINATION
);
64 case SID_EVANGELISM
: return _(MSG_SECTION_EVANGELISM
);
65 case SID_HIDD
: return _(MSG_SECTION_HIDD
);
66 case SID_INTUITION
: return _(MSG_SECTION_INTUITION
);
67 case SID_GRAPHICS
: return _(MSG_SECTION_GRAPHICS
);
68 case SID_SHELL_COMMANDS
: return _(MSG_SECTION_SHELL_COMMANDS
);
69 case SID_WORKBENCH
: return _(MSG_SECTION_WORKBENCH
);
70 case SID_TOOLS
: return _(MSG_SECTION_TOOLS
);
71 case SID_PREFERENCES
: return _(MSG_SECTION_PREFERENCES
);
72 case SID_BGUI
: return _(MSG_SECTION_BGUI
);
73 case SID_ZUNE
: return _(MSG_SECTION_ZUNE
);
74 case SID_KERNEL
: return _(MSG_SECTION_KERNEL
);
75 case SID_DOS
: return _(MSG_SECTION_DOS
);
76 case SID_LIBC_POSIX
: return _(MSG_SECTION_LIBC_POSIX
);
77 case SID_DOCUMENTATION
: return _(MSG_SECTION_DOCUMENTATION
);
78 case SID_TRANSLATION
: return _(MSG_SECTION_TRANSLATION
);
79 case SID_ARTISTRY
: return _(MSG_SECTION_ARTISTRY
);
80 case SID_WEBSITE
: return _(MSG_SECTION_WEBSITE
);
81 case SID_DATATYPES
: return _(MSG_SECTION_DATATYPES
);
88 Object
*list
, struct TagItem
*tags
, struct AboutAROS_DATA
*data
91 const struct TagItem
*tstate
= tags
;
92 struct TagItem
*tag
= NULL
;
94 IPTR section
= SID_NONE
;
95 STRPTR sectionName
= NULL
;
96 BOOL sectionFirst
= TRUE
;
101 if (tags
== NULL
) return FALSE
;
103 while ((tag
= NextTagItem(&tstate
)) != NULL
&& success
== TRUE
)
108 section
= tag
->ti_Data
;
109 sectionName
= Section2Name(section
);
111 if (sectionName
!= NULL
)
114 ? sectionFirst
= FALSE
117 list
, MUIM_List_InsertSingle
, (IPTR
) "",
118 MUIV_List_Insert_Bottom
121 length
= strlen(MUIX_B
) + strlen(sectionName
) + 1;
122 buffer
= AllocPooled(data
->aad_Pool
, length
);
126 strcat(buffer
, MUIX_B
);
127 strcat(buffer
, sectionName
);
131 list
, MUIM_List_InsertSingle
,
132 (IPTR
) buffer
, MUIV_List_Insert_Bottom
145 name
= (STRPTR
) tag
->ti_Data
;
147 length
= strlen(name
) + 1;
148 if (sectionName
!= NULL
) length
+= 4;
150 buffer
= AllocPooled(data
->aad_Pool
, length
);
154 if (sectionName
!= NULL
) strcat(buffer
, " ");
155 strcat(buffer
, name
);
159 list
, MUIM_List_InsertSingle
,
160 (IPTR
) buffer
, MUIV_List_Insert_Bottom
176 /*** Methods ****************************************************************/
177 Object
*AboutAROS__OM_NEW(Class
*CLASS
, Object
*self
, struct opSet
*message
)
183 *acknowledgementsList
;
185 STRPTR pages
[4] = { NULL
};
192 /* Allocate memory pool ------------------------------------------------*/
193 pool
= CreatePool(MEMF_ANY
, 4096, 4096);
194 if (pool
== NULL
) return NULL
;
196 /* Check if the logotype is available ----------------------------------*/
197 if ((lock
= Lock(LOGOTYPE_IMAGE
, ACCESS_READ
)) != NULL
)
204 showLogotype
= FALSE
;
207 /* Retrieve the build date and the variant name ------------------------*/
208 ArosInquire(AI_ArosBuildDate
, (IPTR
) &builddate
,
209 AI_ArosVariant
, (IPTR
) &variant
,
212 /* Initialize page labels ----------------------------------------------*/
213 pages
[0] = _(MSG_PAGE_AUTHORS
);
214 pages
[1] = _(MSG_PAGE_SPONSORS
);
215 pages
[2] = _(MSG_PAGE_ACKNOWLEDGEMENTS
);
217 /* Create application and window objects -------------------------------*/
218 self
= (Object
*) DoSuperNewTags
222 MUIA_Application_Title
, __(MSG_TITLE
),
223 MUIA_Application_Version
, (IPTR
)VERSION
,
224 MUIA_Application_Copyright
, (IPTR
)"© 2006, The AROS Development Team",
225 MUIA_Application_Description
, __(MSG_TITLE
),
226 MUIA_Application_Base
, (IPTR
) "ABOUTAROS",
227 SubWindow
, (IPTR
) (window
= WindowObject
,
228 MUIA_Window_Title
, __(MSG_TITLE
),
229 MUIA_Window_Width
, MUIV_Window_Width_MinMax(0),
230 MUIA_Window_NoMenus
, TRUE
,
231 MUIA_Window_Activate
, TRUE
,
232 MUIA_Window_ID
, MAKE_ID('A','B','W','N'),
233 WindowContents
, (IPTR
) VGroup
,
236 MUIA_Background
, WINDOW_BG
,
239 ? (IPTR
) ImageObject
,
240 MUIA_Image_Spec
, (IPTR
) "3:"LOGOTYPE_IMAGE
,
243 MUIA_Font
, MUIV_Font_Fixed
,
244 MUIA_Text_PreParse
, (IPTR
) "\0333\033b\033c",
245 MUIA_Text_Contents
, (IPTR
) LOGOTYPE_ASCII
,
249 Child
, (IPTR
) VSpace(4),
250 Child
, (IPTR
) HGroup
,
254 Child
, (IPTR
) HVSpace
,
255 Child
, (IPTR
) TextObject
,
256 MUIA_Font
, MUIV_Font_Big
,
257 MUIA_Text_PreParse
, (IPTR
) "\0333\033b",
258 MUIA_Text_Contents
, (IPTR
) __(MSG_BUILD_TYPE
),
261 Child
, (IPTR
) TextObject
,
262 MUIA_Font
, MUIV_Font_Big
,
263 MUIA_Text_PreParse
, (IPTR
) "\0333\033b",
264 MUIA_Text_Contents
, (IPTR
) variant
,
267 Child
, (IPTR
) TextObject
,
268 MUIA_Font
, MUIV_Font_Big
,
269 MUIA_Text_PreParse
, (IPTR
) "\0333\033b",
270 MUIA_Text_Contents
, (IPTR
) builddate
,
273 Child
, (IPTR
) HVSpace
,
275 Child
, (IPTR
) VSpace(4),
276 Child
, (IPTR
) TextObject
,
277 MUIA_Text_PreParse
, (IPTR
) "\0333\033c",
278 MUIA_Text_Contents
, __(MSG_COPYRIGHT
),
280 Child
, (IPTR
) HGroup
,
284 Child
, (IPTR
) HVSpace
,
285 Child
, (IPTR
) TextObject
,
286 MUIA_Text_PreParse
, (IPTR
) "\0333",
287 MUIA_Text_Contents
, __(MSG_LICENSE_1
),
290 Child
, (IPTR
) TextObject
,
291 MUIA_Text_Contents
, (IPTR
) " ",
294 Child
, (IPTR
) (licenseButton
= TextObject
,
295 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
296 MUIA_Text_PreParse
, (IPTR
) "\0333\033u",
297 MUIA_Text_Contents
, __(MSG_LICENSE_2
),
300 Child
, (IPTR
) TextObject
,
301 MUIA_Text_PreParse
, (IPTR
) "\0333",
302 MUIA_Text_Contents
, __(MSG_LICENSE_3
),
305 Child
, (IPTR
) HVSpace
,
307 Child
, (IPTR
) TextObject
,
308 MUIA_Text_PreParse
, (IPTR
) "\0333\033c",
309 MUIA_Text_Contents
, __(MSG_MORE_INFORMATION
),
311 Child
, (IPTR
) VSpace(4),
312 Child
, (IPTR
) VGroup
,
315 Child
, (IPTR
) RegisterGroup(pages
),
316 MUIA_Background
, REGISTER_BG
,
318 Child
, (IPTR
) ListviewObject
,
319 MUIA_Listview_List
, (IPTR
) (authorsList
= ListObject
,
321 MUIA_Background
, LIST_BG
,
324 Child
, (IPTR
) ListviewObject
,
325 MUIA_Listview_List
, (IPTR
) (sponsorsList
= ListObject
,
327 MUIA_Background
, LIST_BG
,
330 Child
, (IPTR
) ListviewObject
,
331 MUIA_Listview_List
, (IPTR
) (acknowledgementsList
= ListObject
,
333 MUIA_Background
, LIST_BG
,
348 data
->aad_Window
= window
;
349 data
->aad_Pool
= pool
;
351 /*-- Initialize lists --------------------------------------------------*/
352 NamesToList(authorsList
, AUTHORS
, data
);
353 NamesToList(sponsorsList
, SPONSORS
, data
);
357 acknowledgementsList
, MUIM_List_Insert
,
358 (IPTR
) ACKNOWLEDGEMENTS
, ACKNOWLEDGEMENTS_SIZE
, MUIV_List_Insert_Top
361 /*-- Setup notifications -----------------------------------------------*/
364 window
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
365 (IPTR
) self
, 2, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
370 licenseButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
371 (IPTR
) self
, 1, MUIM_AboutAROS_ShowLicense
378 IPTR
AboutAROS__OM_DISPOSE(Class
*CLASS
, Object
*self
, Msg message
)
382 if (data
->aad_Pool
!= NULL
) DeletePool(data
->aad_Pool
);
384 return DoSuperMethodA(CLASS
, self
, message
);
387 IPTR
AboutAROS__MUIM_Application_Execute(Class
*CLASS
, Object
*self
, Msg message
)
391 SET(data
->aad_Window
, MUIA_Window_Open
, TRUE
);
392 DoSuperMethodA(CLASS
, self
, message
);
393 SET(data
->aad_Window
, MUIA_Window_Open
, FALSE
);
398 IPTR
AboutAROS__MUIM_AboutAROS_ShowLicense(Class
*CLASS
, Object
*self
, Msg message
)
400 OpenWorkbenchObject("HELP:LICENSE", TAG_DONE
);
405 /*** Setup ******************************************************************/
408 AboutAROS
, NULL
, MUIC_Application
, NULL
,
409 OM_NEW
, struct opSet
*,
411 MUIM_Application_Execute
, Msg
,
412 MUIM_AboutAROS_ShowLicense
, Msg