2 Copyright © 1995-2009, The AROS Development Team. All rights reserved.
6 /*********************************************************************************************/
8 #include <intuition/intuition.h>
9 #include <libraries/asl.h>
10 #include <libraries/gadtools.h>
11 #include <proto/exec.h>
12 #include <proto/dos.h>
13 #include <proto/intuition.h>
14 #include <proto/gadtools.h>
15 #include <proto/asl.h>
17 #define CATCOMP_NUMBERS
25 const char *versionstring
= VERSIONSTR
;
27 /*********************************************************************************************/
29 struct Library
*AslBase
;
31 /*********************************************************************************************/
33 static struct NewMenu nm
[] =
35 {NM_TITLE
, (STRPTR
)MSG_MEN_PROJECT
},
36 {NM_ITEM
, (STRPTR
)MSG_MEN_PROJECT_OPEN
},
37 {NM_ITEM
, NM_BARLABEL
},
38 {NM_ITEM
, (STRPTR
)MSG_MEN_PROJECT_SAVEAS
},
39 {NM_ITEM
, NM_BARLABEL
},
40 {NM_ITEM
, (STRPTR
)MSG_MEN_PROJECT_PRINT
},
41 {NM_ITEM
, (STRPTR
)MSG_MEN_PROJECT_ABOUT
},
42 {NM_ITEM
, NM_BARLABEL
},
43 {NM_ITEM
, (STRPTR
)MSG_MEN_PROJECT_QUIT
},
44 {NM_TITLE
, (STRPTR
)MSG_MEN_NAVIGATION
},
45 {NM_ITEM
, (STRPTR
)MSG_MEN_NAVIGATION_FIND
},
46 {NM_ITEM
, (STRPTR
)MSG_MEN_NAVIGATION_FIND_NEXT
},
47 {NM_ITEM
, (STRPTR
)MSG_MEN_NAVIGATION_FIND_PREV
},
48 {NM_ITEM
, NM_BARLABEL
},
49 {NM_ITEM
, (STRPTR
)MSG_MEN_NAVIGATION_JUMP
},
53 /*********************************************************************************************/
57 struct NewMenu
*actnm
= nm
;
59 for(actnm
= nm
; actnm
->nm_Type
!= NM_END
; actnm
++)
61 if (actnm
->nm_Label
!= NM_BARLABEL
)
63 ULONG id
= (IPTR
)actnm
->nm_Label
;
64 CONST_STRPTR str
= MSG(id
);
66 if (actnm
->nm_Type
== NM_TITLE
)
68 actnm
->nm_Label
= str
;
70 actnm
->nm_Label
= str
+ 2;
71 if (str
[0] != ' ') actnm
->nm_CommKey
= str
;
73 actnm
->nm_UserData
= (APTR
)(IPTR
)id
;
75 } /* if (actnm->nm_Label != NM_BARLABEL) */
77 } /* for(actnm = nm; nm->nm_Type != NM_END; nm++) */
81 /*********************************************************************************************/
85 menus
= CreateMenusA(nm
, NULL
);
86 if (!menus
) Cleanup(MSG(MSG_CANT_CREATE_MENUS
));
88 if (!LayoutMenusA(menus
, vi
, NULL
)) Cleanup(MSG(MSG_CANT_CREATE_MENUS
));
92 /*********************************************************************************************/
96 if (win
) ClearMenuStrip(win
);
97 if (menus
) FreeMenus(menus
);
102 /*********************************************************************************************/
104 STRPTR
GetFile(BOOL open
)
106 static UBYTE pathbuffer
[300];
107 static UBYTE filebuffer
[108];
108 struct FileRequester
*req
;
109 STRPTR retval
= NULL
;
111 AslBase
= OpenLibrary("asl.library", 39);
114 filebuffer
[sizeof filebuffer
- 1] = 0;
115 pathbuffer
[sizeof pathbuffer
- 1] = 0;
117 strncpy(filebuffer
, FilePart(filenamebuffer
), sizeof filebuffer
- 1);
118 strncpy(pathbuffer
, filenamebuffer
, sizeof pathbuffer
- 1);
119 *(FilePart(pathbuffer
)) = 0;
121 req
= AllocAslRequestTags(ASL_FileRequest
, ASLFR_TitleText
, open
?
122 (IPTR
)MSG(MSG_ASL_OPEN_TITLE
) :
123 (IPTR
)MSG(MSG_ASL_SAVE_TITLE
) ,
124 ASLFR_DoSaveMode
, open
?
127 ASLFR_RejectIcons
, (IPTR
)TRUE
,
128 ASLFR_DoPatterns
, (IPTR
)TRUE
,
129 ASLFR_InitialDrawer
, (IPTR
)pathbuffer
,
130 ASLFR_InitialFile
, (IPTR
)filebuffer
,
134 if (AslRequest(req
, NULL
))
136 strncpy(filebuffer
, req
->fr_Drawer
, sizeof filebuffer
- 1);
137 AddPart(filebuffer
, req
->fr_File
, sizeof filebuffer
- 1);
141 } /* if (AslRequest(req, NULL) */
147 CloseLibrary(AslBase
);
154 /*********************************************************************************************/
158 struct EasyStruct es
;
160 es
.es_StructSize
= sizeof(es
);
162 es
.es_Title
= MSG(MSG_ABOUT_TITLE
);
163 es
.es_TextFormat
= MSG(MSG_ABOUT
);
164 es
.es_GadgetFormat
= MSG(MSG_CONTINUE
);
166 EasyRequest(win
, &es
, NULL
, (IPTR
)VERSION
,
170 (IPTR
)"AROS Development Team");
174 /*********************************************************************************************/