1 /***************************************************************************
3 openurl.library - universal URL display and browser launcher library
4 Copyright (C) 1998-2005 by Troels Walsted Hansen, et al.
5 Copyright (C) 2005-2013 by openurl.library Open Source Team
7 This library is free software; it has been placed in the public domain
8 and you can freely redistribute it and/or modify it. Please note, however,
9 that some components may be under the LGPL or GPL license.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 openurl.library project: http://sourceforge.net/projects/openurllib/
19 ***************************************************************************/
23 #include "SDI_stdarg.h"
28 /**************************************************************************/
30 #define _KEY(k) ((ULONG)(k)) ? MUIA_ControlChar : TAG_IGNORE, ((ULONG)(k)) ? (ULONG)getKeyChar(NULL,(ULONG)(k)) : 0
31 #define _HELP(h) ((ULONG)(h)) ? MUIA_ShortHelp : TAG_IGNORE, ((ULONG)(h)) ? (IPTR)getString((ULONG)(h)) : 0
33 /***********************************************************************/
36 // Calls parent NEW method within a subclass
37 #if !defined(__MORPHOS__)
38 #if !defined(__AROS__)
39 Object
* VARARGS68K
DoSuperNew(struct IClass
*cl
, Object
*obj
, ...)
47 rc
= (Object
*)DoSuperMethod(cl
, obj
, OM_NEW
, VA_ARG(args
, ULONG
), NULL
);
56 /**************************************************************************/
59 /**********************************************************
61 ** The following function saves the variable name passed in
62 ** 'varname' to the ENV(ARC) system so that the application
63 ** can become AmiUpdate aware.
65 **********************************************************/
66 void SetAmiUpdateENVVariable( CONST_STRPTR varname
)
68 /* AmiUpdate support code */
72 /* obtain the lock to the home directory */
73 if(( lock
= GetProgramDir() ))
76 TEXT varpath
[1024] = "AppPaths";
79 get a unique name for the lock,
80 this call uses device names,
81 as there can be multiple volumes
82 with the same name on the system
85 if( DevNameFromLock( lock
, progpath
, sizeof(progpath
), DN_FULLPATH
))
87 /* stop any "Insert volume..." type requesters */
88 oldwin
= SetProcWindow((APTR
)-1);
91 finally set the variable to the
92 path the executable was run from
93 don't forget to supply the variable
94 name to suit your application
97 AddPart( varpath
, varname
, 1024);
98 SetVar( varpath
, progpath
, -1, GVF_GLOBAL_ONLY
|GVF_SAVE_VAR
);
100 /* turn requesters back on */
101 SetProcWindow( oldwin
);
106 #endif /* __amigaos4__ */
108 /**************************************************************************/
110 Object
*olabel(ULONG id
)
112 return Label((IPTR
)getString(id
));
115 /****************************************************************************/
117 Object
*ollabel(ULONG id
)
119 return LLabel((IPTR
)getString(id
));
122 /****************************************************************************/
124 Object
*ollabel1(ULONG id
)
126 return LLabel1((IPTR
)getString(id
));
129 /****************************************************************************/
131 Object
*olabel1(ULONG id
)
133 return Label1((IPTR
)getString(id
));
136 /***********************************************************************/
138 Object
*olabel2(ULONG id
)
140 return Label2((IPTR
)getString(id
));
143 /****************************************************************************/
145 Object
*oflabel(ULONG text
)
147 return FreeLabel((IPTR
)getString(text
));
150 /****************************************************************************/
152 Object
*obutton(ULONG text
, ULONG help
)
156 if((obj
= MUI_MakeObject(MUIO_Button
, (IPTR
)getString(text
))) != NULL
)
157 SetAttrs(obj
,MUIA_CycleChain
,TRUE
,_HELP(help
),TAG_DONE
);
162 /***********************************************************************/
164 Object
*oibutton(ULONG spec
, ULONG help
)
166 if (spec
==IBT_Up
) spec
= (IPTR
)"\33I[6:38]";
167 else if (spec
==IBT_Down
) spec
= (IPTR
)"\33I[6:39]";
172 MUIA_CycleChain
, TRUE
,
173 MUIA_Font
, MUIV_Font_Button
,
174 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
176 MUIA_Background
, MUII_ButtonBack
,
177 MUIA_Text_Contents
, spec
,
178 MUIA_Text_PreParse
, MUIX_C
,
179 MUIA_Text_SetMax
, TRUE
,
183 /****************************************************************************/
185 Object
*otbutton(ULONG label
, ULONG help
)
190 MUIA_CycleChain
, TRUE
,
191 MUIA_Font
, MUIV_Font_Button
,
192 MUIA_InputMode
, MUIV_InputMode_Toggle
,
194 MUIA_Background
, MUII_ButtonBack
,
195 MUIA_Text_Contents
, getString(label
),
196 MUIA_Text_PreParse
, MUIX_C
,
197 MUIA_Text_HiCharIdx
, '_',
201 /****************************************************************************/
203 Object
*ocheckmark(ULONG key
, ULONG help
)
207 if((obj
= MUI_MakeObject(MUIO_Checkmark
, (IPTR
)getString(key
))) != NULL
)
208 SetAttrs(obj
,MUIA_CycleChain
,TRUE
,_HELP(help
),TAG_DONE
);
213 /****************************************************************************/
215 Object
*opopbutton(ULONG img
, ULONG help
)
219 if((obj
= MUI_MakeObject(MUIO_PopButton
, img
)) != NULL
)
220 SetAttrs(obj
,MUIA_CycleChain
,TRUE
,_HELP(help
),TAG_DONE
);
225 /****************************************************************************/
227 Object
*ostring(ULONG maxlen
, ULONG key
, ULONG help
)
232 MUIA_CycleChain
, TRUE
,
234 MUIA_String_AdvanceOnCR
, TRUE
,
235 MUIA_String_MaxLen
, maxlen
,
239 /***********************************************************************/
241 Object
*opopport(ULONG maxLen
, ULONG key
, ULONG help
)
243 return popportObject
,
245 MUIA_Popport_Key
, key
,
246 MUIA_Popport_Len
, maxLen
,
250 /***********************************************************************/
252 Object
*opopph(CONST_STRPTR
*syms
, STRPTR
*names
, ULONG maxLen
, ULONG key
, ULONG asl
, ULONG help
)
256 MUIA_Popph_Syms
, syms
,
257 MUIA_Popph_Names
, names
,
258 MUIA_Popph_MaxLen
, maxLen
,
264 /***********************************************************************/
266 ULONG
openWindow(Object
*app
, Object
*win
)
272 set(win
,MUIA_Window_Open
,TRUE
);
273 v
= xget(win
, MUIA_Window_Open
);
275 v
= xget(app
, MUIA_Application_Iconified
);
279 if (!v
) DisplayBeep(0);
284 /***********************************************************************/
286 IPTR
delEntry(Object
*obj
, APTR entry
)
293 DoMethod(obj
,MUIM_List_GetEntry
,i
,(IPTR
)&e
);
294 if (!e
|| e
==entry
) break;
297 if (e
) DoMethod(obj
,MUIM_List_Remove
,i
);
302 /**************************************************************************/