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 ***************************************************************************/
24 #include <clib/alib_protos.h>
26 #ifndef NO_INLINE_STDARG
27 #define NO_INLINE_STDARG
30 #include <proto/exec.h>
31 #include <proto/dos.h>
33 #include <proto/muimaster.h>
34 #include <proto/intuition.h>
35 #include <proto/graphics.h>
36 #include <proto/utility.h>
37 #include <proto/icon.h>
38 #include <proto/locale.h>
39 #include <proto/openurl.h>
41 #include <workbench/startup.h>
43 #include <libraries/asl.h>
44 #include <libraries/gadtools.h>
45 #include <libraries/iffparse.h>
47 #if !defined(__AROS__)
48 #include <clib/debug_protos.h>
51 #include <mui/textinput_mcc.h>
52 #include <mui/Urltext_mcc.h>
57 #include "SDI_compiler.h"
59 /**************************************************************************/
64 extern struct ExecBase
*SysBase
;
65 extern struct DosLibrary
*DOSBase
;
66 extern struct IntuitionBase
*IntuitionBase
;
67 extern struct GfxBase
*GfxBase
;
68 extern struct Library
*MUIMasterBase
;
69 extern struct Library
*UtilityBase
;
70 extern struct Library
*IconBase
;
71 #if !defined(__MORPHOS__)
72 extern struct LocaleBase
*LocaleBase
;
74 extern struct Library
*LocaleBase
;
76 extern struct Library
*OpenURLBase
;
78 extern struct MUI_CustomClass
*g_appClass
;
79 extern struct MUI_CustomClass
*g_pensClass
;
80 extern struct MUI_CustomClass
*g_aboutClass
;
81 extern struct MUI_CustomClass
*g_winClass
;
82 extern struct MUI_CustomClass
*g_appListClass
;
83 extern struct MUI_CustomClass
*g_browserEditWinClass
;
84 extern struct MUI_CustomClass
*g_mailerEditWinClass
;
85 extern struct MUI_CustomClass
*g_FTPEditWinClass
;
86 extern struct MUI_CustomClass
*g_popportClass
;
87 extern struct MUI_CustomClass
*g_popphClass
;
89 extern struct Catalog
*g_cat
;
93 /**************************************************************************/
97 #define THIS_PREFS_VERSION ((UBYTE)4)
99 #define APPBASENAME "OPENURL"
100 #define APPAUTHOR "openurl.library Open Source Team"
101 #define APPHELP "OpenURL.guide"
103 /**************************************************************************/
105 ** Identify a generic URL_#? node
114 /**************************************************************************/
119 #define TAG_MUI_TWH (0x81480000UL+100)
121 #define TAGBASE_APP (TAG_MUI_TWH+0)
122 #define TAGBASE_ABOUT (TAG_MUI_TWH+20)
123 #define TAGBASE_PENS (TAG_MUI_TWH+40)
124 #define TAGBASE_WIN (TAG_MUI_TWH+60)
125 #define TAGBASE_APPLIST (TAG_MUI_TWH+80)
126 #define TAGBASE_BROWSEREDITWIN (TAG_MUI_TWH+100)
127 #define TAGBASE_MAILEREDITWIN (TAG_MUI_TWH+120)
128 #define TAGBASE_FTPEDITWIN (TAG_MUI_TWH+140)
129 #define TAGBASE_POPPORT (TAG_MUI_TWH+160)
130 #define TAGBASE_LAMP (TAG_MUI_TWH+180)
131 #define TAGBASE_POPPH (TAG_MUI_TWH+200)
133 /**************************************************************************/
138 #define appObject NewObject(g_appClass->mcc_Class,NULL
141 #define MUIM_App_OpenWin (TAGBASE_APP+0)
142 #define MUIM_App_GetPrefs (TAGBASE_APP+1)
143 #define MUIM_App_About (TAGBASE_APP+2)
144 #define MUIM_App_DisposeWin (TAGBASE_APP+4)
145 #define MUIM_App_CloseWin (TAGBASE_APP+3)
146 #define MUIM_App_CheckSave (TAGBASE_APP+4)
150 struct MUIP_App_OpenWin
152 STACKED ULONG MethodID
;
153 STACKED
struct IClass
*Class
;
154 STACKED ULONG IDAttr
;
156 STACKED ULONG InitAttrs
;
159 struct MUIP_App_GetPrefs
161 STACKED ULONG MethodID
;
168 MUIV_App_GetPrefs_InUse
,
169 MUIV_App_GetPrefs_LastSaveds
,
170 MUIV_App_GetPrefs_Restore
,
171 MUIV_App_GetPrefs_Defaults
,
174 struct MUIP_App_DisposeWin
176 STACKED ULONG MethodID
;
180 struct MUIP_App_CloseWin
182 STACKED ULONG MethodID
;
183 STACKED ULONG IDAttr
;
188 #define MUIA_App_IsSubWin (TAGBASE_APP+0)
189 #define MUIA_App_Pens (TAGBASE_APP+1)
191 /**************************************************************************/
196 #define aboutObject NewObject(g_aboutClass->mcc_Class,NULL
198 /**************************************************************************/
203 #define winObject NewObject(g_winClass->mcc_Class,NULL
206 #define MUIM_Win_GetPrefs (TAGBASE_WIN+0)
207 #define MUIM_Win_StorePrefs (TAGBASE_WIN+1)
208 #define MUIM_Win_Delete (TAGBASE_WIN+2)
212 struct MUIP_Win_GetPrefs
214 STACKED ULONG MethodID
;
221 MUIV_Win_GetPrefs_InUse
,
222 MUIV_Win_GetPrefs_LastSaveds
,
223 MUIV_Win_GetPrefs_Restore
,
224 MUIV_Win_GetPrefs_Defaults
,
227 struct MUIP_Win_StorePrefs
229 STACKED ULONG MethodID
;
236 MUIV_Win_StorePrefs_Save
,
237 MUIV_Win_StorePrefs_Use
,
238 MUIV_Win_StorePrefs_Apply
,
241 struct MUIP_Win_Delete
243 STACKED ULONG MethodID
;
247 /**************************************************************************/
252 #define appListObject NewObject(g_appListClass->mcc_Class,NULL
255 #define MUIM_AppList_Add (TAGBASE_APPLIST+0)
256 #define MUIM_AppList_Edit (TAGBASE_APPLIST+1)
257 #define MUIM_AppList_Clone (TAGBASE_APPLIST+2)
258 #define MUIM_AppList_Delete (TAGBASE_APPLIST+3)
259 #define MUIM_AppList_ActiveChanged (TAGBASE_APPLIST+4)
260 #define MUIM_AppList_Disable (TAGBASE_APPLIST+5)
261 #define MUIM_AppList_Move (TAGBASE_APPLIST+6)
263 struct MUIP_AppList_Edit
265 STACKED ULONG MethodID
;
269 struct MUIP_AppList_Disable
271 STACKED ULONG MethodID
;
272 STACKED ULONG disable
;
275 struct MUIP_AppList_Move
277 STACKED ULONG MethodID
;
282 #define MUIA_AppList_Type (TAGBASE_APPLIST+0)
283 #define MUIA_AppList_ListObj (TAGBASE_APPLIST+1)
284 #define MUIA_AppList_NodeNameOffset (TAGBASE_APPLIST+2)
285 #define MUIA_AppList_NodePathOffset (TAGBASE_APPLIST+3)
286 #define MUIA_AppList_NodeSize (TAGBASE_APPLIST+4)
290 MUIV_AppList_Type_Browser
,
291 MUIV_AppList_Type_Mailer
,
292 MUIV_AppList_Type_FTP
,
295 /**************************************************************************/
297 ** BrowserEditWin class
300 #define browserEditWinObject NewObject(g_browserEditWinClass->mcc_Class,NULL
303 #define MUIM_BrowserEditWin_Use (TAGBASE_BROWSEREDITWIN+0)
306 #define MUIA_BrowserEditWin_Browser (TAGBASE_BROWSEREDITWIN+0)
307 #define MUIA_BrowserEditWin_ListObj (TAGBASE_BROWSEREDITWIN+1)
309 /**************************************************************************/
311 ** MailerEditWin class
314 #define mailerEditWinObject NewObject(g_mailerEditWinClass->mcc_Class,NULL
317 #define MUIM_MailerEditWin_Use (TAGBASE_MAILEREDITWIN+0)
320 #define MUIA_MailerEditWin_Mailer (TAGBASE_MAILEREDITWIN+0)
321 #define MUIA_MailerEditWin_ListObj (TAGBASE_MAILEREDITWIN+1)
323 /**************************************************************************/
328 #define FTPEditWinObject NewObject(g_FTPEditWinClass->mcc_Class,NULL
331 #define MUIM_FTPEditWin_Use (TAGBASE_FTPEDITWIN+0)
334 #define MUIA_FTPEditWin_FTP (TAGBASE_FTPEDITWIN+0)
335 #define MUIA_FTPEditWin_ListObj (TAGBASE_FTPEDITWIN+1)
337 /**************************************************************************/
342 #define popportObject NewObject(g_popportClass->mcc_Class,NULL
345 #define MUIA_Popport_Key (TAGBASE_POPPORT+0)
346 #define MUIA_Popport_Len (TAGBASE_POPPORT+1)
348 /**************************************************************************/
354 #define MUIA_Lamp_Disabled (TAGBASE_LAMP)
356 /**************************************************************************/
361 #define popphObject NewObject(g_popphClass->mcc_Class,NULL
364 #define MUIM_Popph_RequestFile (TAGBASE_POPPH)
367 #define MUIA_Popph_Syms (TAGBASE_POPPH)
368 #define MUIA_Popph_Names (TAGBASE_POPPH+1)
369 #define MUIA_Popph_StrObj (TAGBASE_POPPH+2)
370 #define MUIA_Popph_MaxLen (TAGBASE_POPPH+3)
371 #define MUIA_Popph_Key (TAGBASE_POPPH+4)
372 #define MUIA_Popph_Asl (TAGBASE_POPPH+5)
374 /**************************************************************************/
379 #define pensObject NewObject(g_pensClass->mcc_Class,NULL
382 #define MUIM_Pens_Change (TAGBASE_PENS)
384 /**************************************************************************/
396 #ifndef MUIA_Window_AllowTopMenus
397 #define MUIA_Window_AllowTopMenus 0x8042fe69
400 #define DEF_EnabledPen "m6"
401 #define DEF_DisabledPen "m1"
402 #define DEF_DetailPen "m4"
404 /**************************************************************************/
409 #define MTITLE(t) {NM_TITLE,(STRPTR)(t),0,0,0,(APTR)(t)}
410 #define MTITEM(t) {NM_ITEM,(STRPTR)(t),0,CHECKIT|MENUTOGGLE,0,(APTR)(t)}
411 #define MITEM(t) {NM_ITEM,(STRPTR)(t),0,0,0,(APTR)(t)}
412 #define MBAR {NM_ITEM,(STRPTR)NM_BARLABEL,0,0,0,NULL}
413 #define MEND {NM_END,NULL,0,0,0,NULL}
416 /* AROS defines this in mui.h */
419 #define superset(cl,obj,attr,value) SetSuperAttrs((APTR)(cl),(Object *)(obj),(ULONG)(attr),(IPTR)(value),TAG_DONE)
420 #define supernnset(cl,obj,attr,value) SetSuperAttrs((APTR)(cl),(Object *)(obj),(ULONG)(attr),(IPTR)(value),MUIA_NoNotify,TRUE,TAG_DONE)
421 #define superget(cl,obj,attr,valPtr) DoSuperMethod((APTR)(cl),(Object *)(obj),OM_GET,(ULONG)(attr),(IPTR)(valPtr))
423 #define wspace(w) RectangleObject, MUIA_Weight, w, End
425 /***********************************************************************/
427 #ifndef MUIA_Text_HiCharIdx
428 #define MUIA_Text_HiCharIdx 0x804214f5UL
431 #ifndef MUIA_Window_AllowTopMenus
432 #define MUIA_Window_AllowTopMenus 0x8042fe69UL
435 #ifndef MUIA_Window_IconifyGadget
436 #define MUIA_Window_IconifyGadget 0x8042BC26UL
439 #ifndef MUIA_Window_MenuGadget
440 #define MUIA_Window_MenuGadget 0x8042324EUL
443 #ifndef MUIA_Window_SnapshotGadget
444 #define MUIA_Window_SnapshotGadget 0x80423C55UL
447 #ifndef MUIA_Window_ConfigGadget
448 #define MUIA_Window_ConfigGadget 0x8042E262UL
451 #ifndef MUIM_Window_Setup
452 #define MUIM_Window_Setup 0x8042c34cUL
455 #ifndef MUIA_Application_UsedClasses
456 #define MUIA_Application_UsedClasses 0x8042E9A7UL
459 /***********************************************************************/
464 #include "OpenURL_protos.h"
466 /**************************************************************************/
468 #if defined(__amigaos4__)
469 #define AllocVecShared(size, flags) AllocVecTags((size), AVT_Type, MEMF_SHARED, AVT_Lock, FALSE, ((flags)&MEMF_CLEAR) ? AVT_ClearWithValue : TAG_IGNORE, 0, TAG_DONE)
471 #define AllocVecShared(size, flags) AllocVec((size), (flags))
474 /**************************************************************************/