From 6b641cdde4fa01baa1bf03e69131bd2b1a81b67b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 3 Aug 2010 21:50:15 +0000 Subject: [PATCH] properly track step edit status in editor & mixer windows git-svn-id: svn://localhost/ardour2/branches/3.0@7533 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/midi_time_axis.cc | 20 ++----------- gtk2_ardour/midi_time_axis.h | 9 +++--- gtk2_ardour/route_ui.cc | 54 ++++++++++++++++++++++++++++------- gtk2_ardour/route_ui.h | 6 ++-- gtk2_ardour/step_entry.cc | 2 -- 5 files changed, 54 insertions(+), 37 deletions(-) diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 098b96b5b2..bc36d6fbe8 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -891,20 +891,6 @@ MidiTimeAxisView::route_active_changed () } } -void -MidiTimeAxisView::toggle_step_edit () -{ - if (_route->record_enabled()) { - return; - } - - if (midi_track()->step_editing ()) { - stop_step_editing (); - } else { - start_step_editing (); - } -} - void MidiTimeAxisView::start_step_editing () { @@ -923,7 +909,6 @@ MidiTimeAxisView::start_step_editing () step_edit_region_view = 0; } - midi_track()->set_step_editing (true); if (step_editor == 0) { step_editor = new StepEntry (*this); @@ -937,15 +922,14 @@ MidiTimeAxisView::start_step_editing () bool MidiTimeAxisView::step_editor_hidden (GdkEventAny*) { - stop_step_editing (); + /* everything else will follow the change in the model */ + midi_track()->set_step_editing (false); return true; } void MidiTimeAxisView::stop_step_editing () { - midi_track()->set_step_editing (false); - if (step_editor) { step_editor->hide (); } diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h index abe5218be3..12ca3a9bfe 100644 --- a/gtk2_ardour/midi_time_axis.h +++ b/gtk2_ardour/midi_time_axis.h @@ -87,9 +87,6 @@ class MidiTimeAxisView : public RouteTimeAxisView return _midi_patch_settings_changed; } - void toggle_step_edit (); - void start_step_editing (); - void stop_step_editing (); void check_step_edit (); void step_edit_rest (); int step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, @@ -102,7 +99,11 @@ class MidiTimeAxisView : public RouteTimeAxisView const MidiMultipleChannelSelector& channel_selector() { return _channel_selector; } Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter); - + + protected: + void start_step_editing (); + void stop_step_editing (); + private: sigc::signal _midi_patch_settings_changed; diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 6e9f5a73d1..1cbdadbe05 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -589,23 +589,32 @@ RouteUI::build_record_menu () /* no rec-button context menu for non-MIDI tracks */ - if (!is_midi_track()) { - return; + if (is_midi_track()) { + record_menu = new Menu; + record_menu->set_name ("ArdourContextMenu"); + + using namespace Menu_Helpers; + MenuList& items = record_menu->items(); + + items.push_back (CheckMenuElem (_("Step Edit"), sigc::mem_fun (*this, &RouteUI::toggle_step_edit))); + step_edit_item = dynamic_cast (&items.back()); + + if (_route->record_enabled()) { + step_edit_item->set_sensitive (false); + } + + step_edit_item->set_active (midi_track()->step_editing()); } - - record_menu = new Menu; - record_menu->set_name ("ArdourContextMenu"); - - using namespace Menu_Helpers; - MenuList& items = record_menu->items(); - - items.push_back (CheckMenuElem (_("Step Edit"), sigc::mem_fun (*this, &RouteUI::toggle_step_edit))); - step_edit_item = dynamic_cast (&items.back()); } void RouteUI::toggle_step_edit () { + if (!is_midi_track() || _route->record_enabled()) { + return; + } + + midi_track()->set_step_editing (step_edit_item->get_active()); } void @@ -615,10 +624,24 @@ RouteUI::step_edit_changed (bool yn) if (rec_enable_button) { rec_enable_button->set_visual_state (3); } + + start_step_editing (); + + if (step_edit_item) { + step_edit_item->set_active (true); + } + } else { + if (rec_enable_button) { rec_enable_button->set_visual_state (0); } + + stop_step_editing (); + + if (step_edit_item) { + step_edit_item->set_active (false); + } } } @@ -1020,9 +1043,18 @@ RouteUI::update_rec_display () } + if (step_edit_item) { + step_edit_item->set_sensitive (false); + } + } else { rec_enable_button->set_visual_state (0); + + if (step_edit_item) { + step_edit_item->set_sensitive (true); + } } + check_rec_enable_sensitivity (); } diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 8d819de505..4f7aaddea5 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -184,9 +184,9 @@ class RouteUI : public virtual AxisView void build_record_menu (); Gtk::CheckMenuItem *step_edit_item; - virtual void toggle_step_edit (); + void toggle_step_edit (); virtual void step_edit_changed (bool); - + virtual void polarity_changed (); Gtk::CheckMenuItem *denormal_menu_item; @@ -221,6 +221,8 @@ class RouteUI : public virtual AxisView void reset (); void self_delete (); + virtual void start_step_editing () {} + virtual void stop_step_editing() {} private: void check_rec_enable_sensitivity (); diff --git a/gtk2_ardour/step_entry.cc b/gtk2_ardour/step_entry.cc index f585cba057..18fa5c7730 100644 --- a/gtk2_ardour/step_entry.cc +++ b/gtk2_ardour/step_entry.cc @@ -173,8 +173,6 @@ StepEntry::StepEntry (MidiTimeAxisView& mtv) upper_box.pack_start (channel_spinner, false, false); _piano = (PianoKeyboard*) piano_keyboard_new (); - piano_keyboard_set_keyboard_cue (PIANO_KEYBOARD(_piano), 1); - piano = Glib::wrap ((GtkWidget*) _piano); piano->set_flags (Gtk::CAN_FOCUS);