2 ** OpenURL - MUI preferences for openurl.library
4 ** Written by Troels Walsted Hansen <troels@thule.no>
5 ** Placed in the public domain.
8 ** - Alfonso Ranieri <alforan@tin.it>
9 ** - Stefan Kost <ensonic@sonicpulse.de>
11 ** Ported to OS4 by Alexandre Balaban <alexandre@balaban.name>
19 #define CATCOMP_NUMBERS
22 #include "OpenURL_rev.h"
23 #include "libraries/openurl.h"
25 /***********************************************************************/
27 ** These makes the About window look nicer
30 #ifndef MUIA_Window_ShowPopup
31 #define MUIA_Window_ShowPopup 0x8042324e
34 #ifndef MUIA_Window_ShowSnapshot
35 #define MUIA_Window_ShowSnapshot 0x80423c55
38 #ifndef MUIA_Window_ShowPrefs
39 #define MUIA_Window_ShowPrefs 0x8042e262
42 #ifndef MUIA_Window_ShowIconify
43 #define MUIA_Window_ShowIconify 0x8042bc26
46 #ifndef MUIA_Window_ShowAbout
47 #define MUIA_Window_ShowAbout 0x80429c1e
50 #ifndef MUIA_Window_ShowJump
51 #define MUIA_Window_ShowJump 0x80422f40
54 #ifndef MUIA_Window_Frontdrop
55 #define MUIA_Window_Frontdrop 0x80426411
58 /***********************************************************************/
60 ** Some local MUI macro
63 #define ovfixspace RectangleObject, MUIA_FixHeightTxt, " ", End
64 #define ohfixspace RectangleObject, MUIA_FixWidthTxt, " ", End
65 #define otextitem TextObject, MUIA_Text_Contents, "-", MUIA_Text_SetMax, TRUE, End
66 #define hbar RectangleObject, MUIA_Weight, 0, MUIA_Rectangle_HBar, TRUE, End
68 /***********************************************************************/
70 ** If Urltext.mcc is present use it,
71 ** otherwise falls back to a text object
75 ourltext(STRPTR url
,STRPTR text
)
80 // FIXME: Port UrltextMCC to AROS
82 MUIA_Urltext_Text
, text
,
83 MUIA_Urltext_Url
, url
,
84 MUIA_Urltext_SetMax
, FALSE
,
85 MUIA_Urltext_NoOpenURLPrefs
, TRUE
,
89 if (!o
) o
= TextObject
, MUIA_Text_SetMax
, FALSE
, MUIA_Text_Contents
, text
? text
: url
, End
;
94 /***********************************************************************/
96 ** Create a miny tiny About MUI button
100 othirdMUI(Object
**mui
)
103 MUIA_Group_HorizSpacing
, 0,
107 Child
, *mui
= TextObject
,
109 MUIA_Background
, MUII_ButtonBack
,
110 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
111 MUIA_Font
, MUIV_Font_Button
,
112 MUIA_ControlChar
, 'm',
113 MUIA_CycleChain
, TRUE
,
114 MUIA_Text_Contents
, "_MUI",
115 MUIA_Text_PreParse
, MUIX_C
,
116 MUIA_Text_HiCharIdx
, '_',
117 MUIA_Text_SetMax
, TRUE
,
119 Child
, ollabel(MSG_About_OfCourse
),
124 /***********************************************************************/
130 othird(ULONG stuff
,STRPTR author
,STRPTR url
)
135 MUIA_Group_HorizSpacing
, 0,
136 Child
, o
[0] = ohfixspace
,
137 Child
, o
[1] = otextitem
,
138 Child
, o
[2] = ohfixspace
,
139 Child
, o
[3] = ollabel(stuff
),
140 Child
, o
[4] = ohfixspace
,
141 Child
, o
[5] = HSpace(0),
146 if (author
&& *author
)
147 if (url
&& *url
) u
= ourltext(url
,author
);
148 else u
= LLabel((ULONG
)author
);
153 DoMethod(g
,OM_ADDMEMBER
,(ULONG
)u
);
154 DoMethod(g
,MUIM_Group_Sort
,(ULONG
)o
[0],(ULONG
)o
[1],(ULONG
)o
[2],
155 (ULONG
)o
[3],(ULONG
)o
[4],(ULONG
)u
,(ULONG
)o
[5],NULL
);
162 /***********************************************************************/
168 mNew(struct IClass
*cl
,Object
*obj
,struct opSet
*msg
)
170 Object
*g
, *o
[8], *mui
, *ok
;
171 struct TagItem
*attrs
= msg
->ops_AttrList
;
174 if (!URL_GetAttr(URL_GetAttr_VerString
,(ULONG
*)(&lver
))) lver
= "";
176 if (obj
= (Object
*)DoSuperNew(cl
,obj
,
177 MUIA_HelpNode
, "WRID",
178 MUIA_Window_Title
, getString(MSG_About_WinTitle
),
179 MUIA_Window_ScreenTitle
, getString(MSG_App_ScreenTitle
),
180 MUIA_Window_ShowIconify
, FALSE
,
181 MUIA_Window_ShowPopup
, FALSE
,
182 MUIA_Window_ShowSnapshot
, FALSE
,
183 MUIA_Window_ShowPrefs
, FALSE
,
184 MUIA_Window_SizeGadget
, FALSE
,
185 MUIA_Window_CloseGadget
, FALSE
,
186 MUIA_Window_AllowTopMenus
, FALSE
,
187 MUIA_Window_ShowJump
, FALSE
,
189 WindowContents
, VGroup
,
192 MUIA_Font
, MUIV_Font_Big
,
193 MUIA_Text_Contents
, PRG
,
194 MUIA_Text_PreParse
, MUIX_B MUIX_C
,
198 MUIA_Text_Contents
, getString(MSG_About_Descr
),
199 MUIA_Text_PreParse
, MUIX_C
,
205 Child
, MUI_MakeObject(MUIO_BarTitle
,(ULONG
)getString(MSG_About_Info
)),
213 Child
, HGroup
, Child
, HSpace(0), Child
, olabel(MSG_About_Authors
), End
,
217 Child
, HGroup
, Child
, ourltext("mailto:troels@thule.no","Troels Walsted Hansen"), Child
, HSpace(0), End
,
218 Child
, HGroup
, Child
, ourltext("mailto:alforan@tin.it","Alfonso Ranieri"), Child
, HSpace(0), End
,
219 Child
, HGroup
, Child
, ourltext("mailto:ensonic@sonicpulse.de","Stefan Kost"), Child
, HSpace(0), End
,
220 Child
, HGroup
, Child
, ourltext("mailto:alexandrec@balaban.name","OS4 Port by Alexandre Balaban"), Child
, HSpace(0), End
,
224 Child
, olabel(MSG_About_Support
),
225 Child
, ourltext("https://sourceforge.net/projects/openurllib",NULL
),
229 Child
, HGroup
, Child
, HSpace(0), Child
, olabel(MSG_About_Version
), End
,
234 Child
, LLabel((ULONG
)PRGNAME
),
238 Child
, LLabel((ULONG
)lver
),
249 Child
, MUI_MakeObject(MUIO_BarTitle
,(ULONG
)getString(MSG_About_ThirdParts
)),
252 Child
, o
[0] = othirdMUI(&mui
),
261 Child
, ok
= obutton(MSG_About_OK
,0),
272 ** If there are the translator stuff
274 if ((tn
= getString(MSG_About_Translation
)) && *tn
)
278 if (to
= othird(MSG_About_Translation
,getString(MSG_About_Translator
),getString(MSG_About_TranslatorURL
)))
280 DoMethod(g
,OM_ADDMEMBER
,(ULONG
)to
);
281 DoMethod(g
,MUIM_Group_Sort
,(ULONG
)to
,(ULONG
)o
[0],NULL
);
285 if (space
= ovfixspace
) DoMethod(g
,OM_ADDMEMBER
,(ULONG
)space
);
287 set(obj
,MUIA_Window_ActiveObject
,ok
);
289 win
= (Object
*)GetTagData(MUIA_Window_RefWindow
,(ULONG
)NULL
,attrs
);
290 DoMethod(mui
,MUIM_Notify
,MUIA_Pressed
,FALSE
,MUIV_Notify_Application
,2,MUIM_Application_AboutMUI
,(ULONG
)win
);
292 DoMethod(ok
,MUIM_Notify
,MUIA_Pressed
,FALSE
,(ULONG
)obj
,3,MUIM_Set
,MUIA_Window_CloseRequest
,TRUE
);
298 /***********************************************************************/
304 switch(msg
->MethodID
)
306 case OM_NEW
: return mNew(cl
,obj
,(APTR
)msg
);
307 default: return DoSuperMethodA(cl
,obj
,msg
);
311 M_DISPEND(dispatcher
)
313 /***********************************************************************/
318 return (ULONG
)(g_aboutClass
= MUI_CreateCustomClass(NULL
,MUIC_Window
,NULL
,0,DISP(dispatcher
)));
321 /***********************************************************************/
324 disposeAboutClass(void)
326 if (g_aboutClass
) MUI_DeleteCustomClass(g_aboutClass
);
329 /***********************************************************************/