New "Sequencer" menu to delete events - Alex
authorterminatorX <>
Sun, 18 May 2003 15:15:55 +0000 (15:15 +0000)
committerterminatorX <>
Sun, 18 May 2003 15:15:55 +0000 (15:15 +0000)
16 files changed:
ChangeLog
configure.in
src/tX_glade_callbacks.cc
src/tX_glade_callbacks.h
src/tX_glade_interface.cc
src/tX_glade_interface.h
src/tX_global.c
src/tX_global.h
src/tX_legacy_vtt.cc
src/tX_mastergui.cc
src/tX_mastergui.h
src/tX_seqpar.cc
src/tX_sequencer.cc
src/tX_sequencer.h
src/tX_vtt.cc
terminatorX.glade

index 3122210cc578a500bdc02c5bffd7f91bbbcdf6ca..b9cbc9a2ae11de3d5c6b034ed50664da9d47fd22 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,25 @@ All changes were done by me (Alexander K
 This is not a GNU-style ChangeLog but you sort of get the idea what was
 changed.
 
+[v3.81 pre-release]
+- often, you record events and mess things up - in this case I'd often prefer 
+  dropping the complete take instead of recording a bad perfomance - which is 
+  why you now can activate "Confirm Recorded Events" from the "Sequencer" menu.
+  When enabled terminatorX will ask whether to actually record or drop the 
+  events created for the last take. The setting for this flag is stored in your
+  ~/.terminatorXrc.
+- introduced a new "Sequencer" menu that allows to delete events of a specific
+  type (all, all for certain turntable, all for a certain parameter) from the
+  sequencer. Events can be deleted for the complete song, upto the current song
+  position or from the current song position. Yeah, I know, termintorX is 
+  lacking a proper event-editor here, so where's your patch? ;)
+- switching the X11 mouse cursor when the user has to wait for terminatorX to 
+  finish some operation
+- fixed a sequencer bug: the events for master pitch and volume weren't erased
+  correctly when another set was loaded
+- fixed FreeBSD issues with the configure script
+- fixed compilation issues for gcc 2.95.x
+
 [v3.80]
 - I've invested quite some time in valgrinding this release, among other things
   a major mem leak showed up - the sample memory wasn't being free'd correctly
index e3fc00f22bdf894b371954325bda918968760313..a856ca65ea472febae127a7dd40bb292f39bc695 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT(src/tX_global.h)
-AM_INIT_AUTOMAKE(terminatorX, 3.80)
+AM_INIT_AUTOMAKE(terminatorX, 3.81)
 AM_CONFIG_HEADER(config.h)
 
 dnl AC_ARG_ENABLE(closedev, [  --enable-closedev       close audio device if not in use. [default=yes] ])
index fbdfe1a694f0fecbec52cc9e29cbb2bddc9b0a2b..dadc7a55d438f392a64e7ce4ba7fb1f36973014a 100644 (file)
@@ -9,6 +9,8 @@
 #include "tX_glade_support.h"
 #include "tX_dialog.h"
 #include "tX_global.h"
+#include "tX_mastergui.h"
+#include "tX_sequencer.h"
 
 void
 on_pref_cancel_clicked                 (GtkButton       *button,
@@ -72,3 +74,47 @@ on_pref_reset_clicked                  (GtkButton       *button,
        set_global_defaults();
        init_tx_options(opt_dialog);
 }
+
+void
+on_del_mode_cancel_clicked             (GtkButton       *button,
+                                        gpointer         user_data)
+{
+       gtk_widget_destroy(del_dialog);
+       del_dialog=NULL;
+}
+
+
+void
+on_del_mode_ok_clicked                 (GtkButton       *button,
+                                        gpointer         user_data)
+{
+       tX_sequencer::del_mode mode;
+       
+       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(del_dialog, "all_events")))) {
+               mode=tX_sequencer::DELETE_ALL;
+       } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(del_dialog, "upto_current")))) {
+               mode=tX_sequencer::DELETE_UPTO_CURRENT;         
+       } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(del_dialog, "from_current")))) {
+               mode=tX_sequencer::DELETE_FROM_CURRENT;         
+       } else {
+               tX_error("Invalid tX_sequencer::del_mode selected.");
+               return;
+       }
+       
+       switch(menu_del_mode) {
+               case ALL_EVENTS_ALL_TURNTABLES:
+                       sequencer.delete_all_events(mode);
+                       break;
+               case ALL_EVENTS_FOR_TURNTABLE:
+                       sequencer.delete_all_events_for_vtt(del_vtt, mode);
+                       break;
+               case ALL_EVENTS_FOR_SP:
+                       sequencer.delete_all_events_for_sp(del_sp, mode);
+                       break;
+               default:
+                       tX_error("Invalid del_mode");
+       }
+       
+       gtk_widget_destroy(del_dialog);
+       del_dialog=NULL;
+}
index 852eed856f596388a713393c2f61cb8040b346a7..ced10308dec2a7ad31c8192a450d51ce6935c70e 100644 (file)
@@ -23,3 +23,11 @@ on_pref_apply_clicked                  (GtkButton       *button,
 void
 on_pref_ok_clicked                     (GtkButton       *button,
                                         gpointer         user_data);
+
+void
+on_del_mode_cancel_clicked             (GtkButton       *button,
+                                        gpointer         user_data);
+
+void
+on_del_mode_ok_clicked                 (GtkButton       *button,
+                                        gpointer         user_data);
index 4d0c7f0e24cfea3888bd37a1523d29ad525ad65b..32a3682cc379281aa8f32a82c2fe722c18785710 100644 (file)
@@ -835,3 +835,100 @@ create_tx_options (void)
   return tx_options;
 }
 
+GtkWidget*
+create_tx_del_mode (void)
+{
+  GtkWidget *tx_del_mode;
+  GtkWidget *dialog_vbox4;
+  GtkWidget *vbox2;
+  GtkWidget *delmode_label;
+  GtkWidget *hbox3;
+  GtkWidget *vbox3;
+  GtkWidget *all_events;
+  GSList *all_events_group = NULL;
+  GtkWidget *upto_current;
+  GtkWidget *from_current;
+  GtkWidget *dialog_action_area4;
+  GtkWidget *cancelbutton1;
+  GtkWidget *okbutton1;
+
+  tx_del_mode = gtk_dialog_new ();
+  gtk_window_set_title (GTK_WINDOW (tx_del_mode), "Choose Events to Delete");
+
+  dialog_vbox4 = GTK_DIALOG (tx_del_mode)->vbox;
+  gtk_widget_show (dialog_vbox4);
+
+  vbox2 = gtk_vbox_new (FALSE, 2);
+  gtk_widget_show (vbox2);
+  gtk_box_pack_start (GTK_BOX (dialog_vbox4), vbox2, TRUE, TRUE, 0);
+  gtk_container_set_border_width (GTK_CONTAINER (vbox2), 4);
+
+  delmode_label = gtk_label_new ("Select which events to delete.");
+  gtk_widget_show (delmode_label);
+  gtk_box_pack_start (GTK_BOX (vbox2), delmode_label, TRUE, FALSE, 0);
+  gtk_label_set_justify (GTK_LABEL (delmode_label), GTK_JUSTIFY_LEFT);
+
+  hbox3 = gtk_hbox_new (FALSE, 0);
+  gtk_widget_show (hbox3);
+  gtk_box_pack_start (GTK_BOX (vbox2), hbox3, TRUE, FALSE, 0);
+
+  vbox3 = gtk_vbox_new (FALSE, 0);
+  gtk_widget_show (vbox3);
+  gtk_box_pack_start (GTK_BOX (hbox3), vbox3, TRUE, FALSE, 0);
+
+  all_events = gtk_radio_button_new_with_mnemonic (NULL, "Complete song");
+  gtk_widget_show (all_events);
+  gtk_box_pack_start (GTK_BOX (vbox3), all_events, FALSE, FALSE, 0);
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (all_events), all_events_group);
+  all_events_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (all_events));
+
+  upto_current = gtk_radio_button_new_with_mnemonic (NULL, "Upto the current song position");
+  gtk_widget_show (upto_current);
+  gtk_box_pack_start (GTK_BOX (vbox3), upto_current, FALSE, FALSE, 0);
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (upto_current), all_events_group);
+  all_events_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (upto_current));
+
+  from_current = gtk_radio_button_new_with_mnemonic (NULL, "From the current song position");
+  gtk_widget_show (from_current);
+  gtk_box_pack_start (GTK_BOX (vbox3), from_current, FALSE, FALSE, 0);
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (from_current), all_events_group);
+  all_events_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (from_current));
+
+  dialog_action_area4 = GTK_DIALOG (tx_del_mode)->action_area;
+  gtk_widget_show (dialog_action_area4);
+  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area4), GTK_BUTTONBOX_END);
+
+  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
+  gtk_widget_show (cancelbutton1);
+  gtk_dialog_add_action_widget (GTK_DIALOG (tx_del_mode), cancelbutton1, GTK_RESPONSE_CANCEL);
+  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);
+
+  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
+  gtk_widget_show (okbutton1);
+  gtk_dialog_add_action_widget (GTK_DIALOG (tx_del_mode), okbutton1, GTK_RESPONSE_OK);
+  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
+
+  g_signal_connect ((gpointer) cancelbutton1, "clicked",
+                    G_CALLBACK (on_del_mode_cancel_clicked),
+                    NULL);
+  g_signal_connect ((gpointer) okbutton1, "clicked",
+                    G_CALLBACK (on_del_mode_ok_clicked),
+                    NULL);
+
+  /* Store pointers to all widgets, for use by lookup_widget(). */
+  GLADE_HOOKUP_OBJECT_NO_REF (tx_del_mode, tx_del_mode, "tx_del_mode");
+  GLADE_HOOKUP_OBJECT_NO_REF (tx_del_mode, dialog_vbox4, "dialog_vbox4");
+  GLADE_HOOKUP_OBJECT (tx_del_mode, vbox2, "vbox2");
+  GLADE_HOOKUP_OBJECT (tx_del_mode, delmode_label, "delmode_label");
+  GLADE_HOOKUP_OBJECT (tx_del_mode, hbox3, "hbox3");
+  GLADE_HOOKUP_OBJECT (tx_del_mode, vbox3, "vbox3");
+  GLADE_HOOKUP_OBJECT (tx_del_mode, all_events, "all_events");
+  GLADE_HOOKUP_OBJECT (tx_del_mode, upto_current, "upto_current");
+  GLADE_HOOKUP_OBJECT (tx_del_mode, from_current, "from_current");
+  GLADE_HOOKUP_OBJECT_NO_REF (tx_del_mode, dialog_action_area4, "dialog_action_area4");
+  GLADE_HOOKUP_OBJECT (tx_del_mode, cancelbutton1, "cancelbutton1");
+  GLADE_HOOKUP_OBJECT (tx_del_mode, okbutton1, "okbutton1");
+
+  return tx_del_mode;
+}
+
index 7c38f99b9288a2438058071f4cc15d9c51435c95..a6419e02d2383f407761abe6de0dba1485f558e7 100644 (file)
@@ -4,3 +4,4 @@
 
 GtkWidget* create_tx_adjust (void);
 GtkWidget* create_tx_options (void);
+GtkWidget* create_tx_del_mode (void);
index bab42717f6c7f967b97a065677709c8dc1ce1739..a812ecf90173d238dca31e82baa637598d63dd03 100644 (file)
@@ -131,6 +131,7 @@ void set_global_defaults() {
        
        strcpy(globals.lrdf_path, "/usr/share/ladspa/rdf:/usr/local/share/ladspa/rdf");
        globals.fullscreen_enabled=0;
+       globals.confirm_events=0;
        globals.compress_set_files=0;
 }
 
@@ -208,6 +209,7 @@ int load_globals_xml() {
                        
                        restore_int("compress_set_files", globals.compress_set_files);
                        restore_int("fullscreen_enabled", globals.fullscreen_enabled);
+                       restore_int("confirm_events", globals.confirm_events);
 
                        if (!elementFound) {
                                fprintf(stderr, "tX: Unhandled XML element: \"%s\"\n", cur->name);
@@ -293,6 +295,7 @@ void store_globals() {
                store_string("lrdf_path", globals.lrdf_path);
                store_int("compress_set_files", globals.compress_set_files);
                store_int("fullscreen_enabled", globals.fullscreen_enabled);
+               store_int("confirm_events", globals.confirm_events);
                
                fprintf(rc,"</terminatorXrc>\n");
        }
index eb7b1b2e8d1b353550f5f5931bdcb02dc72f120a..07faca7a0283fa9b5ff6d590d76cb46c3806b30d 100644 (file)
@@ -138,6 +138,7 @@ typedef struct {
        int compress_set_files;
        
        int fullscreen_enabled;
+       int confirm_events;
 } tx_global;
 
 extern tx_global globals;
index bea0d5a84685de6b4474fc4614288510feb21f81..0106da3e9b4e644cca952eee9aa7bc7cdc404858 100644 (file)
@@ -648,7 +648,7 @@ int  vtt_class :: load_all_10(FILE* input, char *fname)
                gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
        }
        
-       sequencer.delete_all_events();
+       sequencer.delete_all_events(tX_sequencer::DELETE_ALL);
        
        ld_destroy();
        
@@ -908,7 +908,7 @@ void tX_sequencer :: load(FILE *in)
        guint32 i;
        tX_event *new_event=NULL;
        
-       delete_all_events();
+       delete_all_events(tX_sequencer::DELETE_ALL);
        
        fread ((void *) &event_count, sizeof(event_count), 1, in);
        
index 1c6b19e07fa5d7c3daff9a7bb93d3506d159863f..65b7e75df4b52976e64138d564a12fdce8023553 100644 (file)
@@ -42,6 +42,8 @@
 #include "tX_sequencer.h"
 #include "tX_mastergui.h"
 #include "tX_knobloader.h"
+#include "tX_glade_interface.h"
+#include "tX_glade_support.h"
 #include <sys/time.h>
 #include <sys/wait.h>
 
@@ -127,6 +129,9 @@ vtt_class *old_focus=NULL;
 int grab_status=0;
 int last_grab_status=0;
 
+GtkWidget *delete_all_item=NULL;
+GtkWidget *delete_all_vtt_item=NULL;
+
 GtkTooltips *gui_tooltips=NULL;
 
 void gui_set_tooltip(GtkWidget *wid, char *tip)
@@ -578,6 +583,9 @@ void mg_enable_critical_buttons(int enable)
        gtk_widget_set_sensitive(seq_slider, enable);
 
        gtk_widget_set_sensitive(rec_menu_item, enable);
+       gtk_widget_set_sensitive(delete_all_item, enable);
+       gtk_widget_set_sensitive(delete_all_vtt_item, enable);
+       
        vg_enable_critical_buttons(enable);
 }
 
@@ -892,7 +900,112 @@ void fullscreen_toggle(GtkCheckMenuItem *item, gpointer data);
 void display_help();
 void display_browser();
 
-void create_master_menu() {
+tX_seqpar *del_sp=NULL;
+vtt_class *del_vtt=NULL;
+tx_menu_del_mode menu_del_mode=ALL_EVENTS_ALL_TURNTABLES;
+
+GtkWidget *del_dialog=NULL;
+
+GCallback menu_delete_all_events(GtkWidget *, void *param)
+{      
+       del_dialog=create_tx_del_mode();
+       GtkWidget *label=lookup_widget(del_dialog, "delmode_label");
+       
+       menu_del_mode=ALL_EVENTS_ALL_TURNTABLES;
+       
+       gtk_label_set_markup(GTK_LABEL(label), "Delete <b>all</b> events for <b>all</b> turntables.");
+       gtk_widget_show(del_dialog);
+}
+
+GCallback menu_delete_all_events_for_vtt(GtkWidget *, vtt_class *vtt)
+{      
+       if (!vtt) {
+               tX_error("No vtt passed to menu_delete_all_events_for_vtt().");
+               return FALSE;
+       }
+       
+       char label_str[512];
+       
+       del_dialog=create_tx_del_mode();
+       del_vtt=vtt;
+       GtkWidget *label=lookup_widget(del_dialog, "delmode_label");
+       
+       menu_del_mode=ALL_EVENTS_FOR_TURNTABLE;
+       
+       sprintf(label_str, "Delete <b>all</b> events for turntable <b>%s</b> turntables.", vtt->name);
+       gtk_label_set_markup(GTK_LABEL(label), label_str);
+       gtk_widget_show(del_dialog);
+}
+
+GCallback menu_delete_all_events_for_sp(GtkWidget *, tX_seqpar *sp)
+{      
+       if (!sp) {
+               tX_error("No sp passed to menu_delete_all_events_for_sp().");
+               return FALSE;
+       }
+       
+       char label_str[512];
+       
+       del_dialog=create_tx_del_mode();
+       GtkWidget *label=lookup_widget(del_dialog, "delmode_label");
+       
+       menu_del_mode=ALL_EVENTS_FOR_SP;
+       del_sp=sp;
+       sprintf(label_str, "Delete all <b>%s</b> events for turntable <b>%s</b> turntables.", sp->get_name(), ((vtt_class *) sp->vtt)->name);
+       gtk_label_set_markup(GTK_LABEL(label), label_str);
+       gtk_widget_show(del_dialog);
+}
+
+static GtkWidget *table_menu=NULL;
+static GtkWidget *table_menu_item=NULL;
+
+GCallback create_table_sequencer_menu(GtkWidget *widget, void *param) 
+{
+       char label[328];
+       table_menu=gtk_menu_new();
+       
+       list <vtt_class *> :: iterator vtt;
+
+       for (vtt=vtt_class::main_list.begin(); vtt!=vtt_class::main_list.end(); vtt++) {
+               GtkWidget *menu_item=gtk_menu_item_new_with_label((*vtt)->name);
+               gtk_container_add (GTK_CONTAINER (table_menu), menu_item);
+               gtk_widget_show(menu_item);
+               
+               GtkWidget *seqpar_menu=gtk_menu_new();
+               list <tX_seqpar *> :: iterator sp;
+               
+               GtkWidget *all=gtk_menu_item_new_with_label("Delete All Events");
+               gtk_container_add (GTK_CONTAINER (seqpar_menu), all);
+               g_signal_connect(all, "activate", (GCallback) menu_delete_all_events_for_vtt, (*vtt));
+               gtk_widget_show(all);
+
+               GtkWidget *sep = gtk_menu_item_new ();
+               gtk_widget_show(sep);
+               gtk_container_add(GTK_CONTAINER (seqpar_menu), sep);
+               gtk_widget_set_sensitive (sep, FALSE);
+               
+               for (sp=tX_seqpar::all.begin(); sp!=tX_seqpar::all.end(); sp++) {
+                       if ((*sp)->vtt==(*vtt)) {
+                               sprintf(label, "Delete '%s' Events", (*sp)->get_name());
+                               GtkWidget *menu_item=gtk_menu_item_new_with_label(label);
+                               g_signal_connect(menu_item, "activate", (GCallback) menu_delete_all_events_for_sp, (*sp));
+                               gtk_container_add(GTK_CONTAINER(seqpar_menu), menu_item);
+                               gtk_widget_show(menu_item);
+                       }
+               }
+               gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), seqpar_menu);
+       }
+       
+       gtk_menu_item_set_submenu(GTK_MENU_ITEM(table_menu_item), table_menu);
+}
+
+GCallback toggle_confirm_events(GtkWidget *widget, void *dummy)
+{      
+       globals.confirm_events=gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
+}
+
+void create_master_menu() 
+{
        GtkWidget *menu_item;
        GtkWidget *sub_menu;
        GtkAccelGroup* accel_group=gtk_accel_group_new();
@@ -956,6 +1069,43 @@ void create_master_menu() {
        gtk_container_add (GTK_CONTAINER (sub_menu), menu_item);
        g_signal_connect(menu_item, "activate", (GCallback) tape_on, NULL);
 
+       /* Sequencer */
+       
+       menu_item = gtk_menu_item_new_with_mnemonic("_Sequencer");
+       gtk_widget_show (menu_item);
+       gtk_container_add (GTK_CONTAINER (main_menubar), menu_item);
+
+       sub_menu = gtk_menu_new ();
+       gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), sub_menu);
+               
+       table_menu = gtk_menu_new();
+       menu_item = gtk_menu_item_new_with_mnemonic("Delete _Events");
+       delete_all_vtt_item = menu_item;
+       table_menu_item = menu_item;
+       gtk_menu_item_set_submenu(GTK_MENU_ITEM(table_menu_item), table_menu);
+       
+       gtk_widget_show (menu_item);
+       gtk_container_add (GTK_CONTAINER (sub_menu), menu_item);
+       g_signal_connect_swapped (G_OBJECT (menu_item), "select", G_CALLBACK (create_table_sequencer_menu), NULL);
+       
+       menu_item = gtk_menu_item_new_with_mnemonic("Delete _All Events");
+       delete_all_item = menu_item;
+       gtk_widget_show (menu_item);
+       gtk_container_add (GTK_CONTAINER (sub_menu), menu_item);
+       g_signal_connect(menu_item, "activate", (GCallback) menu_delete_all_events, NULL);
+
+       menu_item = gtk_menu_item_new ();
+       gtk_widget_show (menu_item);
+       gtk_container_add (GTK_CONTAINER (sub_menu), menu_item);
+       gtk_widget_set_sensitive (menu_item, FALSE);
+
+       menu_item = gtk_check_menu_item_new_with_mnemonic("_Confirm Recorded Events");
+       //rec_menu_item = menu_item;
+       gtk_widget_show (menu_item);
+       gtk_container_add (GTK_CONTAINER (sub_menu), menu_item);
+       gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_item), globals.confirm_events);
+       g_signal_connect(menu_item, "activate", (GCallback) toggle_confirm_events, NULL);
+
        /* Options */
        menu_item = gtk_menu_item_new_with_mnemonic ("_Options");
        gtk_widget_show (menu_item);
index 3f02bb953bffdcb717cf73a51489f47f17b8f59d..5b39ad9befe6e50d85f93f0468ee52326dcedde2 100644 (file)
@@ -60,6 +60,17 @@ extern GtkWidget *panel_bar;
 void add_to_panel_bar(GtkWidget *);
 void remove_from_panel_bar(GtkWidget *);
 
+typedef enum {
+       ALL_EVENTS_ALL_TURNTABLES,
+       ALL_EVENTS_FOR_TURNTABLE,
+       ALL_EVENTS_FOR_SP
+} tx_menu_del_mode;
+
+extern GtkWidget *del_dialog;
+extern tx_menu_del_mode menu_del_mode;
+extern tX_seqpar *del_sp;
+extern vtt_class *del_vtt;
+
 class tX_cursor {
        public:
        enum cursor_shape {
index a0bd0218adfd266d9c6d2d3d765d0bb62bd828e5..946397aec2ecc15376fbc365ed87454f51f76f12 100644 (file)
@@ -122,7 +122,7 @@ tX_seqpar :: ~tX_seqpar()
        pthread_mutex_lock(&update_lock);
        update.remove(this);
        pthread_mutex_unlock(&update_lock);
-       sequencer.delete_all_events_for_sp(this);
+       sequencer.delete_all_events_for_sp(this, tX_sequencer::DELETE_ALL);
        all.remove(this);
 }
 
index af69bcb3af6df98181c9b4bf2e8c059dc457e03f..8d7e4e4c304242e466d54abad31688b7099a1165 100644 (file)
@@ -78,7 +78,6 @@ tX_event *tX_sequencer :: record_event (tX_seqpar *sp, float value)
 
 int tX_sequencer :: trig_rec()
 {
-       //set_timestamp(0);
        record_start_timestamp=start_timestamp;
 
        mode = TX_SEQMODE_PLAYREC;
@@ -87,12 +86,10 @@ int tX_sequencer :: trig_rec()
 
 int tX_sequencer :: trig_play()
 {
-//     set_timestamp(0);
        run=1;
        return 1;
 }
 
-
 //#define SEQ_DEBUG 1
 //#define SEQ_DEBUG_MAX 1
 
@@ -107,7 +104,8 @@ void tX_sequencer :: trig_stop()
 
        mode = TX_SEQMODE_PLAYONLY;
        run=0;
-
+       int confirm=GTK_RESPONSE_YES;
+       
        record_stop_timestamp=current_timestamp;
        
        if (oldmode==TX_SEQMODE_PLAYREC)
@@ -116,57 +114,66 @@ void tX_sequencer :: trig_stop()
 #ifdef SEQ_DEBUG               
                printf ("Recorded from %i to %i.\n", record_start_timestamp, record_stop_timestamp);
                printf ("* Song: %i events, Recorded: %i events, sum=%i\n", song_list.size(), record_list.size(), song_list.size() + record_list.size());
-#endif         
-               /* removing all events for touched parameters in song_list */
-               
-               song_event=song_list.begin();
-
-               while ((song_event!=song_list.end()) && ((*song_event)->get_timestamp() < record_start_timestamp))
-                       song_event++;
+#endif 
 
-               while ((song_event!=song_list.end()) && ((*song_event)->get_timestamp() <= record_stop_timestamp))
-               {
-                       sp = (*song_event)->get_sp();
-#ifdef SEQ_DEBUG_MAX                   
-                       printf("sp %08x (%i) touched at: %i - timestamp %i.\n", sp, sp->is_touched(), sp->get_touch_timestamp(), (*song_event)->get_timestamp());
-#endif                 
-                       
-                       if (sp->is_touched() && (sp->get_touch_timestamp()<= (*song_event)->get_timestamp()))
-                       {
-                               temp_song_event=song_event;
-                               song_event++;
-                               delete (*temp_song_event);
-                               song_list.erase(temp_song_event);
-                       }
-                       else
-                       {
-                               song_event++;
-                       }
+               if (globals.confirm_events) {
+                       GtkWidget *dialog=gtk_message_dialog_new(GTK_WINDOW(main_window), 
+                                                               GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
+                                                               "Apply all events recorded with this take?");
+       
+                       confirm=gtk_dialog_run(GTK_DIALOG(dialog));
+                       gtk_widget_destroy(dialog);
                }
-
-               /* inserting all recorded events into song_list */
-                                       
-               for (record_event=record_list.begin(), song_event=song_list.begin(); record_event != record_list.end();)
-               {
-                       if (song_event==song_list.end())
-                       {
-                               song_list.insert(song_event, record_event, record_list.end());
-                               break;
-                       }
+               
+               if (confirm==GTK_RESPONSE_YES) {
+                       /* The user wants to keep the recorded events... */
+                       
+                       /* removing all events for touched parameters in song_list */
                        
-                       if ((*song_event)->get_timestamp() >= (*record_event)->get_timestamp())
+                       song_event=song_list.begin();
+       
+                       while ((song_event!=song_list.end()) && ((*song_event)->get_timestamp() < record_start_timestamp))
+                               song_event++;
+       
+                       while ((song_event!=song_list.end()) && ((*song_event)->get_timestamp() <= record_stop_timestamp))
                        {
-/*                             if (song_event==song_list.begin()) song_list.push_front((*record_event));
-                               else */
-                               song_list.insert(song_event, (*record_event));                          
-                               record_event++;
+                               sp = (*song_event)->get_sp();
+#ifdef SEQ_DEBUG_MAX                   
+                               printf("sp %08x (%i) touched at: %i - timestamp %i.\n", sp, sp->is_touched(), sp->get_touch_timestamp(), (*song_event)->get_timestamp());
+#endif                 
+                               
+                               if (sp->is_touched() && (sp->get_touch_timestamp()<= (*song_event)->get_timestamp())) {
+                                       temp_song_event=song_event;
+                                       song_event++;
+                                       delete (*temp_song_event);
+                                       song_list.erase(temp_song_event);
+                               } else {
+                                       song_event++;
+                               }
                        }
-                       else 
-                       {
-                               song_event++;
+       
+                       /* inserting all recorded events into song_list */
+                                               
+                       for (record_event=record_list.begin(), song_event=song_list.begin(); record_event != record_list.end();) {
+                               if (song_event==song_list.end()) {
+                                       song_list.insert(song_event, record_event, record_list.end());
+                                       break;
+                               }
+                               
+                               if ((*song_event)->get_timestamp() >= (*record_event)->get_timestamp()) {
+                                       song_list.insert(song_event, (*record_event));                          
+                                       record_event++;
+                               } else {
+                                       song_event++;
+                               }
+                       }               
+               } else {
+                       /* The user wants to drop the events from this take */
+                       for (record_event=record_list.begin(); record_event!=record_list.end(); record_event++) {
+                               delete (*record_event);
                        }
                }
-//             swap(song_list, record_list);
+               
                record_list.erase(record_list.begin(), record_list.end());      
 
 #ifdef SEQ_DEBUG               
@@ -199,47 +206,60 @@ void tX_sequencer :: trig_stop()
        seq_update();
 }
 
-void tX_sequencer :: delete_all_events() {
-       while (song_list.size()) {
-               list <tX_event *> :: iterator ev=song_list.begin();
-               delete (*ev);
-               song_list.erase(ev);
+void tX_sequencer :: delete_all_events(del_mode mode)
+{
+       list <tX_event *> :: iterator song_event;
+       list <tX_event *> :: iterator temp_song_event;
+       
+       for (song_event=song_list.begin(); song_event!=song_list.end();) {
+               if (((mode==DELETE_ALL) || 
+                       ((mode==DELETE_UPTO_CURRENT) && ((*song_event)->get_timestamp()<current_timestamp)) ||
+                       ((mode==DELETE_FROM_CURRENT) && ((*song_event)->get_timestamp()>=current_timestamp))))
+               {
+                       temp_song_event=song_event;
+                       song_event++;
+                       delete (*temp_song_event);
+                       song_list.erase(temp_song_event);
+               } else {
+                       song_event++;
+               }
        }
-
+       
        start_timestamp=0;
        current_timestamp=0;
        max_timestamp=0;
 }
 
-void tX_sequencer :: delete_all_events_for_sp(tX_seqpar *sp)
+void tX_sequencer :: delete_all_events_for_vtt(vtt_class *vtt, del_mode mode)
+{
+       list <tX_seqpar *> :: iterator sp;
+       
+       for (sp=tX_seqpar::all.begin(); sp!=tX_seqpar::all.end(); sp++) {
+               if ((*sp)->vtt==vtt) {
+                       delete_all_events_for_sp((*sp), mode);
+               }
+       }
+}
+
+void tX_sequencer :: delete_all_events_for_sp(tX_seqpar *sp, del_mode mode)
 {
        list <tX_event *> :: iterator song_event;
        list <tX_event *> :: iterator temp_song_event;
        
-#ifdef SEQ_DEBUG
-       int ctr=0;
-#endif         
-       
-       for (song_event=song_list.begin(); song_event!=song_list.end();)
-       {
-               if (sp == (*song_event)->get_sp())
+       for (song_event=song_list.begin(); song_event!=song_list.end();) {
+               if ((sp == (*song_event)->get_sp()) &&
+                       ((mode==DELETE_ALL) || 
+                       ((mode==DELETE_UPTO_CURRENT) && ((*song_event)->get_timestamp()<current_timestamp)) ||
+                       ((mode==DELETE_FROM_CURRENT) && ((*song_event)->get_timestamp()>=current_timestamp))))
                {
                        temp_song_event=song_event;
                        song_event++;
                        delete (*temp_song_event);
                        song_list.erase(temp_song_event);
-#ifdef SEQ_DEBUG
-                       ctr++;
-#endif                 
-               }
-               else
-               {
+               } else {
                        song_event++;
                }
        }
-#ifdef SEQ_DEBUG
-       printf ("removed %i events for seqpar %08x.\n", ctr, sp);
-#endif                         
 }
 
 void tX_sequencer :: save(FILE *rc, gzFile rz, char *indent) {
index 66d4eea88c393ed50d2c24b254b3ae83bb6a8e8b..f1548416821f90a50178fb0c86cd079ee847e731 100644 (file)
 
 class tX_sequencer
 {
+       public:
+       typedef enum {
+               DELETE_ALL,
+               DELETE_UPTO_CURRENT,
+               DELETE_FROM_CURRENT
+       } del_mode;
+       
        private:
        list <tX_event *> song_list;
        list <tX_event *> record_list;
@@ -79,8 +86,9 @@ class tX_sequencer
                else return NULL;
        }
        
-       void delete_all_events_for_sp(tX_seqpar *sp);
-       void delete_all_events();
+       void delete_all_events_for_vtt(vtt_class *vtt, del_mode mode);
+       void delete_all_events_for_sp(tX_seqpar *sp, del_mode mode);
+       void delete_all_events(del_mode);
        
        void save(FILE *, gzFile, char *indent);
 #ifdef ENABLE_TX_LEGACY        
index fc36a12e05142c3fd0d4b64b83548e0b65cb294a..1b52252ecf2631caebb5adb7770f1ab2774c2e5e 100644 (file)
@@ -1610,7 +1610,7 @@ void vtt_class :: delete_all()
        }
        
        /* Take care of the master events.. */
-       sequencer.delete_all_events();
+       sequencer.delete_all_events(tX_sequencer::DELETE_ALL);
        
        /* Now reset master settings ot the default: */
        set_master_pitch(1.0);
index b9d55e349d362a99395cabaf1fe6af20651ce4c2..93a29ffc8c517f9d1ac8276dfb170310dd43d34d 100644 (file)
   </child>
 </widget>
 
+<widget class="GtkDialog" id="tx_del_mode">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">Choose Events to Delete</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="has_separator">True</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox4">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child internal-child="action_area">
+       <widget class="GtkHButtonBox" id="dialog-action_area4">
+         <property name="visible">True</property>
+         <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+         <child>
+           <widget class="GtkButton" id="cancelbutton1">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-cancel</property>
+             <property name="use_stock">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="response_id">-6</property>
+             <signal name="clicked" handler="on_del_mode_cancel_clicked" last_modification_time="Sun, 18 May 2003 12:09:20 GMT"/>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="okbutton1">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-ok</property>
+             <property name="use_stock">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="response_id">-5</property>
+             <signal name="clicked" handler="on_del_mode_ok_clicked" last_modification_time="Sun, 18 May 2003 12:09:35 GMT"/>
+           </widget>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">True</property>
+         <property name="pack_type">GTK_PACK_END</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkVBox" id="vbox2">
+         <property name="border_width">4</property>
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">2</property>
+
+         <child>
+           <widget class="GtkLabel" id="delmode_label">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Select which events to delete.</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkHBox" id="hbox3">
+             <property name="visible">True</property>
+             <property name="homogeneous">False</property>
+             <property name="spacing">0</property>
+
+             <child>
+               <widget class="GtkVBox" id="vbox3">
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">0</property>
+
+                 <child>
+                   <widget class="GtkRadioButton" id="all_events">
+                     <property name="visible">True</property>
+                     <property name="can_focus">True</property>
+                     <property name="label" translatable="yes">Complete song</property>
+                     <property name="use_underline">True</property>
+                     <property name="relief">GTK_RELIEF_NORMAL</property>
+                     <property name="active">False</property>
+                     <property name="inconsistent">False</property>
+                     <property name="draw_indicator">True</property>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkRadioButton" id="upto_current">
+                     <property name="visible">True</property>
+                     <property name="can_focus">True</property>
+                     <property name="label" translatable="yes">Upto the current song position</property>
+                     <property name="use_underline">True</property>
+                     <property name="relief">GTK_RELIEF_NORMAL</property>
+                     <property name="active">False</property>
+                     <property name="inconsistent">False</property>
+                     <property name="draw_indicator">True</property>
+                     <property name="group">all_events</property>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkRadioButton" id="from_current">
+                     <property name="visible">True</property>
+                     <property name="can_focus">True</property>
+                     <property name="label" translatable="yes">From the current song position</property>
+                     <property name="use_underline">True</property>
+                     <property name="relief">GTK_RELIEF_NORMAL</property>
+                     <property name="active">False</property>
+                     <property name="inconsistent">False</property>
+                     <property name="draw_indicator">True</property>
+                     <property name="group">all_events</property>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">True</property>
+                 <property name="fill">False</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
 </glade-interface>