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 STRPTR
GetFile(CONST_STRPTR title
, CONST_STRPTR dir
, BOOL savemode
)
93 static UBYTE filebuffer
[300];
94 struct FileRequester
*req
;
97 AslBase
= OpenLibrary("asl.library", 39);
100 req
= AllocAslRequestTags(ASL_FileRequest
, ASLFR_TitleText
, (IPTR
)title
,
101 ASLFR_DoPatterns
, TRUE
,
102 ASLFR_InitialDrawer
, (IPTR
)dir
,
103 ASLFR_DoSaveMode
, savemode
,
107 if (AslRequest(req
, NULL
))
109 strncpy(filebuffer
, req
->fr_Drawer
, 299);
110 AddPart(filebuffer
, req
->fr_File
, 299);
114 } /* if (AslRequest(req, NULL) */
120 CloseLibrary(AslBase
);
127 /*********************************************************************************************/
129 struct Node
*FindListNode(struct List
*list
, WORD which
)
131 struct Node
*node
= NULL
;
135 for(node
= list
->lh_Head
; node
->ln_Succ
&& which
; node
= node
->ln_Succ
, which
--)
138 if (!node
->ln_Succ
) node
= NULL
;
144 /*********************************************************************************************/
146 void SortInNode(struct List
*list
, struct Node
*node
)
148 struct Node
*sort
, *prev
= NULL
;
151 loc
= OpenLocale(NULL
);
153 ForeachNode(list
, sort
)
156 node
->ln_Name
, sort
->ln_Name
,
157 strlen(node
->ln_Name
), SC_COLLATE2
)
165 Insert(list
, node
, prev
);
169 /*********************************************************************************************/
171 void ScrollListview(struct Gadget
*gad
, WORD delta
)
173 IPTR top
, visible
, total
;
176 GT_GetGadgetAttrs(gad
, win
, NULL
, GTLV_Top
, (IPTR
)&top
,
177 GTLV_Visible
, (IPTR
)&visible
,
178 GTLV_Total
, (IPTR
)&total
,
181 newtop
= (LONG
)top
+ delta
* 3;
183 if (newtop
+ visible
> total
)
185 newtop
= total
- visible
;
188 if (newtop
< 0) newtop
= 0;
192 GT_SetGadgetAttrs(gad
, win
, NULL
, GTLV_Top
, newtop
, TAG_DONE
);
197 /*********************************************************************************************/