Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / openurl / prefs / about.c
blob29614568de3ffca66aca3d87389cd7653487f258
1 /*
2 ** OpenURL - MUI preferences for openurl.library
3 **
4 ** Written by Troels Walsted Hansen <troels@thule.no>
5 ** Placed in the public domain.
6 **
7 ** Developed by:
8 ** - Alfonso Ranieri <alforan@tin.it>
9 ** - Stefan Kost <ensonic@sonicpulse.de>
11 ** Ported to OS4 by Alexandre Balaban <alexandre@balaban.name>
13 ** About window
17 #include "OpenURL.h"
19 #define CATCOMP_NUMBERS
20 #include "loc.h"
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
32 #endif
34 #ifndef MUIA_Window_ShowSnapshot
35 #define MUIA_Window_ShowSnapshot 0x80423c55
36 #endif
38 #ifndef MUIA_Window_ShowPrefs
39 #define MUIA_Window_ShowPrefs 0x8042e262
40 #endif
42 #ifndef MUIA_Window_ShowIconify
43 #define MUIA_Window_ShowIconify 0x8042bc26
44 #endif
46 #ifndef MUIA_Window_ShowAbout
47 #define MUIA_Window_ShowAbout 0x80429c1e
48 #endif
50 #ifndef MUIA_Window_ShowJump
51 #define MUIA_Window_ShowJump 0x80422f40
52 #endif
54 #ifndef MUIA_Window_Frontdrop
55 #define MUIA_Window_Frontdrop 0x80426411
56 #endif
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
74 static Object *
75 ourltext(STRPTR url,STRPTR text)
77 Object *o = NULL;
79 #ifndef __AROS__
80 // FIXME: Port UrltextMCC to AROS
81 o = UrltextObject,
82 MUIA_Urltext_Text, text,
83 MUIA_Urltext_Url, url,
84 MUIA_Urltext_SetMax, FALSE,
85 MUIA_Urltext_NoOpenURLPrefs, TRUE,
86 End;
87 #endif
89 if (!o) o = TextObject, MUIA_Text_SetMax, FALSE, MUIA_Text_Contents, text ? text : url, End;
91 return o;
94 /***********************************************************************/
96 ** Create a miny tiny About MUI button
99 static Object *
100 othirdMUI(Object **mui)
102 return HGroup,
103 MUIA_Group_HorizSpacing, 0,
104 Child, ohfixspace,
105 Child, otextitem,
106 Child, ohfixspace,
107 Child, *mui = TextObject,
108 ButtonFrame,
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,
118 End,
119 Child, ollabel(MSG_About_OfCourse),
120 Child, HSpace(0),
121 End;
124 /***********************************************************************/
126 ** Third object
129 static Object *
130 othird(ULONG stuff,STRPTR author,STRPTR url)
132 Object *g, *o[8];
134 if (g = HGroup,
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),
142 End)
144 Object *u;
146 if (author && *author)
147 if (url && *url) u = ourltext(url,author);
148 else u = LLabel((ULONG)author);
149 else u = NULL;
151 if (u)
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);
159 return g;
162 /***********************************************************************/
164 ** Here we go
167 static ULONG
168 mNew(struct IClass *cl,Object *obj,struct opSet *msg)
170 Object *g, *o[8], *mui, *ok;
171 struct TagItem *attrs = msg->ops_AttrList;
172 STRPTR lver;
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,
191 Child, TextObject,
192 MUIA_Font, MUIV_Font_Big,
193 MUIA_Text_Contents, PRG,
194 MUIA_Text_PreParse, MUIX_B MUIX_C,
195 End,
197 Child, TextObject,
198 MUIA_Text_Contents, getString(MSG_About_Descr),
199 MUIA_Text_PreParse, MUIX_C,
200 End,
202 Child, ovfixspace,
203 //Child, VSpace(0),
205 Child, MUI_MakeObject(MUIO_BarTitle,(ULONG)getString(MSG_About_Info)),
207 Child, HGroup,
208 Child, HSpace(0),
209 Child, ColGroup(2),
211 /* Authors */
212 Child, VGroup,
213 Child, HGroup, Child, HSpace(0), Child, olabel(MSG_About_Authors), End,
214 Child, VSpace(0),
215 End,
216 Child, VGroup,
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,
221 End,
223 /* Support */
224 Child, olabel(MSG_About_Support),
225 Child, ourltext("https://sourceforge.net/projects/openurllib",NULL),
227 /* Version */
228 Child, VGroup,
229 Child, HGroup, Child, HSpace(0), Child, olabel(MSG_About_Version), End,
230 Child, VSpace(0),
231 End,
232 Child, VGroup,
233 Child, HGroup,
234 Child, LLabel((ULONG)PRGNAME),
235 Child, HSpace(0),
236 End,
237 Child, HGroup,
238 Child, LLabel((ULONG)lver),
239 Child, HSpace(0),
240 End,
241 End,
242 End,
243 Child, HSpace(0),
244 End,
246 Child, ovfixspace,
247 //Child, VSpace(0),
249 Child, MUI_MakeObject(MUIO_BarTitle,(ULONG)getString(MSG_About_ThirdParts)),
251 Child, g = VGroup,
252 Child, o[0] = othirdMUI(&mui),
253 End,
255 Child, ovfixspace,
256 //Child, VSpace(0),
257 Child, hbar,
259 Child, HGroup,
260 Child, wspace(200),
261 Child, ok = obutton(MSG_About_OK,0),
262 Child, wspace(200),
263 End,
264 End,
266 TAG_MORE,attrs))
268 Object *win, *space;
269 STRPTR tn;
272 ** If there are the translator stuff
274 if ((tn = getString(MSG_About_Translation)) && *tn)
276 Object *to;
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);
295 return (ULONG)obj;
298 /***********************************************************************/
300 M_DISP(dispatcher)
302 M_DISPSTART
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 /***********************************************************************/
315 ULONG
316 initAboutClass(void)
318 return (ULONG)(g_aboutClass = MUI_CreateCustomClass(NULL,MUIC_Window,NULL,0,DISP(dispatcher)));
321 /***********************************************************************/
323 void
324 disposeAboutClass(void)
326 if (g_aboutClass) MUI_DeleteCustomClass(g_aboutClass);
329 /***********************************************************************/