2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
9 /*********************************************************************************************/
16 /*********************************************************************************************/
18 static struct NewMenu nm
[] =
20 {NM_TITLE
, (STRPTR
)MSG_MEN_PROJECT
},
21 {NM_ITEM
, (STRPTR
)MSG_MEN_PROJECT_OPEN
},
22 {NM_ITEM
, (STRPTR
)MSG_MEN_PROJECT_SAVEAS
},
23 {NM_ITEM
, NM_BARLABEL
},
24 {NM_ITEM
, (STRPTR
)MSG_MEN_PROJECT_QUIT
},
25 {NM_TITLE
, (STRPTR
)MSG_MEN_EDIT
},
26 {NM_ITEM
, (STRPTR
)MSG_MEN_EDIT_DEFAULT
},
27 {NM_ITEM
, (STRPTR
)MSG_MEN_EDIT_LASTSAVED
},
28 {NM_ITEM
, (STRPTR
)MSG_MEN_EDIT_RESTORE
},
29 {NM_TITLE
, (STRPTR
)MSG_MEN_SETTINGS
},
30 {NM_ITEM
, (STRPTR
)MSG_MEN_SETTINGS_CREATEICONS
, NULL
, CHECKIT
| MENUTOGGLE
},
34 /*********************************************************************************************/
38 struct NewMenu
*actnm
= nm
;
40 for(actnm
= nm
; actnm
->nm_Type
!= NM_END
; actnm
++)
42 if (actnm
->nm_Label
!= NM_BARLABEL
)
44 ULONG id
= (ULONG
)actnm
->nm_Label
;
45 CONST_STRPTR str
= MSG(id
);
47 if (actnm
->nm_Type
== NM_TITLE
)
49 actnm
->nm_Label
= str
;
51 actnm
->nm_Label
= str
+ 2;
52 if (str
[0] != ' ') actnm
->nm_CommKey
= str
;
54 actnm
->nm_UserData
= (APTR
)id
;
56 } /* if (actnm->nm_Label != NM_BARLABEL) */
58 } /* for(actnm = nm; nm->nm_Type != NM_END; nm++) */
62 /*********************************************************************************************/
66 struct TagItem menu_tags
[] =
68 {GTMN_NewLookMenus
, TRUE
},
72 menus
= CreateMenusA(nm
, NULL
);
73 if (!menus
) Cleanup(MSG(MSG_CANT_CREATE_MENUS
));
75 if (!LayoutMenusA(menus
, vi
, menu_tags
)) Cleanup(MSG(MSG_CANT_CREATE_MENUS
));
79 /*********************************************************************************************/
83 if (win
) ClearMenuStrip(win
);
84 if (menus
) FreeMenus(menus
);
89 /*********************************************************************************************/
91 void SetMenuFlags(void)
93 if (win
) ClearMenuStrip(win
);
94 if (win
) ResetMenuStrip(win
, menus
);
97 /*********************************************************************************************/
99 STRPTR
GetFile(CONST_STRPTR title
, CONST_STRPTR dir
, BOOL savemode
)
101 static UBYTE filebuffer
[300];
102 struct FileRequester
*req
;
103 STRPTR retval
= NULL
;
105 AslBase
= OpenLibrary("asl.library", 39);
108 req
= AllocAslRequestTags(ASL_FileRequest
, ASLFR_TitleText
, (IPTR
)title
,
109 ASLFR_DoPatterns
, TRUE
,
110 ASLFR_InitialDrawer
, (IPTR
)dir
,
111 ASLFR_DoSaveMode
, savemode
,
115 if (AslRequest(req
, NULL
))
117 strncpy(filebuffer
, req
->fr_Drawer
, 299);
118 AddPart(filebuffer
, req
->fr_File
, 299);
122 } /* if (AslRequest(req, NULL) */
128 CloseLibrary(AslBase
);
135 /*********************************************************************************************/
137 struct Node
*FindListNode(struct List
*list
, WORD which
)
139 struct Node
*node
= NULL
;
143 for(node
= list
->lh_Head
; node
->ln_Succ
&& which
; node
= node
->ln_Succ
, which
--)
146 if (!node
->ln_Succ
) node
= NULL
;
152 /*********************************************************************************************/
154 void SortInNode(struct List
*list
, struct Node
*node
)
156 struct Node
*sort
, *prev
= NULL
;
158 ForeachNode(list
, sort
)
160 if (Stricmp(node
->ln_Name
, sort
->ln_Name
) < 0) break;
164 Insert(list
, node
, prev
);
167 /*********************************************************************************************/