1dc4b1748472ff0cce882dd92fc938df9c0d4007
[terminatorX.git] / src / tX_dialog.cc
1 /*
2     terminatorX - realtime audio scratching software
3     Copyright (C) 1999-2003  Alexander K├Ânig
4  
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9  
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14  
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  
19     File: tX_dialog.c
20  
21     Description: Contains the implementation of the Options and About
22                  Dialogs. (And some really ugly "WE WANT TO 
23                  TYPE LESS" macros)
24                  
25     Changes:
26     
27     28 Jul 1999: Now display compiletime settings in the about dialog.
28 */    
29
30 #include "config.h"
31 #include "tX_types.h"
32 #include "tX_global.h"
33 #include "tX_dialog.h"
34 #include <gtk/gtk.h>
35 #include <string.h>
36 #include <gdk/gdk.h>
37 #include "tX_icon.h"
38 #include "tX_glade_interface.h"
39 #include "tX_glade_support.h"
40
41 #ifndef WIN32
42 #include <X11/extensions/XInput.h>
43 #include <X11/X.h>
44 #endif
45
46 #include "license.c"
47 #include "tX_mastergui.h"
48 #include "version.h"
49 #include <dirent.h>
50
51 extern char *logo_xpm[];
52 GtkWidget *opt_dialog;
53 int opt_hidden=0;
54
55 void apply_options(GtkWidget *dialog) {
56         /* Audio */
57         if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "alsa_driver")))) {
58                 globals.audiodevice_type=ALSA;
59         } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "oss_driver")))) {
60                 globals.audiodevice_type=OSS;
61         } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "jack_driver")))) {
62                 globals.audiodevice_type=JACK;
63         }
64         
65         /* Audio: OSS */
66         strcpy(globals.oss_device, gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(lookup_widget(dialog, "oss_audio_device"))->entry)));
67         globals.oss_buff_no=(int) gtk_spin_button_get_value(GTK_SPIN_BUTTON(lookup_widget(dialog, "oss_buffers")));
68         globals.oss_buff_size=(int) gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "oss_buffersize")));
69         globals.oss_samplerate=atoi(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(lookup_widget(dialog, "oss_samplerate"))->entry)));
70         
71         /* Audio: ALSA */
72         strcpy(globals.alsa_device, gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(lookup_widget(dialog, "alsa_audio_device"))->entry)));
73         globals.alsa_buffer_time=(int) gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "alsa_buffer_time")));
74         globals.alsa_buffer_time*=1000;
75         globals.alsa_period_time=(int) gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "alsa_period_time")));
76         globals.alsa_period_time*=1000;
77         globals.alsa_samplerate=atoi(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(lookup_widget(dialog, "alsa_samplerate"))->entry)));        
78         
79         /* TODO: JACK
80         */
81         
82         /* Input */
83         globals.xinput_enable=(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "xinput_enable")))==TRUE);
84         strcpy(globals.xinput_device, gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(lookup_widget(dialog, "xinput_device"))->entry)));
85         globals.mouse_speed=gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "mouse_speed")));
86         globals.sense_cycles=(int) gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "stop_sense_cycles")));
87         globals.vtt_inertia=gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "vtt_inertia")));
88         
89         /* User Interface */ 
90         globals.show_nag=(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "startup_nagbox")))==TRUE);
91         globals.tooltips=(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "mainwin_tooltips")))==TRUE);
92         if (globals.tooltips) gtk_tooltips_enable(gui_tooltips);
93         else gtk_tooltips_disable(gui_tooltips);
94
95         if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "buttons_text_only")))) {
96                 globals.button_type=BUTTON_TYPE_TEXT;
97         } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "buttons_icon_only")))) {
98                 globals.button_type=BUTTON_TYPE_ICON;
99         } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "buttons_text_and_icon")))) {
100                 globals.button_type=BUTTON_TYPE_BOTH;
101         }
102         
103         globals.update_delay=(int) gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "update_delay")));
104         globals.update_idle=(int) gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "update_idle")));
105         globals.flash_response=gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "vumeter_decay")));
106         
107         /* Misc */
108         strcpy(globals.file_editor, gtk_entry_get_text(GTK_ENTRY(lookup_widget(dialog, "soundfile_editor"))));
109         strcpy(globals.lrdf_path, gtk_entry_get_text(GTK_ENTRY(lookup_widget(dialog, "ladspa_rdf_path"))));
110         globals.compress_set_files=(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "compress_set_files")))==TRUE);        
111         globals.prelis=(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "prelisten_enabled")))==TRUE);
112 }
113
114
115 #define WID_DYN TRUE, TRUE, 0
116 #define WID_FIX FALSE, FALSE, 0
117
118 #define my_new_subsec(s); \
119         separator=gtk_hseparator_new(); \
120         gtk_box_pack_start(GTK_BOX(vbox), separator, WID_DYN);\
121         gtk_widget_show(separator); \
122         label=gtk_label_new(s); \
123         gtk_misc_set_alignment (GTK_MISC(label), 0 ,0.5); \
124         gtk_box_pack_start(GTK_BOX(vbox), label, WID_DYN); \
125         gtk_widget_show(label); 
126
127 #define my_new_button(btn, s); \
128         btn=gtk_button_new_with_label(s); \
129         gtk_box_pack_start(GTK_BOX(aa), btn, WID_DYN); \
130         gtk_widget_show(btn);
131         
132
133 #define begin_box(); box=gtk_hbox_new(FALSE, 5);
134
135 #define begin_hom_box(); box=gtk_hbox_new(TRUE, 5);
136
137 #define end_box(); gtk_box_pack_start(GTK_BOX(vbox), box, WID_DYN); \
138         gtk_widget_show(box);
139
140 #define add_widget_dyn(wid); gtk_box_pack_start(GTK_BOX(box), wid, WID_DYN);\
141         gtk_widget_show(wid);
142         
143 #define add_widget_fix(wid); gtk_box_pack_start(GTK_BOX(box), wid, WID_FIX);\
144         gtk_widget_show(wid);
145
146 #define add_expl(s); label=gtk_label_new(s); \
147         gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5);\
148         add_widget_fix(label);
149
150 #define add_expl_dyn(s); label=gtk_label_new(s); \
151         gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5);\
152         add_widget_dyn(label);
153
154 #ifdef USE_ALSA
155 static GList *alsa_devices;
156
157 GList *get_alsa_device_list() {
158         if (alsa_devices) {
159                 return alsa_devices;
160         }
161         
162         FILE *file;
163         char buffer[PATH_MAX+1];
164         
165         if ((file = fopen("/proc/asound/pcm", "r"))) {
166                 while(fgets(buffer, PATH_MAX, file)) {
167                         buffer[PATH_MAX]=0;
168                         if (strlen(buffer)) buffer[strlen(buffer)-1]=0;
169                         if(strstr(buffer, "playback")) {
170                                 alsa_devices=g_list_append (alsa_devices, strdup(buffer));
171                         }
172                 }
173                 fclose(file);
174         }
175         
176         return alsa_devices;
177 }
178 #else
179 GList *get_alsa_device_list() {
180         return NULL;
181 }
182 #endif
183
184
185 #ifdef USE_OSS
186 static GList *oss_devices=NULL;
187
188 int oss_select_dsp_only(const struct dirent *entry){
189         return (strstr(entry->d_name, "dsp")!=0);
190 }
191
192 GList *get_oss_device_list() {
193         if (oss_devices) {
194                 return oss_devices;
195         }
196                 
197     struct dirent **namelist;
198     int n,i;
199     n = scandir("/dev", &namelist, oss_select_dsp_only, alphasort);
200     
201     if (n>0) {
202         for (i=0; i<n; i++) {
203                         char buffer[256];
204             sprintf(buffer, "/dev/%s", namelist[i]->d_name);
205             free(namelist[i]);
206                         oss_devices=g_list_append (oss_devices, strdup(buffer));
207                 }
208         }
209         
210         return oss_devices;
211 }
212 #endif
213
214 static GList *sampling_rates=NULL;
215
216 GList *get_sampling_rates_list() {
217         if (sampling_rates) {
218                 return sampling_rates;
219         }
220
221         sampling_rates=g_list_append(sampling_rates, (void *) "22000");
222         sampling_rates=g_list_append(sampling_rates, (void *) "32000");
223         sampling_rates=g_list_append(sampling_rates, (void *) "44100");
224         sampling_rates=g_list_append(sampling_rates, (void *) "48000");
225
226         return sampling_rates;  
227 }
228
229 static GList *xinput_devices=NULL;
230
231 GList *get_xinput_devices_list() {
232         if (xinput_devices) {
233                 return xinput_devices;
234         }
235         
236         int devmax;
237         Display *dpy=XOpenDisplay(NULL);
238         XDeviceInfo *xdev=XListInputDevices(dpy, &devmax);
239         XCloseDisplay(dpy);
240
241         for (int i=0; i<devmax; i++) {
242                 xinput_devices=g_list_append(xinput_devices, strdup(xdev[i].name));
243         }
244         
245         XFreeDeviceList(xdev);
246         
247         return xinput_devices;
248 }
249
250 void init_tx_options(GtkWidget *dialog) {
251         GtkTooltips *tooltips=GTK_TOOLTIPS(lookup_widget(dialog, "tooltips"));
252         
253         /* Audio */
254         switch (globals.audiodevice_type) {             
255                 case ALSA: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "alsa_driver")), 1);
256                         break;
257                 
258                 case JACK: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "jack_driver")), 1);
259                         break;
260
261                 case OSS: 
262                 default:
263                         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "oss_driver")), 1);
264                         break;
265         }
266         
267 #ifndef USE_OSS
268         gtk_widget_set_sensitive(lookup_widget(dialog, "oss_driver"), 0);
269         gtk_widget_set_sensitive(lookup_widget(dialog, "oss_audio_device"), 0);
270         gtk_widget_set_sensitive(lookup_widget(dialog, "oss_buffers"), 0);
271         gtk_widget_set_sensitive(lookup_widget(dialog, "oss_buffersize"), 0);
272 #endif
273         
274 #ifndef USE_ALSA
275         gtk_widget_set_sensitive(lookup_widget(dialog, "alsa_driver"), 0);      
276         // TODO: Rest!  
277 #endif
278         
279 #ifndef USE_JACK
280         gtk_widget_set_sensitive(lookup_widget(dialog, "jack_driver"), 0);
281 #endif  
282         
283         /* Audio: OSS */
284         GList *oss_list=get_oss_device_list();
285         if (oss_list) {
286                 gtk_combo_set_popdown_strings(GTK_COMBO(lookup_widget(dialog, "oss_audio_device")), oss_list);
287         }
288         gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(lookup_widget(dialog, "oss_audio_device"))->entry), globals.oss_device);
289
290         gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(dialog, "oss_buffers")), globals.oss_buff_no);
291         gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "oss_buffersize")), globals.oss_buff_size);
292         gtk_tooltips_set_tip(tooltips, lookup_widget(dialog, "oss_buffersize"), "Set the size of the kernel level audio buffers. On slower systems you might have to increase this value (if you hear \"clicks\" or drop-outs). Lower values mean lower latency though.", NULL);        
293         gtk_combo_set_popdown_strings(GTK_COMBO(lookup_widget(dialog, "oss_samplerate")), get_sampling_rates_list());
294         char tmp[32];
295         sprintf(tmp, "%i", globals.oss_samplerate);
296         gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(lookup_widget(dialog, "oss_samplerate"))->entry), tmp);
297         
298         
299         /* Audio: ALSA */
300         GList *alsa_list=get_alsa_device_list();
301         if (alsa_list) {
302                 gtk_combo_set_popdown_strings(GTK_COMBO(lookup_widget(dialog, "alsa_audio_device")), get_alsa_device_list());
303         }
304         gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(lookup_widget(dialog, "alsa_audio_device"))->entry), globals.alsa_device);
305
306         gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "alsa_buffer_time")), globals.alsa_buffer_time/1000);
307         gtk_tooltips_set_tip(tooltips, lookup_widget(dialog, "alsa_buffer_time"), "Sets the size of the ALSA ring buffer. On slower systems you might have to increase this value (if you hear \"clicks\" or drop-outs). Lower values mean lower latency though.", NULL);       
308         gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "alsa_period_time")), globals.alsa_period_time/1000);
309         gtk_tooltips_set_tip(tooltips, lookup_widget(dialog, "alsa_period_time"), "The ALSA period time determines how much audio data will be written to the device at once. It is recommended to set this value to a half or a third of the ALSA buffer time.", NULL);        
310
311         gtk_combo_set_popdown_strings(GTK_COMBO(lookup_widget(dialog, "alsa_samplerate")), get_sampling_rates_list());
312         sprintf(tmp, "%i", globals.alsa_samplerate);
313         gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(lookup_widget(dialog, "alsa_samplerate"))->entry), tmp);
314         
315         
316         /* TODO: Samplerate!
317                 ALSA
318                 JACK
319         */
320         
321         /* Input */
322         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "xinput_enable")), globals.xinput_enable);
323         
324         gtk_combo_set_popdown_strings(GTK_COMBO(lookup_widget(dialog, "xinput_device")), get_xinput_devices_list());
325         gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(lookup_widget(dialog, "xinput_device"))->entry), globals.xinput_device);
326
327         gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "mouse_speed")), globals.mouse_speed);
328         gtk_tooltips_set_tip(tooltips, lookup_widget(dialog, "mouse_speed"), "The speed of your mouse in scratch mode. Use negative values to invert motion.", NULL);
329         
330         gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "stop_sense_cycles")), globals.sense_cycles);
331         gtk_tooltips_set_tip(tooltips, lookup_widget(dialog, "stop_sense_cycles"),"If there is no \"motion-event\" for x cycles, where x is the number of cycles you select here, terminatorX assumes mouse motion has stopped. For smaller buffer sizes (=> shorter cycle times) you might have to increase this value", NULL);        
332
333         gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "vtt_inertia")), globals.vtt_inertia);
334         gtk_tooltips_set_tip(tooltips, lookup_widget(dialog, "vtt_inertia"),"This value defines how fast the turntables will adapt to the speed input - the higher this value, the longer it will take the turntable to actually reach the target speed.", NULL);       
335
336         /* User Interface */ 
337         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "startup_nagbox")), globals.show_nag);
338         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "mainwin_tooltips")), globals.tooltips);
339         
340         switch (globals.button_type) {
341                 case BUTTON_TYPE_TEXT:
342                         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "buttons_text_only")), 1);
343                         break;
344                 
345                 case BUTTON_TYPE_ICON:
346                         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "buttons_icon_only")), 1);
347                         break;
348                 
349                 case BUTTON_TYPE_BOTH:
350                 default:
351                         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "buttons_text_and_icon")), 1);
352         }
353         
354         gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "update_delay")), globals.update_delay);
355         gtk_tooltips_set_tip(tooltips, lookup_widget(dialog, "update_delay"), "How often to update the slow widgets.", NULL);   
356         gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "update_idle")), globals.update_idle);
357         gtk_tooltips_set_tip(tooltips, lookup_widget(dialog, "update_idle"), "The update thread will idle for the selcted amount of milliseconds. If you want to have a more responsive display update increase this value - if you have performance problems reduce this value.", NULL);       
358         gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "vumeter_decay")), globals.flash_response);
359         gtk_tooltips_set_tip(tooltips, lookup_widget(dialog, "vumeter_decay"), "Defines how fast the maximum values of the VU meters should be decayed.", NULL);        
360
361         /* Misc */
362         gtk_entry_set_text(GTK_ENTRY(lookup_widget(dialog, "soundfile_editor")), globals.file_editor);
363         gtk_entry_set_text(GTK_ENTRY(lookup_widget(dialog, "ladspa_rdf_path")), globals.lrdf_path);
364         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "compress_set_files")), globals.compress_set_files);
365         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "prelisten_enabled")), globals.prelis);
366 }
367
368 void create_options()
369 {
370         opt_dialog=create_tx_options();
371         gtk_widget_hide(lookup_widget(opt_dialog, "jack_driver"));      
372         init_tx_options(opt_dialog);
373         gtk_widget_show(opt_dialog);
374 }
375
376 void display_options()
377 {
378         if (opt_dialog) {
379                 gdk_window_raise(opt_dialog->window);   
380         } else {
381                 create_options();
382         }
383 }
384
385 GtkWidget *about=NULL;
386
387 void raise_about()
388 {
389         if (about)
390         gdk_window_raise(about->window);
391 }
392
393
394 void destroy_about()
395 {
396         if (about)
397         {       
398                 gtk_widget_destroy(about);
399                 about=NULL;
400         }
401 }
402
403
404
405 #define add_about_wid(wid); gtk_box_pack_start(GTK_BOX(box), wid, WID_DYN); \
406         gtk_widget_show(wid);
407
408 #define add_about_wid_fix(wid); gtk_box_pack_start(GTK_BOX(box), wid, WID_FIX); \
409         gtk_widget_show(wid);
410
411 GdkFont *GPL_font=NULL;
412
413 void show_about(int nag)
414 {
415         GtkWidget *window, *pwid;
416         GdkBitmap *mask;
417         GtkStyle *style;
418         GtkWidget *btn;
419         GtkWidget *box;
420         GtkWidget *hbox;
421         GtkWidget *label;
422         GtkWidget *sep;
423         GtkWidget *text;
424         GtkWidget *scroll;
425         GdkPixmap *pmap=NULL;
426         
427         if (about) 
428         {
429                 gdk_window_raise(about->window);
430                 return;
431         }
432         
433         window = gtk_window_new(GTK_WINDOW_TOPLEVEL);   
434         gtk_window_set_wmclass(GTK_WINDOW(window), "terminatorX", "tX_about");
435
436         gtk_container_set_border_width(GTK_CONTAINER(window), 5);
437
438 //      GTK_WINDOW(window)->use_uposition=TRUE;
439
440         gtk_widget_realize(window);
441         
442         gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
443         gtk_window_set_title(GTK_WINDOW(window), "terminatorX - About");
444         
445         if (nag)
446         {
447                 gdk_window_set_decorations(window->window, (enum GdkWMDecoration) 0);
448         }
449
450         
451         style = gtk_widget_get_style( window );
452
453         pmap=gdk_pixmap_create_from_xpm_d(window->window, &mask, &style->bg[GTK_STATE_NORMAL], (gchar **)logo_xpm);
454
455         pwid = gtk_pixmap_new( pmap, mask );
456         
457         if (nag) {
458                 GtkWidget *box=gtk_vbox_new(FALSE, 2);
459                 GtkWidget *box2=gtk_hbox_new(FALSE, 2);
460                 GtkWidget *label;
461                 
462                 gtk_container_add(GTK_CONTAINER(window), box);
463                 gtk_box_pack_start(GTK_BOX(box), pwid, WID_FIX);
464                 gtk_box_pack_start(GTK_BOX(box), box2, WID_FIX);
465                 
466                 label=gtk_label_new(PACKAGE" release "VERSION);
467                 gtk_box_pack_start(GTK_BOX(box2), label, WID_DYN);
468                 gtk_misc_set_alignment(GTK_MISC(label), 0.1, 0.5);
469                 gtk_widget_show(label);
470
471                 label=gtk_label_new("Copyright (C) 1999-2003 by Alexander K\xC3\xB6nig");
472                 gtk_box_pack_start(GTK_BOX(box2), label, WID_DYN);
473                 gtk_misc_set_alignment(GTK_MISC(label), 0.9, 0.5);
474                 gtk_widget_show(label);
475                 
476                 gtk_widget_show(box2);
477                 gtk_widget_show(box);
478                 gtk_widget_show(window);
479                 gtk_widget_show(pwid);
480                 
481                 while (gtk_events_pending()) gtk_main_iteration();      
482         }
483         else
484         {
485                 box=gtk_vbox_new(FALSE, 5);
486                 add_about_wid_fix(pwid);
487                 
488                 sep=gtk_hseparator_new();
489                 add_about_wid_fix(sep);
490                 char about_prefix_umlaut[]="\nThis is "PACKAGE" Release "VERSION" - Copyright (C) 1999-2003 by Alexander K\xC3\xB6nig";
491                 char about_rest[]="\n\nSend comments, patches and scratches to: alex@lisas.de\n"
492                 "terminatorX-homepage: http://www.terminatorX.cx\n\nThis binary has been compiled with the following flags: "
493                 "Sox support: "
494 #ifdef USE_SOX_INPUT
495                 "ON"
496 #else
497                 "OFF"
498 #endif          
499                 " - mpg123 support: "
500 #ifdef USE_MPG123_INPUT
501                 "ON"
502 #else
503                 "OFF"
504 #endif
505                 " - \nogg123 support: "
506 #ifdef USE_OGG123_INPUT
507                 "ON"
508 #else
509                 "OFF"
510 #endif
511
512                 " - enhanced scheduling: "
513 #ifdef USE_SCHEDULER
514                 "ON"
515 #else
516                 "OFF"
517 #endif
518                 " - for a "
519 #ifdef WORDS_BIGENDIAN
520                 "big"
521                 
522 #else
523                 "little"
524 #endif
525                 " endian machine.\n";
526                 
527                 char buffer[4096];
528                 
529                 strcpy(buffer, about_prefix_umlaut);
530                 strcat(buffer, about_rest);
531                 
532                 label=gtk_label_new(buffer);
533
534                 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
535                 add_about_wid_fix(label);
536                 
537                 sep=gtk_hseparator_new();
538                 add_about_wid_fix(sep);
539
540                 label=gtk_label_new("License (GPL V2):");
541                 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
542                 add_about_wid_fix(label);
543
544                 hbox=gtk_hbox_new(FALSE, 5);            
545
546                 GtkTextIter iter;
547                 GtkTextBuffer *tbuffer;
548
549                 text=gtk_text_view_new();
550                 tbuffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
551                 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_NONE);
552                 gtk_text_view_set_editable(GTK_TEXT_VIEW(text), false);
553                 gtk_text_buffer_get_iter_at_offset (tbuffer, &iter, 0);
554                 
555                 scroll=gtk_scrolled_window_new (NULL, NULL);
556                 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
557                 gtk_container_add (GTK_CONTAINER (scroll), text);
558                 gtk_text_buffer_create_tag (tbuffer, "courier", "family", "courier", NULL);
559                 
560                 gtk_text_buffer_insert_with_tags_by_name(tbuffer, &iter, license, -1, "courier", NULL);
561                 gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 5);
562                 gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text), 5);
563                 gtk_widget_set_usize(GTK_WIDGET(text), 640, 180);
564                 gtk_widget_show(text);          
565                 
566                 gtk_box_pack_start(GTK_BOX(hbox), scroll, WID_DYN);
567                 gtk_widget_show(scroll);                
568                 
569                 add_about_wid(hbox);
570
571                 sep=gtk_hseparator_new();
572                 add_about_wid_fix(sep);
573
574                 btn=gtk_button_new_with_label("Close");
575                 add_about_wid_fix(btn);
576
577                 gtk_container_add(GTK_CONTAINER(window), box);
578                 gtk_widget_show(box);
579                 
580                 gtk_signal_connect(GTK_OBJECT(btn), "clicked", (GtkSignalFunc) destroy_about, NULL);            
581                 gtk_signal_connect(GTK_OBJECT(window), "delete-event", (GtkSignalFunc) destroy_about, NULL);            
582         }
583         gtk_widget_show(window);
584         tX_set_icon(window, "tX About");
585         
586         while (gtk_events_pending()) gtk_main_iteration();
587                 
588         about=window;
589 }
590
591 GdkBitmap *tX_icon_mask=NULL;
592 GdkPixmap *tX_icon_pmap=NULL;
593 GtkWidget *tX_icon_widget=NULL;
594
595 void tX_set_icon(GtkWidget *widget, char *name)
596 {
597         GtkStyle *style;
598
599         style = gtk_widget_get_style( widget );
600
601         if (!tX_icon_pmap)
602         {
603                 tX_icon_pmap=gdk_pixmap_create_from_xpm_d(widget->window, &tX_icon_mask, &style->bg[GTK_STATE_NORMAL], (gchar **) tX_icon_xpm );
604                 //tX_icon_widget = gtk_pixmap_new( tX_icon_pmap, tX_icon_mask );                
605                 //gtk_widget_realize(tX_icon_widget);           
606         }
607
608         gdk_window_set_icon(widget->window, NULL, tX_icon_pmap, tX_icon_mask);
609         gdk_window_set_icon_name(widget->window, name); 
610 }