More debianization
[erwise] / Ui / UiInfo.c
1 static char *rcsid = "$Id: UiInfo.c,v 1.1 1992/03/26 18:13:50 kny Exp kny $";
2
3
4 #include "UiIncludes.h"
5
6 #define logo_width 90
7 #define logo_height 90
8 static char logo_bits[] =
9 {
10   0x00, 0x00, 0x00, 0x00, 0xd8, 0xcf, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00,
11   0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0xc0, 0x02, 0x00, 0x00, 0x00, 0x00,
12   0x00, 0x00, 0x00, 0xa0, 0x7f, 0x00, 0x2e, 0x0f, 0x00, 0x00, 0x00, 0x00,
13   0x00, 0x00, 0x00, 0xd8, 0x4f, 0x01, 0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00,
14   0x00, 0x00, 0x00, 0xe7, 0xa0, 0x80, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
15   0x00, 0x00, 0x00, 0x31, 0x00, 0xc4, 0xef, 0xff, 0x07, 0x00, 0x00, 0x00,
16   0x00, 0x00, 0xe0, 0x00, 0x00, 0x84, 0xef, 0xff, 0x0f, 0x00, 0x00, 0x00,
17   0x00, 0x00, 0x70, 0x00, 0x00, 0x0c, 0xce, 0xff, 0x3f, 0x00, 0x00, 0x00,
18   0x00, 0x00, 0x7c, 0x00, 0x00, 0x9f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
19   0x00, 0x00, 0x3e, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
20   0x00, 0x80, 0x1f, 0x00, 0x00, 0xf4, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00,
21   0x00, 0x80, 0x13, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00,
22   0x00, 0xe0, 0x09, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00,
23   0x00, 0xe0, 0x00, 0x00, 0x00, 0xfa, 0xed, 0xff, 0xff, 0x1f, 0x00, 0x00,
24   0x00, 0x38, 0x00, 0x00, 0x80, 0x3f, 0x9c, 0xff, 0xff, 0x3f, 0x00, 0x00,
25   0x00, 0x08, 0x00, 0x00, 0x80, 0x5f, 0x62, 0xff, 0xff, 0x7f, 0x00, 0x00,
26   0x00, 0x0c, 0x00, 0x00, 0x80, 0x1f, 0x40, 0xf6, 0xff, 0xff, 0x00, 0x00,
27   0x00, 0x02, 0x00, 0x00, 0x00, 0xaf, 0x36, 0xe8, 0xff, 0xff, 0x00, 0x00,
28   0x00, 0x03, 0x00, 0x00, 0x00, 0xfa, 0x0f, 0x14, 0xfd, 0xff, 0x01, 0x00,
29   0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x03, 0x00,
30   0x80, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x3f, 0x0c, 0xfc, 0xff, 0x07, 0x00,
31   0x40, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xfd, 0xff, 0xff, 0x07, 0x00,
32   0x40, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00,
33   0x20, 0x00, 0x00, 0x00, 0xf2, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x0f, 0x00,
34   0x10, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xf7, 0xef, 0x1f, 0x00,
35   0x30, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xef, 0x9f, 0x1f, 0x00,
36   0x18, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x38, 0x00,
37   0x18, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xbf, 0xff, 0x38, 0x00,
38   0x1c, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0x71, 0x00,
39   0x14, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x7f, 0xff, 0x61, 0x00,
40   0x5a, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0x61, 0x00,
41   0x02, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xc0, 0x00,
42   0x41, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7d, 0xc0, 0x00,
43   0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0x01,
44   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
45   0xfe, 0x07, 0xff, 0x81, 0x80, 0x08, 0x08, 0x02, 0xff, 0xc1, 0xff, 0x00,
46   0xff, 0x8f, 0xff, 0xc3, 0xc1, 0x1d, 0x1c, 0x87, 0xff, 0xe3, 0xff, 0x01,
47   0xff, 0x87, 0xff, 0xc7, 0xc1, 0x1d, 0x1c, 0xc7, 0xff, 0xe1, 0xff, 0x00,
48   0x07, 0x80, 0x03, 0x87, 0x83, 0x0f, 0x0e, 0xc7, 0x01, 0xe0, 0x00, 0x00,
49   0x07, 0x80, 0x03, 0x87, 0x83, 0x0f, 0x0e, 0xc7, 0x01, 0xe0, 0x00, 0x00,
50   0x07, 0x80, 0x03, 0x87, 0x83, 0x0f, 0x0e, 0xc7, 0x01, 0xe0, 0x00, 0x00,
51   0x07, 0x80, 0x03, 0x07, 0x07, 0x07, 0x07, 0xc7, 0x01, 0xe0, 0x00, 0x00,
52   0x7f, 0x80, 0xff, 0x07, 0x07, 0x07, 0x07, 0xc7, 0xff, 0xe0, 0x1f, 0x00,
53   0xff, 0x80, 0xff, 0x03, 0x07, 0x07, 0x07, 0x87, 0xff, 0xe1, 0x1f, 0x00,
54   0x7f, 0x80, 0xff, 0x01, 0x8e, 0x8f, 0x03, 0x07, 0xff, 0xe3, 0x1f, 0x00,
55   0x07, 0x80, 0xc3, 0x01, 0x8e, 0x8f, 0x03, 0x07, 0x80, 0xe3, 0x00, 0x00,
56   0x07, 0x80, 0xc3, 0x01, 0x8e, 0x8f, 0x03, 0x07, 0x80, 0xe3, 0x00, 0x00,
57   0x07, 0x80, 0x83, 0x03, 0xdc, 0xdd, 0x01, 0x07, 0x80, 0xe3, 0x00, 0x00,
58   0x07, 0x80, 0x83, 0x03, 0xdc, 0xdd, 0x01, 0x07, 0x80, 0xe3, 0x00, 0x00,
59   0xff, 0x87, 0x03, 0x07, 0xf8, 0xf8, 0x00, 0x87, 0xff, 0xe3, 0xff, 0x00,
60   0xff, 0x8f, 0x03, 0x07, 0xf8, 0xf8, 0x00, 0xc7, 0xff, 0xe1, 0xff, 0x01,
61   0xfe, 0x07, 0x01, 0x02, 0x70, 0x70, 0x00, 0x82, 0xff, 0xc0, 0xff, 0x00,
62   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
63   0xfd, 0xff, 0x07, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x03, 0x00, 0x01,
64   0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x41, 0x00, 0x01,
65   0xfa, 0xff, 0x01, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x23, 0x00, 0x01,
66   0xfe, 0xff, 0x03, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x31, 0x80, 0x00,
67   0xf2, 0xff, 0x03, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x39, 0x80, 0x00,
68   0xf4, 0xff, 0x03, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x7f, 0x3c, 0x80, 0x00,
69   0xe4, 0xff, 0x03, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x3f, 0x1c, 0x40, 0x00,
70   0xe4, 0xff, 0x01, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x1f, 0x0c, 0x40, 0x00,
71   0xe8, 0xff, 0x03, 0x00, 0x00, 0x00, 0x80, 0xff, 0x1f, 0x0e, 0x40, 0x00,
72   0xc8, 0xff, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x1f, 0x06, 0x20, 0x00,
73   0xc8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x0f, 0x06, 0x20, 0x00,
74   0xd0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x07, 0x00, 0x10, 0x00,
75   0x90, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x07, 0x00, 0x10, 0x00,
76   0xa0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x08, 0x00,
77   0x20, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x08, 0x00,
78   0x40, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x04, 0x00,
79   0x80, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x04, 0x00,
80   0x80, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00,
81   0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
82   0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
83   0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
84   0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
85   0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
86   0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
87   0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
88   0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
89   0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
90   0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
91   0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
92   0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
93   0x00, 0x00, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
94   0x00, 0x00, 0x80, 0x09, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
95   0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x88, 0x03, 0x00, 0x00, 0x00,
96   0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0xa0, 0x7f, 0x00, 0x00, 0x00, 0x00,
97   0x00, 0x00, 0x00, 0xc0, 0x03, 0xfe, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00,
98   0x00, 0x00, 0x00, 0x00, 0xdc, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
99  0x00, 0x00, 0x00, 0x00, 0xa0, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00};
100
101
102 Widget uicreateinfoform();
103 Widget uicreateinfook(Widget parent);
104 void uicreateinfolabels(Widget parent, Widget bottomwdg);
105 static void uiinfookcb(char *address, HText_t * htext,
106                         HTextObject_t * htextobject, void *parameter);
107
108
109 int UiDisplayInfo()
110 {
111     uiInfoGfx_t *infogfx = &uiTopLevel.InfoGfx;
112
113     if (infogfx->FormWdg) {
114         XtMapWidget(XtParent(infogfx->FormWdg));
115
116         return UI_OK;
117     }
118     infogfx->FormWdg = uicreateinfoform();
119     infogfx->OkWdg = uicreateinfook(infogfx->FormWdg);
120     uicreateinfolabels(infogfx->FormWdg, infogfx->OkWdg);
121
122     XtManageChild(infogfx->FormWdg);
123     XtRealizeWidget(XtParent(infogfx->FormWdg));
124
125     return UI_OK;
126 }
127
128
129 static Widget
130  uicreateinfoform()
131 {
132     ArgList args;
133     Cardinal nargs;
134     Widget formwdg;
135     Widget topwdg;
136
137     topwdg = XtCreateApplicationShell("Info",
138                                       topLevelShellWidgetClass,
139                                       NULL, 0);
140
141     args = uiVaSetArgs(&nargs,
142                        XmNresizePolicy, XmRESIZE_NONE,
143                        XmNautoUnmanage, FALSE, NULL);
144     formwdg = XmCreateForm(topwdg, "InfoDialog",
145                            args, nargs);
146
147     return formwdg;
148 }
149
150
151 static Widget
152  uicreateinfook(formwdg)
153 Widget formwdg;
154 {
155     ArgList args;
156     Cardinal nargs;
157     Widget okwdg;
158     static uiActionData_t actiondata;
159
160     args = uiVaSetArgs(&nargs,
161                        XmNrightAttachment, XmATTACH_FORM,
162                        XmNrightOffset, UI_INFO_WDG_OFFSET,
163                        XmNbottomAttachment, XmATTACH_FORM,
164                        XmNbottomOffset, UI_INFO_WDG_OFFSET, NULL);
165     okwdg = XmCreatePushButtonGadget(formwdg, "   Ok   ", args, nargs);
166     actiondata.ActionName = "InfoOk";
167     actiondata.Page = uiPageInfo.CurrentPage;
168     XtAddCallback(okwdg, XmNactivateCallback, uiinfookcb, (caddr_t) NULL);
169     XtManageChild(okwdg);
170
171     return okwdg;
172 }
173
174
175 void uicreateinfolabels(formwdg, bottomwdg)
176 Widget formwdg;
177 Widget bottomwdg;
178 {
179     ArgList args;
180     Cardinal nargs;
181     XmString labelstr;
182     Pixmap logo_pixmap;
183     Widget wdg;
184     Display *dpy;
185     Widget label1wdg;
186     Widget label2wdg;
187     Widget label3wdg;
188
189     wdg = uiTopLevel.TopGfx.TopWdg;
190     dpy = XtDisplay(wdg);
191
192     logo_pixmap =
193         XCreatePixmapFromBitmapData(dpy, XtWindow(wdg), logo_bits,
194                                     logo_height, logo_width,
195                                     BlackPixel(dpy, DefaultScreen(dpy)),
196                                     uiGetArg(wdg, XmNbackground),
197                                   DefaultDepth(dpy, DefaultScreen(dpy)));
198
199     if (logo_pixmap == NULL) {
200         printf("Pixmap creation failed\n");
201         exit(1);
202     }
203     args = uiVaSetArgs(&nargs,
204                        XmNlabelType, XmPIXMAP,
205                        XmNlabelPixmap, logo_pixmap,
206                        XmNtopAttachment, XmATTACH_FORM,
207                        XmNtopOffset, UI_INFO_WDG_OFFSET,
208                        XmNleftAttachment, XmATTACH_FORM,
209                        XmNleftOffset, UI_INFO_WDG_OFFSET, NULL);
210     label1wdg = XmCreateLabelGadget(formwdg, "InfoLabel1", args, nargs);
211     XtManageChild(label1wdg);
212
213     labelstr = XmStringCreateLtoR("WorldWideWeb \n browser \n for the X Window System \n \n Version 1.0 Alpha", XmSTRING_DEFAULT_CHARSET);
214     args = uiVaSetArgs(&nargs,
215                        XmNlabelString, labelstr,
216                        XmNtopAttachment, XmATTACH_FORM,
217                        XmNtopOffset, UI_INFO_WDG_OFFSET,
218                        XmNrightAttachment, XmATTACH_FORM,
219                        XmNleftAttachment, XmATTACH_WIDGET,
220                        XmNleftWidget, label1wdg,
221                        XmNrightOffset, UI_INFO_WDG_OFFSET, NULL);
222     label2wdg = XmCreateLabelGadget(formwdg, "InfoLabel2", args, nargs);
223     XtManageChild(label2wdg);
224     XmStringFree(labelstr);
225
226     labelstr = XmStringCreateLtoR("Authors: \n Kim Nyberg, Teemu Rantanen, \n Kati Suominen, Kari Syd{nmaanlakka\n\nE-mail: erwise@cs.hut.fi", XmSTRING_DEFAULT_CHARSET);
227     args = uiVaSetArgs(&nargs,
228                        XmNlabelString, labelstr,
229                        XmNtopAttachment, XmATTACH_WIDGET,
230                        XmNtopWidget, label1wdg,
231                        XmNtopOffset, UI_INFO_WDG_OFFSET,
232                        XmNbottomAttachment, XmATTACH_WIDGET,
233                        XmNbottomWidget, bottomwdg,
234                        XmNbottomOffset, UI_INFO_WDG_OFFSET,
235                        XmNleftAttachment, XmATTACH_FORM,
236                        XmNleftOffset, UI_INFO_WDG_OFFSET,
237                        XmNrightAttachment, XmATTACH_FORM,
238                        XmNrightOffset, UI_INFO_WDG_OFFSET, NULL);
239     label3wdg = XmCreateLabelGadget(formwdg, "InfoLabel3", args, nargs);
240     XtManageChild(label3wdg);
241     XmStringFree(labelstr);
242 }
243
244
245 static void uiinfookcb(address, htext, htextobject, parameter)
246 char *address;
247 HText_t *htext;
248 HTextObject_t *htextobject;
249 void *parameter;
250 {
251     XtUnmapWidget(XtParent(uiTopLevel.InfoGfx.FormWdg));
252 }