Checked in terminatorX pre-3.65 - finally ;) - Alex
[terminatorX.git] / src / tX_vttgui.cc
1 /*
2     terminatorX - realtime audio scratching software
3     Copyright (C) 1999, 2000  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_vttgui.cc
20  
21     Description: This implements the gtk+ GUI for the virtual turntable
22                  class implemented in tX_vtt.cc. This code is not in tX_vtt.cc
23                  for mainly to keep the GUI code divided from the audio-rendering
24                  code and as gtk+ callback to C++ method call wrapper.
25 */    
26
27 #include <gdk/gdk.h>
28 #include <gtk/gtk.h>
29 #include "tX_vttgui.h"
30 #include "tX_vtt.h"
31 #include "tX_widget.h"
32 #include "tX_mastergui.h"
33 #include "tX_loaddlg.h"
34 #include "tX_prelis.h"
35 #include "tX_pbutton.h"
36 #include "tX_global.h"
37 #include "tX_extdial.h"
38 #include "tX_panel.h"
39 #include "tX_ladspa.h"
40
41 #ifdef USE_DIAL
42 #include "tX_dial.h"
43 #endif
44
45 #ifdef USE_FLASH
46 #include "tX_flash.h"
47 #endif
48 #include <stdio.h>
49
50 #define WID_DYN TRUE, TRUE, 0
51 #define WID_FIX FALSE, FALSE, 0
52
53 #define FILENAME_BUTTON_MAX 20
54
55 void nicer_filename(char *dest, char *source)
56 {
57                 char *fn;
58                 char temp[PATH_MAX];
59                 int i;
60                 
61                 fn=strrchr(source, '/');
62                 if (fn) fn++;
63                 else fn=source;
64                 
65                 strcpy (temp, fn);
66                 
67                 fn=strrchr(temp, '.');
68                 if (fn) *fn=0;
69                 
70                 if (strlen(temp) > FILENAME_BUTTON_MAX)
71                 {
72                         temp[FILENAME_BUTTON_MAX-3]='.';
73                         temp[FILENAME_BUTTON_MAX-2]='.';
74                         temp[FILENAME_BUTTON_MAX-1]='.';
75                         temp[FILENAME_BUTTON_MAX]=0;
76                 } 
77                 strcpy (dest, temp);
78 }
79
80 GtkSignalFunc name_changed(GtkWidget *wid, vtt_class *vtt)
81 {
82         vtt->set_name(gtk_entry_get_text(GTK_ENTRY(wid)));
83 }
84
85 GtkSignalFunc volume_changed(GtkWidget *wid, vtt_class *vtt)
86 {
87         vtt->sp_volume.receive_gui_value(2.0-GTK_ADJUSTMENT(wid)->value);
88 }
89
90 GtkSignalFunc pitch_changed(GtkWidget *wid, vtt_class *vtt)
91 {
92         vtt->sp_pitch.receive_gui_value(GTK_ADJUSTMENT(wid)->value);
93 }
94
95 GtkSignalFunc trigger_prelis(GtkWidget *w)
96 {
97         GtkFileSelection *fs;
98         
99         fs=GTK_FILE_SELECTION(gtk_widget_get_toplevel(w));
100         
101         prelis_start(gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs)));
102         return(0);
103 }
104
105 int cancel_load_file(GtkWidget *wid, vtt_class *vtt)
106 {
107         prelis_stop();
108         
109         vtt->gui.file_dialog=NULL;
110         if (vtt->gui.fs) gtk_widget_destroy(GTK_WIDGET(vtt->gui.fs));
111 }
112
113 int quit_load_file(GtkWidget *wid, vtt_class *vtt)
114 {
115         //vtt->gui.file_dialog=NULL;
116         //prelis_stop();
117         
118         
119         return 1;
120 }
121
122 char global_filename_buffer[PATH_MAX];
123
124 void load_part(char *newfile, vtt_class *vtt)
125 {
126         int ret=0;
127         char *fn;
128
129         ld_create_loaddlg(TX_LOADDLG_MODE_SINGLE, 1);
130         ld_set_filename(newfile);
131
132         ret = vtt->load_file(newfile);
133         
134         ld_destroy();
135         if (ret)
136         {
137                 switch(ret)
138                 {
139                         case TX_AUDIO_ERR_ALLOC:
140                         tx_note("Error loading file: failed to allocate memory");
141                         break;
142                         case TX_AUDIO_ERR_PIPE_READ:
143                         tx_note("Error loading file: broken pipe (File not supported/corrupt?)");
144                         break;
145                         case TX_AUDIO_ERR_SOX:
146                         tx_note("Error loading file: couldn't execute sox");
147                         break;
148                         case TX_AUDIO_ERR_MPG123:
149                         tx_note("Error loading file: couldn't execute mpg123");
150                         break;
151                         case TX_AUDIO_ERR_WAV_NOTFOUND:
152                         tx_note("Error loading file: file not found");
153                         break;
154                         case TX_AUDIO_ERR_NOT_16BIT:
155                         tx_note("Error loading file: RIFF/WAV is not 16 Bit.");
156                         break;
157                         case TX_AUDIO_ERR_NOT_MONO:
158                         tx_note("Error loading file: RIFF/WAV is not mono");
159                         break;
160                         case TX_AUDIO_ERR_WAV_READ:
161                         tx_note("Error loading file: RIFF/WAV corrupt?");
162                         break;
163                         case TX_AUDIO_ERR_NOT_SUPPORTED:
164                         tx_note("Error loading file: filetype not supported.");
165                         break;
166                         default:                                        
167                         tx_note("OOPS: An unknown error occured - This shouldn't happen :(");   
168                 }
169         }
170         else
171         {
172                 nicer_filename(global_filename_buffer, newfile);
173 //              strcpy(global_filename_buffer, fn);
174                 
175                 gtk_label_set(GTK_LABEL(GTK_BUTTON(vtt->gui.file)->child), global_filename_buffer);
176         }       
177 }
178
179 GtkSignalFunc do_load_file(GtkWidget *wid, vtt_class *vtt)
180 {
181         int ret;
182         char newfile[PATH_MAX];
183         char buffer[1024]="Couldn't open loop file: ";
184         char fn[FILENAME_BUTTON_MAX];
185         
186         int16_t *newbuffer;
187         unsigned int newsize;
188         
189         prelis_stop();
190
191         strcpy(newfile, gtk_file_selection_get_filename(GTK_FILE_SELECTION(vtt->gui.fs)));
192         gtk_widget_destroy(GTK_WIDGET(vtt->gui.fs));
193         
194         load_part(newfile, vtt);
195
196         vtt->gui.file_dialog=NULL;
197 }
198
199 GtkSignalFunc drop_file(GtkWidget *widget, GdkDragContext *context,
200                 gint x, gint y, GtkSelectionData *selection_data,
201                 guint info, guint time, vtt_class *vtt)
202 {
203         char filename[PATH_MAX];
204         char *fn;
205         int s;
206         void *prr;
207         
208         strncpy(filename, (char *) selection_data->data, (size_t) selection_data->length);
209         filename[selection_data->length]=0;
210
211         fn = strchr (filename, '\r');
212         *fn=0;  
213         
214         fn = strchr (filename, ':');
215         if (fn) fn++; else fn=(char *) selection_data->data;
216         
217         load_part(fn, vtt);
218 }
219
220
221 GtkSignalFunc load_file(GtkWidget *wid, vtt_class *vtt)
222 {       
223         char buffer[512];
224         
225         if (vtt->gui.file_dialog)
226         {
227                 //puts("praise");
228                 gdk_window_raise(vtt->gui.file_dialog);
229                 return(0);
230         }
231         
232         sprintf(buffer, "Select Audio File for %s", vtt->name);
233         vtt->gui.fs=gtk_file_selection_new(buffer);
234         
235         if (strlen(vtt->filename) > 0)
236         {
237                 gtk_file_selection_set_filename(GTK_FILE_SELECTION(vtt->gui.fs), vtt->filename);        
238         }
239         
240         gtk_widget_show(GTK_WIDGET(vtt->gui.fs));
241         
242         vtt->gui.file_dialog=vtt->gui.fs->window;
243         
244         gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(vtt->gui.fs)->ok_button), "clicked", GTK_SIGNAL_FUNC(do_load_file), vtt);
245         gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(vtt->gui.fs)->cancel_button), "clicked", GTK_SIGNAL_FUNC (cancel_load_file), vtt);    
246         gtk_signal_connect (GTK_OBJECT(vtt->gui.fs), "delete-event", GTK_SIGNAL_FUNC(quit_load_file), vtt);     
247         gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(vtt->gui.fs)->file_list), "select_row", GTK_SIGNAL_FUNC(trigger_prelis), vtt->gui.fs);
248 }
249
250
251 GtkSignalFunc delete_vtt(GtkWidget *wid, vtt_class *vtt)
252 {
253         if (audioon) tx_note("Sorry, you'll have to stop playback first.");
254         else
255         delete(vtt);
256 }
257
258 GtkSignalFunc edit_vtt_buffer(GtkWidget *wid, vtt_class *vtt)
259 {
260         char command[2*PATH_MAX];
261
262         if (vtt->samples_in_buffer == 0)
263         {
264                 tx_note("Nothing to edit.");
265         }
266         else
267         if (strlen(globals.file_editor)>0)
268         {
269                 sprintf(command, "%s %s &", globals.file_editor, vtt->filename);
270                 system(command); /*) tx_note("Failed to run the soundfile editor."); */
271         }
272         else
273         {
274                 tx_note("No soundfile editor configured.");
275         }
276 }
277
278 GtkSignalFunc reload_vtt_buffer(GtkWidget *wid, vtt_class *vtt)
279 {
280         char reload_buffer[PATH_MAX];
281         
282         while (gtk_events_pending()) gtk_main_iteration();
283         
284 //      puts(vtt->filename);
285         if (vtt->samples_in_buffer > 0)
286         {
287                 strcpy(reload_buffer, vtt->filename);
288                 load_part(reload_buffer, vtt);
289         }
290         else tx_note("Nothing to reload.");
291 }
292
293 GtkSignalFunc clone_vtt(GtkWidget *wid, vtt_class *vtt)
294 {
295         vtt->stop();
296 }
297
298 GtkSignalFunc trigger_vtt(GtkWidget *wid, vtt_class *vtt)
299 {
300         vtt->sp_trigger.receive_gui_value((float) 1.0);
301 }
302
303 GtkSignalFunc stop_vtt(GtkWidget *wid, vtt_class *vtt)
304 {
305         vtt->sp_trigger.receive_gui_value((float) 0.0);
306 }
307
308 GtkSignalFunc autotrigger_toggled(GtkWidget *wid, vtt_class *vtt)
309 {
310         vtt->set_autotrigger(GTK_TOGGLE_BUTTON(wid)->active);
311 }
312
313 GtkSignalFunc loop_toggled(GtkWidget *wid, vtt_class *vtt)
314 {
315         vtt->sp_loop.receive_gui_value(GTK_TOGGLE_BUTTON(wid)->active);
316 }
317
318 GtkSignalFunc lp_enabled(GtkWidget *wid, vtt_class *vtt)
319 {
320         vtt->sp_lp_enable.receive_gui_value(GTK_TOGGLE_BUTTON(wid)->active);
321 }
322
323 GtkSignalFunc lp_gain_changed(GtkWidget *wid, vtt_class *vtt)
324 {
325         vtt->sp_lp_gain.receive_gui_value(GTK_ADJUSTMENT(wid)->value);
326 }
327
328 GtkSignalFunc lp_reso_changed(GtkWidget *wid, vtt_class *vtt)
329 {
330         vtt->sp_lp_reso.receive_gui_value(GTK_ADJUSTMENT(wid)->value);
331 }
332
333 GtkSignalFunc lp_freq_changed(GtkWidget *wid, vtt_class *vtt)
334 {
335         vtt->sp_lp_freq.receive_gui_value(GTK_ADJUSTMENT(wid)->value);
336 }
337
338 GtkSignalFunc ec_enabled(GtkWidget *wid, vtt_class *vtt)
339 {
340         vtt->sp_ec_enable.receive_gui_value(GTK_TOGGLE_BUTTON(wid)->active);
341 }
342
343 GtkSignalFunc ec_length_changed(GtkWidget *wid, vtt_class *vtt)
344 {
345         vtt->sp_ec_length.receive_gui_value(GTK_ADJUSTMENT(wid)->value);
346 }
347
348 GtkSignalFunc ec_feedback_changed(GtkWidget *wid, vtt_class *vtt)
349 {
350         vtt->sp_ec_feedback.receive_gui_value(GTK_ADJUSTMENT(wid)->value);
351 }
352
353 GtkSignalFunc master_setup(GtkWidget *wid, vtt_class *vtt)
354 {
355         vtt->set_sync_master(GTK_TOGGLE_BUTTON(wid)->active);
356 }
357
358 GtkSignalFunc client_setup(GtkWidget *wid, vtt_class *vtt)
359 {
360         int client;
361         
362         client=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vtt->gui.sync_client));   
363         vtt->sp_sync_client.receive_gui_value(client);
364 }
365
366 GtkSignalFunc client_setup_number(GtkWidget *wid, vtt_class *vtt)
367 {
368         int cycles;
369         
370         cycles=(int) GTK_ADJUSTMENT(vtt->gui.cycles)->value;    
371         
372         vtt->sp_sync_cycles.receive_gui_value(cycles);
373 }
374
375 /*
376 GtkSignalFunc control_changed(GtkWidget *wid, vtt_class *vtt)
377 {
378         int x,y;
379         vtt_gui *g=&vtt->gui;
380         
381         if (GTK_TOGGLE_BUTTON(g->x_scratch)->active) x=CONTROL_SCRATCH;
382         else if (GTK_TOGGLE_BUTTON(g->x_volume)->active) x=CONTROL_VOLUME;
383         else if (GTK_TOGGLE_BUTTON(g->x_lp_cutoff)->active) x=CONTROL_CUTOFF;
384         else if (GTK_TOGGLE_BUTTON(g->x_ec_feedback)->active) x=CONTROL_FEEDBACK;
385         else if (GTK_TOGGLE_BUTTON(g->x_nothing)->active) x=CONTROL_NOTHING;
386
387         if (GTK_TOGGLE_BUTTON(g->y_scratch)->active) y=CONTROL_SCRATCH;
388         else if (GTK_TOGGLE_BUTTON(g->y_volume)->active) y=CONTROL_VOLUME;
389         else if (GTK_TOGGLE_BUTTON(g->y_lp_cutoff)->active) y=CONTROL_CUTOFF;
390         else if (GTK_TOGGLE_BUTTON(g->y_ec_feedback)->active) y=CONTROL_FEEDBACK;
391         else if (GTK_TOGGLE_BUTTON(g->y_nothing)->active) y=CONTROL_NOTHING;
392         
393         vtt->set_controls(x,y);
394 }
395 */
396
397 void vg_display_xcontrol(vtt_class *vtt)
398 {
399         char buffer[2048];
400         
401         if (vtt->x_par)
402         {
403                 strcpy(buffer, vtt->x_par->get_name());
404                 if (strlen(buffer)>35) 
405                 {
406                         buffer[34] = '.';
407                         buffer[35] = '.';
408                         buffer[36] = '.';
409                         buffer[37] = 0;                 
410                 }
411                 gtk_label_set(GTK_LABEL(GTK_BUTTON(vtt->gui.x_control)->child), buffer);                
412         }
413         else
414         {
415                 gtk_label_set(GTK_LABEL(GTK_BUTTON(vtt->gui.x_control)->child), "Nothing");
416         }
417 }
418
419 void vg_display_ycontrol(vtt_class *vtt)
420 {
421         char buffer[2048];
422         
423         if (vtt->y_par)
424         {
425                 strcpy(buffer, vtt->y_par->get_name());
426                 if (strlen(buffer)>26) 
427                 {
428                         buffer[24] = '.';
429                         buffer[25] = '.';
430                         buffer[26] = '.';
431                         buffer[27] = 0;                 
432                 }
433                 gtk_label_set(GTK_LABEL(GTK_BUTTON(vtt->gui.y_control)->child), buffer);                
434         }
435         else
436         {
437                 gtk_label_set(GTK_LABEL(GTK_BUTTON(vtt->gui.y_control)->child), "Nothing");
438         }
439 }
440
441 GtkSignalFunc vg_xcontrol_dis(GtkWidget *wid, vtt_class *vtt)
442 {
443         vtt->set_x_input_parameter(NULL);
444 }
445
446 GtkSignalFunc vg_ycontrol_dis(GtkWidget *wid, vtt_class *vtt)
447 {
448         vtt->set_y_input_parameter(NULL);
449 }
450
451 GtkSignalFunc vg_xcontrol_set(GtkWidget *wid, tX_seqpar *sp)
452 {
453         vtt_class *vtt=(vtt_class *) sp->vtt;
454         vtt->set_x_input_parameter(sp);
455 }
456
457 GtkSignalFunc vg_ycontrol_set(GtkWidget *wid, tX_seqpar *sp)
458 {
459         vtt_class *vtt=(vtt_class *) sp->vtt;
460         vtt->set_y_input_parameter(sp);
461 }
462
463 void vg_control_menu_popup(vtt_class *vtt, int axis)
464 {
465         list <tX_seqpar *> :: iterator sp;
466         vtt_gui *g=&vtt->gui;
467         GtkWidget *item;
468
469         if (g->par_menu) gtk_object_destroy(GTK_OBJECT(g->par_menu));
470         g->par_menu=gtk_menu_new();
471         
472         item = gtk_menu_item_new_with_label("Nothing");
473         gtk_menu_append(GTK_MENU(g->par_menu), item);
474         gtk_widget_show(item);
475         if (axis) gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(vg_xcontrol_dis), vtt);
476         else gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(vg_ycontrol_dis), vtt);
477         
478         
479         for (sp=tX_seqpar::all.begin(); sp!=tX_seqpar::all.end(); sp++)
480         {
481                 if (((*sp)->is_mappable) && ((*sp)->vtt) == (void*) vtt)
482                 {
483                         item = gtk_menu_item_new_with_label((*sp)->get_name());
484                         gtk_menu_append(GTK_MENU(g->par_menu), item);
485                         gtk_widget_show(item);
486                         if (axis) gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(vg_xcontrol_set), (void*) (*sp));
487                         else gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(vg_ycontrol_set), (void*) (*sp));
488                 }
489         }
490         gtk_menu_popup (GTK_MENU(g->par_menu), NULL, NULL, NULL, NULL, 0, 0);
491 }
492
493 GtkSignalFunc vg_xcontrol_popup(GtkWidget *wid, vtt_class *vtt) 
494 {
495         vg_control_menu_popup(vtt, 1);
496 }
497
498 GtkSignalFunc vg_ycontrol_popup(GtkWidget *wid, vtt_class *vtt)
499 {
500         vg_control_menu_popup(vtt, 0);
501 }
502
503 static vtt_class * fx_vtt;
504
505 GtkSignalFunc new_effect(GtkWidget *wid, LADSPA_Plugin *plugin)
506 {
507         fx_vtt->add_effect(plugin);
508 }
509
510 GtkSignalFunc fx_button_pressed(GtkWidget *wid, vtt_class *vtt)
511 {
512         vtt_gui *g=&vtt->gui;
513         GtkWidget *item;
514         int i;
515         LADSPA_Plugin *plugin;
516         char buffer[1024];
517         char oldfile[1024]="";
518         GtkWidget *submenu;
519
520         fx_vtt=vtt; /* AAAAARGH - Long live ugly code */
521
522         if (g->ladspa_menu) gtk_object_destroy(GTK_OBJECT(g->ladspa_menu));
523         g->ladspa_menu=gtk_menu_new();
524         
525         for (i=0; i<LADSPA_Plugin::getPluginCount(); i++)
526         {
527                 plugin=LADSPA_Plugin::getPluginByIndex(i);
528                 if (strcmp(plugin->get_file_name(), oldfile))
529                 {
530                         strcpy(oldfile, plugin->get_file_name());
531                         item = gtk_menu_item_new_with_label(oldfile);
532                         submenu=gtk_menu_new();
533                         gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
534                         gtk_menu_append(GTK_MENU(g->ladspa_menu), item);
535                         gtk_widget_show(item);
536                 }
537                 sprintf(buffer, "%s - [%i, %s]", plugin->getName(), plugin->getUniqueID(), plugin->getLabel());
538                 item=gtk_menu_item_new_with_label(buffer);
539                 gtk_menu_append(GTK_MENU(submenu), item);
540                 gtk_widget_show(item);
541                 gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(new_effect), plugin);
542         }
543         
544         gtk_menu_popup (GTK_MENU(g->ladspa_menu), NULL, NULL, NULL, NULL, 0, 0);
545 }
546
547 #define connect_entry(wid, func); gtk_signal_connect(GTK_OBJECT(g->wid), "activate", (GtkSignalFunc) func, (void *) vtt);
548 #define connect_adj(wid, func); gtk_signal_connect(GTK_OBJECT(g->wid), "value_changed", (GtkSignalFunc) func, (void *) vtt);
549 #define connect_button(wid, func); gtk_signal_connect(GTK_OBJECT(g->wid), "clicked", (GtkSignalFunc) func, (void *) vtt);
550 #define connect_press_button(wid, func); gtk_signal_connect(GTK_OBJECT(g->wid), "pressed", (GtkSignalFunc) func, (void *) vtt);
551 #define connect_rel_button(wid, func); gtk_signal_connect(GTK_OBJECT(g->wid), "released", (GtkSignalFunc) func, (void *) vtt);
552
553 GtkWidget *vg_create_fx_bar(vtt_class *vtt, vtt_fx *effect, int showdel);
554
555 void gui_connect_signals(vtt_class *vtt)
556 {
557         vtt_gui *g=&vtt->gui;
558
559         connect_entry(name, name_changed);
560         connect_adj(volume, volume_changed);
561         connect_button(edit, edit_vtt_buffer);
562         connect_button(reload, reload_vtt_buffer);
563         connect_adj(pitch, pitch_changed);
564         connect_button(file, load_file);
565         
566         connect_button(del, delete_vtt);
567 //      connect_button(clone, clone_vtt);
568         connect_button(trigger, trigger_vtt);
569         connect_button(stop, stop_vtt);
570         connect_button(autotrigger, autotrigger_toggled);
571         connect_button(loop, loop_toggled);
572         connect_button(sync_master, master_setup);
573         connect_button(sync_client, client_setup);
574         connect_adj(cycles, client_setup_number);
575 /*      
576         connect_button(x_scratch, control_changed);
577         connect_button(x_volume, control_changed);
578         connect_button(x_lp_cutoff, control_changed);
579         connect_button(x_ec_feedback, control_changed);
580         connect_button(x_nothing, control_changed);
581
582         connect_button(y_scratch, control_changed);
583         connect_button(y_volume, control_changed);
584         connect_button(y_lp_cutoff, control_changed);
585         connect_button(y_ec_feedback, control_changed);
586         connect_button(y_nothing, control_changed);
587 */      
588         connect_button(fx_button, fx_button_pressed);
589         
590         connect_button(lp_enable, lp_enabled);
591         connect_adj(lp_gain, lp_gain_changed);
592         connect_adj(lp_reso, lp_reso_changed);
593         connect_adj(lp_freq, lp_freq_changed);
594         
595         connect_button(ec_enable, ec_enabled);
596         connect_adj(ec_length, ec_length_changed);
597         connect_adj(ec_feedback, ec_feedback_changed);
598         connect_button(x_control, vg_xcontrol_popup);
599         connect_button(y_control, vg_ycontrol_popup);
600
601         static GtkTargetEntry drop_types [] = {
602                 { "text/uri-list", 0, 0}
603         };
604         static gint n_drop_types = sizeof (drop_types) / sizeof(drop_types[0]);
605         
606         gtk_drag_dest_set (GTK_WIDGET (g->file), (GtkDestDefaults) (GTK_DEST_DEFAULT_MOTION |GTK_DEST_DEFAULT_HIGHLIGHT |GTK_DEST_DEFAULT_DROP),
607                         drop_types, n_drop_types,
608                         GDK_ACTION_COPY);
609                                                 
610         gtk_signal_connect (GTK_OBJECT (g->file), "drag_data_received",
611                         GTK_SIGNAL_FUNC(drop_file), (void *) vtt);
612
613         gtk_drag_dest_set (GTK_WIDGET (g->display), (GtkDestDefaults) (GTK_DEST_DEFAULT_MOTION |GTK_DEST_DEFAULT_HIGHLIGHT |GTK_DEST_DEFAULT_DROP),
614                         drop_types, n_drop_types,
615                         GDK_ACTION_COPY);
616                                                 
617         gtk_signal_connect (GTK_OBJECT (g->display), "drag_data_received",
618                         GTK_SIGNAL_FUNC(drop_file), (void *) vtt);
619         
620 }
621         
622 void build_vtt_gui(vtt_class *vtt)
623 {
624         GtkWidget *tempbox;
625         GtkWidget *tempbox2;
626         GtkWidget *dummy;
627         char nice_name[FILENAME_BUTTON_MAX];
628         
629         vtt_gui *g;
630         
631         g=&vtt->gui;
632         vtt->have_gui=1;
633         g->par_menu=NULL;
634         g->ladspa_menu=NULL;
635
636         /* Building Audio Box */
637         g->audio_box=gtk_vbox_new(FALSE,2);
638         gtk_widget_show(g->audio_box);
639         
640         tempbox=gtk_hbox_new(FALSE,2);
641         gtk_widget_show(tempbox);
642         gtk_box_pack_start(GTK_BOX(g->audio_box), tempbox, WID_FIX);
643         
644         g->audio_label=gtk_label_new(vtt->name);
645         gtk_widget_show(g->audio_label);
646         gtk_box_pack_start(GTK_BOX(tempbox), g->audio_label, WID_DYN);
647
648         dummy=gtk_vseparator_new();
649         gtk_widget_show(dummy);
650         gtk_box_pack_start(GTK_BOX(tempbox), dummy, WID_FIX);
651
652         nicer_filename(nice_name, vtt->filename);
653         g->file = gtk_button_new_with_label(nice_name);
654         gtk_widget_show(g->file);
655         gtk_box_pack_start(GTK_BOX(tempbox), g->file, WID_DYN);
656
657         g->edit=tx_xpm_button_new(TX_ICON_EDIT, "Edit", 0);
658         gtk_widget_show(g->edit);
659         gtk_box_pack_start(GTK_BOX(tempbox), g->edit, WID_FIX);
660         
661         g->reload=tx_xpm_button_new(TX_ICON_RELOAD, "Reload", 0);
662         gtk_widget_show(g->reload);
663         gtk_box_pack_start(GTK_BOX(tempbox), g->reload, WID_FIX);
664         
665         dummy=gtk_vseparator_new();
666         gtk_widget_show(dummy);
667         gtk_box_pack_start(GTK_BOX(tempbox), dummy, WID_FIX);
668
669         dummy=gtk_label_new("X:");
670         gtk_widget_show(dummy);
671         gtk_box_pack_start(GTK_BOX(tempbox), dummy, WID_FIX);
672
673         g->x_control=gtk_button_new_with_label(vtt->x_par->get_name());
674         gtk_widget_show(g->x_control);
675         gtk_box_pack_start(GTK_BOX(tempbox), g->x_control, WID_DYN);
676
677         dummy=gtk_label_new("Y:");
678         gtk_widget_show(dummy);
679         gtk_box_pack_start(GTK_BOX(tempbox), dummy, WID_FIX);
680         
681         g->y_control=gtk_button_new_with_label(vtt->y_par->get_name());
682         gtk_widget_show(g->y_control);
683         gtk_box_pack_start(GTK_BOX(tempbox), g->y_control, WID_DYN);
684
685         g->display=gtk_tx_new(vtt->buffer, vtt->samples_in_buffer);
686         gtk_box_pack_start(GTK_BOX(g->audio_box), g->display, WID_DYN);
687         gtk_widget_show(g->display);    
688         
689         /* Building Control Box */
690         
691         g->control_box=gtk_vbox_new(FALSE,2);
692         gtk_widget_show(g->control_box);
693         
694         g->control_label=gtk_label_new(vtt->name);
695         gtk_widget_show(g->control_label);
696         gtk_box_pack_start(GTK_BOX(g->control_box), g->control_label, WID_FIX);
697         
698         g->scrolled_win=gtk_scrolled_window_new (NULL, NULL);
699         gtk_container_set_border_width (GTK_CONTAINER (g->scrolled_win), 0);
700         gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (g->scrolled_win),
701                                     GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
702         gtk_widget_show(g->scrolled_win);
703         gtk_box_pack_start(GTK_BOX(g->control_box), g->scrolled_win, WID_DYN);
704                                     
705         g->control_subbox=gtk_vbox_new(FALSE,0);
706         gtk_scrolled_window_add_with_viewport (
707                    GTK_SCROLLED_WINDOW (g->scrolled_win), g->control_subbox);
708         gtk_widget_show(g->control_subbox);
709                    
710
711         /* Main panel */
712         
713         tX_panel *p=new tX_panel("Main", g->control_subbox);
714         g->main_panel=p;
715                         
716         g->name = gtk_entry_new_with_max_length(256);   
717         gtk_entry_set_text(GTK_ENTRY(g->name), vtt->name);
718         p->add_client_widget(g->name);
719         gtk_widget_set_usize(g->name, 40, g->name->requisition.height);
720         
721         g->del=gtk_button_new_with_label("Delete");
722         p->add_client_widget(g->del);
723         
724         g->show_audio=gtk_toggle_button_new_with_label("Show Audio");
725         p->add_client_widget(g->show_audio);
726                 
727         gtk_box_pack_start(GTK_BOX(g->control_subbox), p->get_widget(), WID_FIX);
728                                 
729         p=new tX_panel("Trigger", g->control_subbox);
730         g->trigger_panel=p;
731         
732         g->trigger=gtk_button_new_with_label("Trigger!");
733         p->add_client_widget(g->trigger);
734         
735         g->stop=gtk_button_new_with_label("Stop.");
736         p->add_client_widget(g->stop);
737         
738         g->autotrigger=gtk_check_button_new_with_label("Auto");
739         p->add_client_widget(g->autotrigger);
740         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->autotrigger), vtt->autotrigger);
741         
742         g->loop=gtk_check_button_new_with_label("Loop");
743         p->add_client_widget(g->loop);
744         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->loop), vtt->loop);
745         
746         g->sync_master=gtk_check_button_new_with_label("Master");
747         p->add_client_widget(g->sync_master);
748         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->sync_master), vtt->is_sync_master);
749         
750         g->sync_client=gtk_check_button_new_with_label("Client");
751         p->add_client_widget(g->sync_client);
752         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->sync_client), vtt->is_sync_client);
753         
754         g->cycles=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->sync_cycles, 0, 10.0, 1,1,1));
755         dummy=gtk_spin_button_new(g->cycles, 1.0, 0);
756         p->add_client_widget(dummy);
757
758         gtk_box_pack_start(GTK_BOX(g->control_subbox), p->get_widget(), WID_FIX);
759
760         dummy=gtk_button_new_with_label("FX");
761         gtk_widget_show(dummy);
762         g->fx_button=dummy;
763         gtk_box_pack_start(GTK_BOX(g->control_subbox), dummy, WID_FIX);
764         
765         /* Lowpass Panel */
766
767         p=new tX_panel("Lowpass", g->control_subbox);
768         g->lp_panel=p;
769                 
770         g->lp_enable=gtk_check_button_new_with_label("Enable");
771         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->lp_enable), vtt->lp_enable);
772         p->add_client_widget(vg_create_fx_bar(vtt, vtt->lp_fx, 0));
773
774         p->add_client_widget(g->lp_enable);
775
776         g->lp_gain=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->lp_gain, 0, 2, 0.1, 0.01, 0.01));
777         g->lp_reso=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->lp_reso, 0, 0.99, 0.1, 0.01, 0.01));
778         g->lp_freq=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->lp_freq, 0, 1, 0.1, 0.01, 0.01));
779
780         g->lp_gaind=new tX_extdial("Input Gain", g->lp_gain);
781         p->add_client_widget(g->lp_gaind->get_widget());
782
783         g->lp_freqd=new tX_extdial("Frequency", g->lp_freq);
784         p->add_client_widget(g->lp_freqd->get_widget());
785
786         g->lp_resod=new tX_extdial("Resonance", g->lp_reso);
787         p->add_client_widget(g->lp_resod->get_widget());
788
789         gtk_box_pack_start(GTK_BOX(g->control_subbox), p->get_widget(), WID_FIX);
790
791         /* Echo Panel */
792
793         p=new tX_panel("Echo", g->control_subbox);
794         g->ec_panel=p;
795
796         p->add_client_widget(vg_create_fx_bar(vtt, vtt->ec_fx, 0));
797         
798         g->ec_enable=gtk_check_button_new_with_label("Enable");
799         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->ec_enable), vtt->ec_enable);
800         p->add_client_widget(g->ec_enable);
801
802         g->ec_length=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->ec_length, 0, 1, 0.1, 0.01, 0.001));
803         g->ec_feedback=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->ec_feedback, 0, 1, 0.1, 0.01, 0.001));
804
805         g->ec_lengthd=new tX_extdial("Duration", g->ec_length);
806         p->add_client_widget(g->ec_lengthd->get_widget());
807
808         g->ec_feedbackd=new tX_extdial("Feedback", g->ec_feedback);
809         p->add_client_widget(g->ec_feedbackd->get_widget());
810
811         gtk_box_pack_start(GTK_BOX(g->control_subbox), p->get_widget(), WID_FIX);
812         
813         /* Output */
814         
815         tempbox=gtk_hbox_new(FALSE,2);
816         gtk_widget_show(tempbox);
817         gtk_box_pack_end(GTK_BOX(g->control_box), tempbox, WID_FIX);
818         
819         tempbox2=gtk_vbox_new(FALSE,0);
820         gtk_widget_show(tempbox2);
821         gtk_box_pack_start(GTK_BOX(tempbox), tempbox2, WID_FIX);
822         
823         g->pitch=GTK_ADJUSTMENT(gtk_adjustment_new(vtt->rel_pitch, -3, +3, 0.1, 0.01, 0.001));
824         g->pan=GTK_ADJUSTMENT(gtk_adjustment_new(0, -1, 1, 0.1, 0.01, 0.001));
825
826         g->pitchd=new tX_extdial("Pitch", g->pitch);
827         gtk_box_pack_start(GTK_BOX(tempbox2), g->pitchd->get_widget(), WID_FIX);
828
829         g->pand=new tX_extdial("Pan", g->pan);
830         gtk_box_pack_start(GTK_BOX(tempbox2), g->pand->get_widget(), WID_FIX);
831
832         tempbox2=gtk_hbox_new(FALSE,0);
833         gtk_widget_show(tempbox2);
834         gtk_box_pack_start(GTK_BOX(tempbox), tempbox2, WID_FIX);
835         
836         g->volume=GTK_ADJUSTMENT(gtk_adjustment_new(2.0-vtt->rel_volume, 0, 2, 0.01, 0.01, 0.01));
837         dummy=gtk_vscale_new(GTK_ADJUSTMENT(g->volume)); 
838         gtk_scale_set_draw_value(GTK_SCALE(dummy), False);
839         gtk_box_pack_start(GTK_BOX(tempbox2), dummy, WID_FIX);
840         gtk_widget_show(dummy);
841
842         g->flash=gtk_tx_flash_new();
843         gtk_box_pack_start(GTK_BOX(tempbox2), g->flash, WID_FIX);
844         gtk_widget_show(g->flash);              
845
846         g->file_dialog=NULL;
847
848 //      gtk_notebook_set_page(GTK_NOTEBOOK(vtt->gui.notebook), g->current_gui);
849         
850         gui_connect_signals(vtt);
851 }
852
853 GtkSignalFunc fx_up(GtkWidget *wid, vtt_fx *effect)
854 {
855         vtt_class *vtt;
856         
857         vtt=(vtt_class*)effect->get_vtt();
858         vtt->effect_up(effect);
859 }
860
861 GtkSignalFunc fx_down(GtkWidget *wid, vtt_fx *effect)
862 {
863         vtt_class *vtt;
864         
865         vtt=(vtt_class*)effect->get_vtt();
866         vtt->effect_down(effect);
867 }
868
869
870 GtkSignalFunc fx_kill(GtkWidget *wid, vtt_fx_ladspa *effect)
871 {
872         vtt_class *vtt;
873         
874         vtt=(vtt_class*)effect->get_vtt();
875         vtt->effect_remove(effect);
876 }
877
878 GtkWidget *vg_create_fx_bar(vtt_class *vtt, vtt_fx *effect, int showdel)
879 {
880         GtkWidget *box;
881         GtkWidget *pixmap;
882         GtkWidget *button;
883         
884         box=gtk_hbox_new(FALSE,0);
885
886         if (showdel)
887         {
888                 button=gtk_button_new();
889                 pixmap=tx_pixmap_widget(TX_ICON_FX_CLOSE);
890                 gtk_container_add (GTK_CONTAINER (button), pixmap);     
891                 gtk_box_pack_end(GTK_BOX(box), button, WID_FIX);
892                 gtk_widget_show(pixmap);
893                 gtk_widget_show(button);
894                 gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) fx_kill, (void *) effect);
895         }
896
897         button=gtk_button_new();
898         pixmap=tx_pixmap_widget(TX_ICON_FX_DOWN);
899         gtk_container_add (GTK_CONTAINER (button), pixmap);     
900         gtk_box_pack_end(GTK_BOX(box), button, WID_FIX);
901         gtk_widget_show(pixmap);
902         gtk_widget_show(button);
903         gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) fx_down, (void *) effect);
904
905         button=gtk_button_new();
906         pixmap=tx_pixmap_widget(TX_ICON_FX_UP);
907         gtk_container_add (GTK_CONTAINER (button), pixmap);     
908         gtk_box_pack_end(GTK_BOX(box), button, WID_FIX);
909         gtk_widget_show(pixmap);
910         gtk_widget_show(button);
911         gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) fx_up, (void *) effect);
912         
913         gtk_widget_show(box);
914         
915         return box;
916 }
917
918
919 int gtk_box_get_widget_pos(GtkBox *box, GtkWidget *child)
920 {
921         int i=0;
922         GList *list;
923  
924         list = box->children;
925         while (list)
926         {
927                 GtkBoxChild *child_info;
928                 child_info = (GtkBoxChild *) list->data;
929                 if (child_info->widget == child)
930                 break;
931                 list = list->next; i++;
932         }
933         return i;
934 }
935
936 void vg_move_fx_panel_up(GtkWidget *wid, vtt_class *vtt)
937 {
938         int pos=gtk_box_get_widget_pos(GTK_BOX(vtt->gui.control_subbox), wid);
939         gtk_box_reorder_child(GTK_BOX(vtt->gui.control_subbox), wid, pos-1);
940 }
941
942 void vg_move_fx_panel_down(GtkWidget *wid, vtt_class *vtt)
943 {
944         int pos=gtk_box_get_widget_pos(GTK_BOX(vtt->gui.control_subbox), wid);
945         gtk_box_reorder_child(GTK_BOX(vtt->gui.control_subbox), wid, pos+1);
946 }
947
948 GtkSignalFunc vg_show_fx_info(GtkWidget *wid, vtt_fx *effect)
949 {
950         tx_l_note(effect->get_info_string());
951 }
952
953 void vg_create_fx_gui(vtt_class *vtt, vtt_fx_ladspa *effect, LADSPA_Plugin *plugin)
954 {
955         char buffer[1024];
956         
957         vtt_gui *g;
958         g=&vtt->gui;    
959         tX_panel *p;
960         list <tX_seqpar_vttfx *> :: iterator sp;
961         
962         strcpy(buffer, plugin->getLabel());
963         if (strlen(buffer) > 8)
964         {
965                 buffer[7]='.';
966                 buffer[8]='.';
967                 buffer[9]='.';
968                 buffer[10]=0;
969         }
970
971         p=new tX_panel(buffer, g->control_subbox);
972         
973         p->add_client_widget(vg_create_fx_bar(vtt, effect, 1));
974         
975         for (sp = effect->controls.begin(); sp != effect->controls.end(); sp++)
976         {
977                         p->add_client_widget((*sp)->get_widget());
978         }
979
980         gtk_signal_connect(GTK_OBJECT(p->get_labelbutton()), "clicked", (GtkSignalFunc) vg_show_fx_info, (void *) effect);
981         effect->set_panel_widget(p->get_widget());
982         effect->set_panel(p);
983
984         gtk_box_pack_start(GTK_BOX(g->control_subbox), p->get_widget(), WID_FIX);
985 }
986
987 void gui_set_name(vtt_class *vtt, char *newname)
988 {
989         gtk_label_set_text(GTK_LABEL(vtt->gui.audio_label), newname);
990         gtk_label_set_text(GTK_LABEL(vtt->gui.control_label), newname);
991         gtk_entry_set_text(GTK_ENTRY(vtt->gui.name), newname);
992 }
993
994 void gui_set_filename (vtt_class *vtt, char *newname)
995 {
996         gtk_label_set(GTK_LABEL(GTK_BUTTON(vtt->gui.file)->child), newname);
997 }
998
999 void gui_update_display(vtt_class *vtt)
1000 {
1001         nicer_filename(global_filename_buffer, vtt->filename);
1002         gtk_label_set(GTK_LABEL(GTK_BUTTON(vtt->gui.file)->child), global_filename_buffer);
1003         gtk_tx_set_data(GTK_TX(vtt->gui.display), vtt->buffer, vtt->samples_in_buffer);
1004 }
1005
1006 void delete_gui(vtt_class *vtt)
1007 {
1008         delete vtt->gui.main_panel;
1009         delete vtt->gui.trigger_panel;
1010         
1011         delete vtt->gui.pitchd;
1012         delete vtt->gui.pand;
1013         
1014         delete vtt->gui.lp_gaind;
1015         delete vtt->gui.lp_resod;
1016         delete vtt->gui.lp_freqd;
1017         delete vtt->gui.lp_panel;
1018         
1019         delete vtt->gui.ec_lengthd;
1020         delete vtt->gui.ec_feedbackd;
1021         delete vtt->gui.ec_panel;
1022         
1023         gtk_widget_destroy(vtt->gui.control_box);
1024         gtk_widget_destroy(vtt->gui.audio_box);
1025 }
1026
1027 /*
1028 void recreate_gui(vtt_class *vtt, GtkWidget *ctrl, GtkWidget *audio)
1029 {
1030         build_vtt_gui(vtt);
1031 //      gtk_notebook_set_page(GTK_NOTEBOOK(vtt->gui.notebook), g->current_gui);
1032         gtk_box_pack_start(GTK_BOX(daddy), vtt->gui.frame, TRUE, TRUE, 0);
1033         gtk_widget_show(vtt->gui.frame);
1034 }
1035
1036 void delete_gui(vtt_class *vtt)
1037 {
1038         gtk_widget_destroy(vtt->gui.frame);
1039 }*/
1040
1041 void update_all_vtts()
1042 {
1043         list <vtt_class *> :: iterator vtt;
1044         f_prec temp;
1045         
1046         for (vtt=vtt_class::main_list.begin(); vtt!=vtt_class::main_list.end(); vtt++)
1047         {
1048                 if ((*vtt)->is_playing)
1049                 {
1050                         gtk_tx_update_pos_display(GTK_TX((*vtt)->gui.display), (*vtt)->pos_i, (*vtt)->mute);
1051 #ifdef USE_FLASH
1052                         temp=(*vtt)->max_value*(*vtt)->res_volume*vtt_class::vol_channel_adjust;
1053                         (*vtt)->max_value=0;
1054                         gtk_tx_flash_set_level((*vtt)->gui.flash, temp);
1055 #endif          
1056                 }
1057         }
1058 }
1059
1060 void cleanup_vtt(vtt_class *vtt)
1061 {
1062                 gtk_tx_cleanup_pos_display(GTK_TX(vtt->gui.display));   
1063 #ifdef USE_FLASH
1064                 gtk_tx_flash_set_level(vtt->gui.flash, 0.0);
1065                 gtk_tx_flash_clear(vtt->gui.flash);
1066 #endif          
1067 }
1068
1069 void cleanup_all_vtts()
1070 {
1071         list <vtt_class *> :: iterator vtt;
1072         
1073         for (vtt=vtt_class::main_list.begin(); vtt!=vtt_class::main_list.end(); vtt++)
1074         {
1075                 if ((*vtt)->buffer) gtk_tx_cleanup_pos_display(GTK_TX((*vtt)->gui.display));
1076 #ifdef USE_FLASH
1077                 gtk_tx_flash_set_level((*vtt)->gui.flash, 0.0);
1078                 gtk_tx_flash_clear((*vtt)->gui.flash);
1079 #endif          
1080         }
1081 }
1082
1083 void gui_clear_master_button(vtt_class *vtt)
1084 {
1085         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vtt->gui.sync_master), 0);
1086 }
1087
1088 void gui_show_frame(vtt_class *vtt, int show)
1089 {
1090         gtk_tx_show_frame(GTK_TX(vtt->gui.display), show);
1091 }
1092
1093 void show_all_guis(int show)
1094 {
1095         list <vtt_class *> :: iterator vtt;
1096 /*      
1097         for (vtt=vtt_class::main_list.begin(); vtt!=vtt_class::main_list.end(); vtt++)
1098         {
1099                 if (show)
1100                 {
1101                         gtk_widget_show((*vtt)->gui.notebook);
1102                 }
1103                 else
1104                 {
1105                         gtk_widget_hide((*vtt)->gui.notebook);          
1106                 }
1107         }
1108         */
1109 }
1110 /*
1111 void vg_update_sync(void *p)
1112 {
1113         vtt_class *vtt=(vtt_class*) p;
1114         
1115         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vtt->gui.sync_client), vtt->is_sync_client);
1116 //      gtk_adjustment_set_value(vtt->gui.cycles
1117 }
1118 */
1119 #define vgui (*vtt)->gui
1120 #define v (*vtt)
1121
1122 void vg_enable_critical_buttons(int enable)
1123 {
1124         list <vtt_class *> :: iterator vtt;
1125         for (vtt=vtt_class::main_list.begin(); vtt!=vtt_class::main_list.end(); vtt++)
1126         {
1127                 gtk_widget_set_sensitive(vgui.del, enable);
1128                 gtk_widget_set_sensitive(vgui.sync_master, enable);
1129         }
1130 }
1131
1132
1133 int vg_get_current_page(vtt_class *vtt)
1134 {
1135         return (0);
1136 }
1137
1138 void vg_set_current_page(vtt_class *vtt, int page)
1139 {
1140         vtt->gui.current_gui=page;
1141 }
1142
1143 void vg_init_all_non_seqpars()
1144 {
1145         list <vtt_class *> :: iterator vtt;
1146         
1147         for (vtt=vtt_class::main_list.begin(); vtt!=vtt_class::main_list.end(); vtt++)
1148         {
1149                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON((*vtt)->gui.autotrigger), (*vtt)->autotrigger);
1150                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON((*vtt)->gui.sync_master), (*vtt)->is_sync_master);
1151         }       
1152 }