Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / prefs / Zune / zunestuff.c
bloba1f9c31f1fb47974ac9a060aab54eebd27c5b3d3
1 /*
2 Copyright 2002-2006, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/exec.h>
7 #include <proto/dos.h>
8 #include <string.h>
10 #include <libraries/mui.h>
12 #include <proto/intuition.h>
13 #include <proto/muimaster.h>
14 #include <proto/asl.h>
16 #include "zunestuff.h"
19 /****************************************************************
20 aslfilerequest for load/save - buffer overflow safe
21 *****************************************************************/
22 long aslfilerequest(char *msg,char *dirpart,char *filepart,char *fullname, struct TagItem *tags)
25 /* msg=a name to show
26 tags=can be 0 or some additional tags
27 dirpart= a pointer to a buffer of 500 bytes that recieve the selected directory
28 filepart= a pointer to a buffer of 500 bytes that recieve the selected filename
29 fullname= a pointer to a buffer of 1000 bytes that recieve the selected full filename */
31 struct FileRequester *fr;
32 struct Library *AslBase;
33 AslBase = OpenLibrary("asl.library", 37L);
35 if (AslBase)
37 struct TagItem frtags[] =
40 { ASLFR_TitleText, (IPTR)msg },
41 { ASLFR_InitialDrawer, (IPTR)dirpart},
42 { ASLFR_InitialFile, (IPTR)filepart},
43 { TAG_MORE, (IPTR)tags }
45 };
48 if ( (int)(fr = (struct FileRequester *) AllocAslRequest(ASL_FileRequest, frtags) ) )
50 if (AslRequest(fr, NULL))
52 strncpy(dirpart,fr->fr_Drawer,498);
53 strncpy(filepart,fr->fr_File,498);
54 strncpy(fullname,dirpart,498);
55 AddPart(fullname,filepart,998);
56 FreeAslRequest(fr);
57 CloseLibrary(AslBase);
59 return 1;
62 if (AslBase) CloseLibrary(AslBase);
64 return 0;
70 return 0;
74 /****************************************************************
75 Create a button (within the cycle chain)
76 *****************************************************************/
77 Object *MakeButton(CONST_STRPTR str)
79 Object *obj = MUI_MakeObject(MUIO_Button, (IPTR)str);
80 if (obj)
82 SetAttrs(obj,
83 MUIA_CycleChain, 1,
84 TAG_DONE);
86 return obj;
89 Object *MakeSpacingSlider (void)
91 Object *obj = MUI_MakeObject(MUIO_Slider, (IPTR)"", 0, 9);
92 if (obj)
93 set(obj, MUIA_CycleChain, 1);
94 return obj;
97 Object *MakeCycle (CONST_STRPTR label, CONST_STRPTR entries[])
99 Object *obj = MUI_MakeObject(MUIO_Cycle, (IPTR)label, (IPTR)entries);
100 if (obj)
101 set(obj, MUIA_CycleChain, 1);
102 return obj;
105 Object *MakeCheck (CONST_STRPTR label)
107 Object *obj = MUI_MakeObject(MUIO_Checkmark, (IPTR)label);
108 if (obj)
109 set(obj, MUIA_CycleChain, 1);
110 return obj;
113 Object *MakeBackgroundPopimage(void)
115 return MUI_NewObject(MUIC_Popimage,
116 MUIA_Imageadjust_Type, MUIV_Imageadjust_Type_Background,
117 MUIA_CycleChain, 1,
118 MUIA_Window_Title, (IPTR) _(MSG_ADJUST_BACKGROUND),
119 TAG_DONE);
122 Object *MakePopframe(void)
124 return MUI_NewObject(MUIC_Popframe,
125 MUIA_CycleChain, 1,
126 MUIA_Window_Title, (IPTR) _(MSG_ADJUST_FRAME),
127 TAG_DONE);
130 Object *MakePoppen(void)
132 return MUI_NewObject(MUIC_Poppen,
133 MUIA_CycleChain, 1,
134 MUIA_Window_Title, (IPTR) _(MSG_ADJUST_PEN),
135 TAG_DONE);
138 Object *MakeString(void)
140 return StringObject,
141 StringFrame,
142 MUIA_CycleChain, 1,
143 End;
146 Object *MakePopfont(BOOL fixed)
148 return PopaslObject,
149 MUIA_Popasl_Type, ASL_FontRequest,
150 ASLFO_MaxHeight, 100,
151 ASLFO_FixedWidthOnly, fixed ? TRUE : FALSE,
152 MUIA_Popstring_String, (IPTR) MakeString(),
153 MUIA_Popstring_Button, (IPTR) PopButton(MUII_PopUp),
154 End;
157 Object *MakePopfile(BOOL fixed, CONST_STRPTR pattern)
159 return PopaslObject,
160 ASLFR_InitialPattern, (IPTR) pattern,
161 ASLFR_RejectIcons, TRUE,
162 ASLFO_MaxHeight, 100,
163 ASLFO_FixedWidthOnly, fixed ? TRUE : FALSE,
164 MUIA_Popstring_String, (IPTR) MakeString(),
165 MUIA_Popstring_Button, (IPTR) PopButton(MUII_PopFile),
166 End;
169 void SliderToConfig (Object *slider, Object *configdata, ULONG cfg)
171 DoMethod(configdata, MUIM_Configdata_SetULong, cfg,
172 XGET(slider, MUIA_Numeric_Value));
175 void CheckmarkToConfig (Object *checkmark, Object *configdata, ULONG cfg)
177 DoMethod(configdata, MUIM_Configdata_SetULong, cfg,
178 XGET(checkmark, MUIA_Selected));
181 void FrameToConfig (Object *popframe, Object *configdata, ULONG cfg)
183 CONST_STRPTR str;
185 str = (CONST_STRPTR)XGET(popframe, MUIA_Framedisplay_Spec);
186 DoMethod(configdata, MUIM_Configdata_SetFramespec, cfg, (IPTR)str);
189 void PenToConfig (Object *poppen, Object *configdata, ULONG cfg)
191 CONST_STRPTR str;
193 str = (CONST_STRPTR)XGET(poppen, MUIA_Pendisplay_Spec);
194 DoMethod(configdata, MUIM_Configdata_SetPenspec, cfg, (IPTR)str);
197 void StringToConfig (Object *string, Object *configdata, ULONG cfg)
199 CONST_STRPTR str;
201 str = (CONST_STRPTR)XGET(string, MUIA_String_Contents);
202 DoMethod(configdata, MUIM_Configdata_SetString, cfg, (IPTR)str);
205 void CycleToConfig (Object *cycle, Object *configdata, ULONG cfg)
207 DoMethod(configdata, MUIM_Configdata_SetULong, cfg,
208 XGET(cycle, MUIA_Cycle_Active));
211 void ConfigToSlider (Object *configdata, ULONG cfg, Object *slider)
213 setslider(slider, DoMethod(configdata, MUIM_Configdata_GetULong, cfg));
216 void ConfigToCheckmark (Object *configdata, ULONG cfg, Object *checkmark)
218 setcheckmark(checkmark, DoMethod(configdata, MUIM_Configdata_GetULong, cfg));
221 void ConfigToFrame (Object *configdata, ULONG cfg, Object *popframe)
223 CONST_STRPTR spec;
225 spec = (CONST_STRPTR)DoMethod(configdata, MUIM_Configdata_GetString, cfg);
226 set(popframe, MUIA_Framedisplay_Spec, (IPTR)spec);
229 void ConfigToPen (Object *configdata, ULONG cfg, Object *poppen)
231 STRPTR spec;
233 spec = (STRPTR)DoMethod(configdata, MUIM_Configdata_GetString, cfg);
234 set(poppen, MUIA_Pendisplay_Spec, (IPTR)spec);
237 void ConfigToCycle (Object *configdata, ULONG cfg, Object *cycle)
239 setcycle(cycle, DoMethod(configdata, MUIM_Configdata_GetULong, cfg));
242 void ConfigToString (Object *configdata, ULONG cfg, Object *string)
244 setstring(string, DoMethod(configdata, MUIM_Configdata_GetString, cfg));
247 #ifdef __amigaos4__
248 Object *VARARGS68K DoSuperNewTags(struct IClass *cl, Object *obj, void *dummy, ...)
250 va_list argptr;
251 struct TagItem *tagList;
252 va_startlinear(argptr, dummy);
253 tagList = va_getlinearva(argptr, struct TagItem *);
254 obj = (Object*)DoSuperMethod(cl,obj,OM_NEW,tagList,dummy);
255 va_end(argptr);
256 return obj;
258 #endif