2 terminatorX - realtime audio scratching software
3 Copyright (C) 1999-2014 Alexander König
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.
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.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 Description: Contains the implementation of the Options and About
21 Dialogs. (And some really ugly "WE WANT TO
27 #include "tX_global.h"
28 #include "tX_dialog.h"
33 #include "tX_ui_interface.h"
34 #include "tX_ui_support.h"
36 #include "tX_widget.h"
40 #include "tX_mastergui.h"
44 #include "tX_engine.h"
52 extern void jack_check();
55 extern char *logo_xpm[];
56 GtkWidget *opt_dialog;
59 static GtkWidget *last_alsa_device_widget=NULL;
61 void apply_options(GtkWidget *dialog) {
63 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "alsa_driver")))) {
64 globals.audiodevice_type=ALSA;
65 } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "oss_driver")))) {
66 globals.audiodevice_type=OSS;
67 } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "jack_driver")))) {
68 globals.audiodevice_type=JACK;
69 } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "pulse_driver")))) {
71 globals.audiodevice_type=PULSE;
73 globals.use_realtime=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "use_realtime")));
76 char *oss_device = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(lookup_widget(dialog, "oss_audio_device")));
78 strcpy(globals.oss_device, oss_device);
80 globals.oss_buff_no=(int) gtk_spin_button_get_value(GTK_SPIN_BUTTON(lookup_widget(dialog, "oss_buffers")));
81 globals.oss_buff_size=(int) gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "oss_buffersize")));
82 globals.oss_samplerate=atoi(gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(lookup_widget(dialog, "oss_samplerate"))));
85 char *alsa_device = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(lookup_widget(dialog, "alsa_audio_device")));
87 strcpy(globals.alsa_device_id, alsa_device);
89 globals.alsa_buffer_time=(int) gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "alsa_buffer_time")));
90 globals.alsa_buffer_time*=1000;
91 globals.alsa_period_time=(int) gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "alsa_period_time")));
92 globals.alsa_period_time*=1000;
93 globals.alsa_samplerate=atoi(gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(lookup_widget(dialog, "alsa_samplerate"))));
94 globals.alsa_free_hwstats=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "alsa_free_hwstats")));
99 globals.mouse_speed=gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "mouse_speed")));
100 globals.sense_cycles=(int) gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "stop_sense_cycles")));
101 globals.vtt_inertia=gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "vtt_inertia")));
104 globals.show_nag=(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "startup_nagbox")))==TRUE);
105 globals.tooltips=(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "mainwin_tooltips")))==TRUE);
106 globals.filename_length=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(lookup_widget(dialog, "filename_length")));
107 // if (globals.tooltips) gtk_tooltips_enable(gui_tooltips);
108 // else gtk_tooltips_disable(gui_tooltips);
109 // TODO: Disable Tooltips no longer possible?
111 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "buttons_text_only")))) {
112 globals.button_type=BUTTON_TYPE_TEXT;
113 } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "buttons_icon_only")))) {
114 globals.button_type=BUTTON_TYPE_ICON;
115 } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "buttons_text_and_icon")))) {
116 globals.button_type=BUTTON_TYPE_BOTH;
119 globals.update_delay=(int) gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "update_delay")));
120 globals.update_idle=(int) gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "update_idle")));
121 globals.flash_response=gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "vumeter_decay")));
123 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "override_knob_size")))) {
124 globals.knob_size_override=gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "knob_size")));
126 globals.knob_size_override = 0;
131 strcpy(globals.wav_display_bg_focus, (char *) g_object_get_data(G_OBJECT(lookup_widget(dialog, "wav_display_bg_focus")), "Color"));
132 strcpy(globals.wav_display_bg_no_focus, (char *) g_object_get_data(G_OBJECT(lookup_widget(dialog, "wav_display_bg_no_focus")), "Color"));
133 strcpy(globals.wav_display_fg_focus, (char *) g_object_get_data(G_OBJECT(lookup_widget(dialog, "wav_display_fg_focus")), "Color"));
134 strcpy(globals.wav_display_fg_no_focus, (char *) g_object_get_data(G_OBJECT(lookup_widget(dialog, "wav_display_fg_no_focus")), "Color"));
135 strcpy(globals.wav_display_cursor, (char *) g_object_get_data(G_OBJECT(lookup_widget(dialog, "wav_display_cursor")), "Color"));
136 strcpy(globals.wav_display_cursor_mute, (char *) g_object_get_data(G_OBJECT(lookup_widget(dialog, "wav_display_cursor_mute")), "Color"));
139 strcpy(globals.vu_meter_bg, (char *) g_object_get_data(G_OBJECT(lookup_widget(dialog, "vu_meter_bg")), "Color"));
140 strcpy(globals.vu_meter_loud, (char *) g_object_get_data(G_OBJECT(lookup_widget(dialog, "vu_meter_loud")), "Color"));
141 strcpy(globals.vu_meter_normal, (char *) g_object_get_data(G_OBJECT(lookup_widget(dialog, "vu_meter_normal")), "Color"));
143 globals.vu_meter_border_intensity=gtk_range_get_value(GTK_RANGE(lookup_widget(dialog, "vu_meter_border_intensity")));
146 strcpy(globals.file_editor, gtk_entry_get_text(GTK_ENTRY(lookup_widget(dialog, "soundfile_editor"))));
147 strcpy(globals.lrdf_path, gtk_entry_get_text(GTK_ENTRY(lookup_widget(dialog, "ladspa_rdf_path"))));
148 globals.compress_set_files=(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "compress_set_files")))==TRUE);
149 globals.prelis=(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "prelisten_enabled")))==TRUE);
150 globals.restore_midi_connections=(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "reconnect_enabled")))==TRUE);
151 globals.quit_confirm=(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "quit_confirm")))==TRUE);
152 globals.verbose_plugin_loading=(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "verbose_plugin_loading")))==TRUE);
153 globals.force_nonrt_plugins=(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "force_nonrt_plugins")))==TRUE);
156 std::list<vtt_class *>::iterator vtt;
158 for (vtt=vtt_class::main_list.begin(); vtt!=vtt_class::main_list.end(); vtt++) {
159 gtk_tx_update_colors(GTK_TX((*vtt)->gui.display));
160 gtk_widget_queue_draw((*vtt)->gui.display);
161 gtk_tx_flash_update_colors(GTK_TX_FLASH((*vtt)->gui.flash));
162 gtk_widget_queue_draw((*vtt)->gui.flash);
165 gtk_tx_flash_update_colors(GTK_TX_FLASH(main_flash));
166 gtk_widget_queue_draw(main_flash);
174 #define WID_DYN TRUE, TRUE, 0
175 #define WID_FIX FALSE, FALSE, 0
177 #define my_new_subsec(s); \
178 separator=gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); \
179 gtk_box_pack_start(GTK_BOX(vbox), separator, WID_DYN);\
180 gtk_widget_show(separator); \
181 label=gtk_label_new(s); \
182 gtk_misc_set_alignment (GTK_MISC(label), 0 ,0.5); \
183 gtk_box_pack_start(GTK_BOX(vbox), label, WID_DYN); \
184 gtk_widget_show(label);
186 #define my_new_button(btn, s); \
187 btn=gtk_button_new_with_label(s); \
188 gtk_box_pack_start(GTK_BOX(aa), btn, WID_DYN); \
189 gtk_widget_show(btn);
192 #define begin_box(); box=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
194 #define begin_hom_box(); box=gtk_hbox_new(TRUE, 5);
196 #define end_box(); gtk_box_pack_start(GTK_BOX(vbox), box, WID_DYN); \
197 gtk_widget_show(box);
199 #define add_widget_dyn(wid); gtk_box_pack_start(GTK_BOX(box), wid, WID_DYN);\
200 gtk_widget_show(wid);
202 #define add_widget_fix(wid); gtk_box_pack_start(GTK_BOX(box), wid, WID_FIX);\
203 gtk_widget_show(wid);
205 #define add_expl(s); label=gtk_label_new(s); \
206 gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5);\
207 add_widget_fix(label);
209 #define add_expl_dyn(s); label=gtk_label_new(s); \
210 gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5);\
211 add_widget_dyn(label);
214 void append_alsa_device_list(GtkComboBoxText *combo, char *current) {
216 char buffer[PATH_MAX+1];
219 if ((file = fopen("/proc/asound/pcm", "r"))) {
220 while(fgets(buffer, PATH_MAX, file)) {
222 if (strlen(buffer)) buffer[strlen(buffer)-1]=0;
223 if(strstr(buffer, "playback")) {
226 memset(foo, 0, PATH_MAX);
230 sscanf(buffer, "%i-%i: %1024c", &card, &device, foo);
231 sprintf(tmp, "hw:%i,%i# %s", card, device, foo);
233 gtk_combo_box_text_append_text(combo, strdup(tmp));
235 if (strcmp(tmp, current) == 0) {
236 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), ctr);
246 void append_alsa_device_list(GtkComboBoxText *combo) {
252 int oss_select_dsp_only(const struct dirent *entry){
253 return (strstr(entry->d_name, "dsp")!=0);
256 void append_oss_device_list(GtkComboBoxText *combo, char *current) {
257 struct dirent **namelist;
259 n = scandir("/dev", &namelist, oss_select_dsp_only, alphasort);
262 for (i=0; i<n; i++) {
264 sprintf(buffer, "/dev/%s", namelist[i]->d_name);
266 gtk_combo_box_text_append_text(combo, strdup(buffer));
268 if (strcmp(buffer, current)==0) {
269 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), i);
276 void append_sampling_rates_list(GtkComboBoxText *combo, int current) {
278 gtk_combo_box_text_append_text(combo, "22000");
279 gtk_combo_box_text_append_text(combo, "32000");
280 gtk_combo_box_text_append_text(combo, "44100");
281 gtk_combo_box_text_append_text(combo, "48000");
284 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
287 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 1);
290 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 2);
294 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 3);
298 #define MAX_COLORS 10
299 char *colors[MAX_COLORS]={ NULL };
301 #define set_color_button(s,g); \
302 sprintf(tmp, "<span foreground=\"%s\"><b>%s</b></span>", s, s);\
303 gtk_label_set_markup(GTK_LABEL(gtk_container_get_children(GTK_CONTAINER(lookup_widget(dialog, g)))->data), tmp);\
304 strcpy(colors[ctr], s);\
305 g_object_set_data(G_OBJECT(lookup_widget(dialog, g)), "Color", colors[ctr]);\
309 void init_tx_options(GtkWidget *dialog) {
312 if (colors[0]==NULL) {
313 for (int i=0; i<MAX_COLORS; i++) {
314 colors[i]=new char[8];
320 switch (globals.audiodevice_type) {
321 case ALSA: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "alsa_driver")), 1);
324 case JACK: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "jack_driver")), 1);
327 case PULSE: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "pulse_driver")), 1);
332 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "oss_driver")), 1);
336 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "use_realtime")), globals.use_realtime);
338 #ifndef USE_CAPABILITIES
339 /* rt's not configurable without capabilities. */
340 gtk_widget_hide(lookup_widget(dialog, "use_realtime"));
341 gtk_widget_hide(lookup_widget(dialog, "use_realtime_label"));
345 gtk_widget_set_sensitive(lookup_widget(dialog, "oss_driver"), 0);
346 gtk_widget_set_sensitive(lookup_widget(dialog, "oss_audio_device"), 0);
347 gtk_widget_set_sensitive(lookup_widget(dialog, "oss_buffers"), 0);
348 gtk_widget_set_sensitive(lookup_widget(dialog, "oss_buffersize"), 0);
352 gtk_widget_set_sensitive(lookup_widget(dialog, "alsa_driver"), 0);
357 gtk_widget_set_sensitive(lookup_widget(dialog, "jack_driver"), 0);
361 append_oss_device_list(GTK_COMBO_BOX_TEXT(lookup_widget(dialog, "oss_audio_device")), globals.oss_device);
363 gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(dialog, "oss_buffers")), globals.oss_buff_no);
364 gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "oss_buffersize")), globals.oss_buff_size);
365 gtk_widget_set_tooltip_text(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.");
366 append_sampling_rates_list(GTK_COMBO_BOX_TEXT(lookup_widget(dialog, "oss_samplerate")), globals.oss_samplerate);
369 GtkComboBoxText *combo=GTK_COMBO_BOX_TEXT(lookup_widget(dialog, "alsa_audio_device"));
370 last_alsa_device_widget=NULL;
372 append_alsa_device_list(GTK_COMBO_BOX_TEXT(combo), globals.alsa_device_id);
374 gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "alsa_buffer_time")), globals.alsa_buffer_time/1000);
375 gtk_widget_set_tooltip_text(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.");
376 gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "alsa_period_time")), globals.alsa_period_time/1000);
377 gtk_widget_set_tooltip_text(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.");
379 append_sampling_rates_list(GTK_COMBO_BOX_TEXT(lookup_widget(dialog, "alsa_samplerate")), globals.alsa_samplerate);
381 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "alsa_free_hwstats")), globals.alsa_free_hwstats);
383 gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "mouse_speed")), globals.mouse_speed);
384 gtk_widget_set_tooltip_text(lookup_widget(dialog, "mouse_speed"), "The speed of your mouse in scratch mode. Use negative values to invert motion.");
386 gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "stop_sense_cycles")), globals.sense_cycles);
387 gtk_widget_set_tooltip_text(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");
389 gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "vtt_inertia")), globals.vtt_inertia);
390 gtk_widget_set_tooltip_text(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.");
392 gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(dialog, "filename_length")), globals.filename_length);
395 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "startup_nagbox")), globals.show_nag);
396 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "mainwin_tooltips")), globals.tooltips);
398 switch (globals.button_type) {
399 case BUTTON_TYPE_TEXT:
400 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "buttons_text_only")), 1);
403 case BUTTON_TYPE_ICON:
404 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "buttons_icon_only")), 1);
407 case BUTTON_TYPE_BOTH:
409 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "buttons_text_and_icon")), 1);
412 gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "update_delay")), globals.update_delay);
413 gtk_widget_set_tooltip_text(lookup_widget(dialog, "update_delay"), "How often to update the slow widgets.");
414 gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "update_idle")), globals.update_idle);
415 gtk_widget_set_tooltip_text(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 reduce this value - if you have performance problems increase this value.");
416 gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "vumeter_decay")), globals.flash_response);
417 gtk_widget_set_tooltip_text(lookup_widget(dialog, "vumeter_decay"), "Defines how fast the maximum values of the VU meters should be decayed.");
420 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "override_knob_size")), globals.knob_size_override > 0);
421 if (globals.knob_size_override) {
422 gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "knob_size")), globals.knob_size_override);
424 gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "knob_size")), 48);
429 set_color_button(globals.wav_display_bg_focus, "wav_display_bg_focus");
430 set_color_button(globals.wav_display_bg_no_focus, "wav_display_bg_no_focus");
431 set_color_button(globals.wav_display_fg_focus, "wav_display_fg_focus");
432 set_color_button(globals.wav_display_fg_no_focus, "wav_display_fg_no_focus");
433 set_color_button(globals.wav_display_cursor, "wav_display_cursor");
434 set_color_button(globals.wav_display_cursor_mute, "wav_display_cursor_mute");
437 set_color_button(globals.vu_meter_bg, "vu_meter_bg");
438 set_color_button(globals.vu_meter_loud, "vu_meter_loud");
439 set_color_button(globals.vu_meter_normal, "vu_meter_normal");
441 gtk_range_set_value(GTK_RANGE(lookup_widget(dialog, "vu_meter_border_intensity")), globals.vu_meter_border_intensity);
444 gtk_entry_set_text(GTK_ENTRY(lookup_widget(dialog, "soundfile_editor")), globals.file_editor);
445 gtk_entry_set_text(GTK_ENTRY(lookup_widget(dialog, "ladspa_rdf_path")), globals.lrdf_path);
446 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "compress_set_files")), globals.compress_set_files);
447 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "prelisten_enabled")), globals.prelis);
448 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "reconnect_enabled")), globals.restore_midi_connections);
449 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "quit_confirm")), globals.quit_confirm);
450 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "force_nonrt_plugins")), globals.force_nonrt_plugins);
451 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog, "verbose_plugin_loading")), globals.verbose_plugin_loading);
454 void create_options()
456 opt_dialog=create_tx_options(GTK_WINDOW(main_window));
457 tX_set_icon(opt_dialog);
458 init_tx_options(opt_dialog);
459 gtk_widget_show(opt_dialog);
462 void display_options()
465 gdk_window_raise(gtk_widget_get_window(opt_dialog));
471 GtkWidget *about=NULL;
475 if (about) gdk_window_raise(gtk_widget_get_window(about));
482 gtk_widget_destroy(about);
487 #define add_about_wid(wid); gtk_box_pack_start(GTK_BOX(box), wid, WID_DYN); \
488 gtk_widget_show(wid);
490 #define add_about_wid_fix(wid); gtk_box_pack_start(GTK_BOX(box), wid, WID_FIX); \
491 gtk_widget_show(wid);
493 void show_about(int nag)
505 /* Only raise the window if it's already open... */
507 gdk_window_raise(gtk_widget_get_window(about));
511 /* Create the window... */
512 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
513 gtk_container_set_border_width(GTK_CONTAINER(window), 5);
514 gtk_window_set_title(GTK_WINDOW(window), "terminatorX - About");
515 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
516 gtk_window_set_modal(GTK_WINDOW(window), TRUE);
517 gtk_window_set_resizable(GTK_WINDOW(window), nag ? TRUE: FALSE);
519 GdkPixbuf *image=gdk_pixbuf_new_from_xpm_data((const char **)logo_xpm);
520 iwid = gtk_image_new_from_pixbuf(image);
523 GtkWidget *box=gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
524 GtkWidget *box2=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
527 gtk_container_add(GTK_CONTAINER(window), box);
528 gtk_box_pack_start(GTK_BOX(box), iwid, WID_FIX);
529 gtk_box_pack_start(GTK_BOX(box), box2, WID_FIX);
531 label=gtk_label_new(PACKAGE" release "VERSION);
532 gtk_box_pack_start(GTK_BOX(box2), label, WID_DYN);
533 gtk_misc_set_alignment(GTK_MISC(label), 0.1, 0.5);
534 gtk_widget_show(label);
536 label=gtk_label_new("Copyright (C) 1999-2014 by Alexander König");
537 gtk_box_pack_start(GTK_BOX(box2), label, WID_DYN);
538 gtk_misc_set_alignment(GTK_MISC(label), 0.9, 0.5);
539 gtk_widget_show(label);
541 gtk_widget_show(box2);
542 gtk_widget_show(box);
543 gtk_widget_show(iwid);
545 gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
546 gtk_widget_show(window);
548 box=gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
549 add_about_wid_fix(iwid);
551 sep=gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
552 add_about_wid_fix(sep);
554 label=gtk_label_new("This is "PACKAGE" release "VERSION".\nCopyright (C) 1999-2014 by Alexander König <alex@lisas.de>");
556 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
557 add_about_wid_fix(label);
559 sep=gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
560 add_about_wid_fix(sep);
562 expander = gtk_expander_new("Build info");
563 GtkWidget *exbox=gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
564 gtk_container_add(GTK_CONTAINER(expander), exbox);
565 gtk_widget_show(exbox);
567 label=gtk_label_new("Compilation flags: "
571 #ifdef USE_MPG123_INPUT
574 #ifdef USE_OGG123_INPUT
580 #ifdef USE_VORBIS_INPUT
583 #ifdef USE_AUDIOFILE_INPUT
586 #ifdef USE_ALSA_MIDI_IN
604 #ifdef USE_CAPABILITIES
609 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
610 gtk_widget_set_size_request(label, 640, -1);
611 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
612 gtk_container_add(GTK_CONTAINER(exbox), label);
613 gtk_widget_show(label);
614 add_about_wid_fix(expander);
617 sep=gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
618 gtk_widget_show(sep);
619 gtk_container_add(GTK_CONTAINER(exbox), sep);
624 struct sched_param parm;
626 pthread_getschedparam(tX_engine::get_instance()->get_thread_id(), &policy, &parm);
627 char prio_str[32]="";
628 bool s_enabled = false;
632 strcpy(prio_str, "SCHED_OTHER");
636 strcpy(prio_str, "SCHED_RR");
640 strcpy(prio_str, "SCHED_FIFO");
645 sprintf(prio_str, "UNKNOWN (%i)", policy);
648 sprintf(buffer, "Audio engine scheduling policy: %s.\nScheduling with realtime priority is %s.", prio_str, s_enabled ? "enabled" : "disabled");
650 label=gtk_label_new(buffer);
652 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
653 gtk_widget_show(label);
654 gtk_container_add(GTK_CONTAINER(exbox), label);
657 sep=gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
658 add_about_wid_fix(sep);
660 expander = gtk_expander_new("License (GPL V2):");
662 add_about_wid_fix(expander);
665 GtkTextBuffer *tbuffer;
667 text=gtk_text_view_new();
668 tbuffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
669 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_NONE);
670 gtk_text_view_set_editable(GTK_TEXT_VIEW(text), false);
671 gtk_text_buffer_get_iter_at_offset (tbuffer, &iter, 0);
673 scroll=gtk_scrolled_window_new (NULL, NULL);
674 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
675 gtk_container_add (GTK_CONTAINER (scroll), text);
676 gtk_text_buffer_create_tag (tbuffer, "courier", "family", "courier", NULL);
678 gtk_text_buffer_insert_with_tags_by_name(tbuffer, &iter, license, -1, "courier", NULL);
679 gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 5);
680 gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text), 5);
681 gtk_widget_set_size_request(GTK_WIDGET(text), 640, 200);
682 gtk_widget_show(text);
684 gtk_container_add(GTK_CONTAINER(expander), scroll);
685 gtk_widget_show(scroll);
687 sep=gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
688 add_about_wid_fix(sep);
690 btn=gtk_button_new_with_label("Close");
691 add_about_wid_fix(btn);
693 gtk_container_add(GTK_CONTAINER(window), box);
694 gtk_widget_show(box);
696 g_signal_connect(G_OBJECT(btn), "clicked", (GCallback) destroy_about, NULL);
697 g_signal_connect(G_OBJECT(window), "delete-event", (GCallback) destroy_about, NULL);
699 gtk_widget_show(window);
702 while (gtk_events_pending()) gtk_main_iteration();
707 static GdkPixbuf *tX_window_icon=NULL;
709 void tX_set_icon(GtkWidget *widget)
711 if (!tX_window_icon) {
712 tX_window_icon=gdk_pixbuf_new_from_inline(-1, tX_icon, FALSE, NULL);
715 gtk_window_set_icon(GTK_WINDOW(widget), tX_window_icon);