2 Copyright 2002-2006, The AROS Development Team. All rights reserved.
6 #include <proto/exec.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
)
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);
37 struct TagItem frtags
[] =
40 { ASLFR_TitleText
, (IPTR
)msg
},
41 { ASLFR_InitialDrawer
, (IPTR
)dirpart
},
42 { ASLFR_InitialFile
, (IPTR
)filepart
},
43 { TAG_MORE
, (IPTR
)tags
}
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);
57 CloseLibrary(AslBase
);
62 if (AslBase
) CloseLibrary(AslBase
);
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
);
89 Object
*MakeSpacingSlider (void)
91 Object
*obj
= MUI_MakeObject(MUIO_Slider
, (IPTR
)"", 0, 9);
93 set(obj
, MUIA_CycleChain
, 1);
97 Object
*MakeCycle (CONST_STRPTR label
, CONST_STRPTR entries
[])
99 Object
*obj
= MUI_MakeObject(MUIO_Cycle
, (IPTR
)label
, (IPTR
)entries
);
101 set(obj
, MUIA_CycleChain
, 1);
105 Object
*MakeCheck (CONST_STRPTR label
)
107 Object
*obj
= MUI_MakeObject(MUIO_Checkmark
, (IPTR
)label
);
109 set(obj
, MUIA_CycleChain
, 1);
113 Object
*MakeBackgroundPopimage(void)
115 return MUI_NewObject(MUIC_Popimage
,
116 MUIA_Imageadjust_Type
, MUIV_Imageadjust_Type_Background
,
118 MUIA_Window_Title
, (IPTR
) _(MSG_ADJUST_BACKGROUND
),
122 Object
*MakePopframe(void)
124 return MUI_NewObject(MUIC_Popframe
,
126 MUIA_Window_Title
, (IPTR
) _(MSG_ADJUST_FRAME
),
130 Object
*MakePoppen(void)
132 return MUI_NewObject(MUIC_Poppen
,
134 MUIA_Window_Title
, (IPTR
) _(MSG_ADJUST_PEN
),
138 Object
*MakeString(void)
146 Object
*MakePopfont(BOOL fixed
)
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
),
157 Object
*MakePopfile(BOOL fixed
, CONST_STRPTR pattern
)
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
),
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
)
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
)
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
)
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
)
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
)
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
));
248 Object
*VARARGS68K
DoSuperNewTags(struct IClass
*cl
, Object
*obj
, void *dummy
, ...)
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
);