13
0

properly track step edit status in editor & mixer windows

git-svn-id: svn://localhost/ardour2/branches/3.0@7533 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-08-03 21:50:15 +00:00
parent b1f5a6a68d
commit 6b641cdde4
5 changed files with 54 additions and 37 deletions

View File

@ -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 ();
}

View File

@ -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,
@ -103,6 +100,10 @@ class MidiTimeAxisView : public RouteTimeAxisView
Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
protected:
void start_step_editing ();
void stop_step_editing ();
private:
sigc::signal<void, std::string, std::string> _midi_patch_settings_changed;

View File

@ -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<CheckMenuItem*> (&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<CheckMenuItem*> (&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,10 +1043,19 @@ 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 ();
}

View File

@ -184,7 +184,7 @@ 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 ();
@ -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 ();

View File

@ -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);