diff options
author | Carl Hetherington <carl@carlh.net> | 2010-06-08 21:48:38 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-06-08 21:48:38 +0000 |
commit | 8dd31447be22c20a51f019c8ea77c27ba975815c (patch) | |
tree | e450a2fa5d085a0e396a43ba9a18a4135b3fad6b /gtk2_ardour/midi_time_axis.cc | |
parent | 2067937ecfb9e2db2e22631478c5c4548e0c47c7 (diff) |
Fix handling of the mapping between parameters and automation CheckMenuItems. Should fix #3206, #3215 and the remainder of #3228.
git-svn-id: svn://localhost/ardour2/branches/3.0@7245 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/midi_time_axis.cc')
-rw-r--r-- | gtk2_ardour/midi_time_axis.cc | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index e51699db36..e193f6d425 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -387,6 +387,7 @@ MidiTimeAxisView::build_automation_action_menu () detach_menu (*controller_menu); } + _channel_command_menu_map.clear (); RouteTimeAxisView::build_automation_action_menu (); MenuList& automation_items = automation_action_menu->items(); @@ -403,9 +404,9 @@ MidiTimeAxisView::build_automation_action_menu () something about MIDI (!) would not expect to find them there. */ - add_channel_command_menu_item (automation_items, _("Program Change"), MidiPgmChangeAutomation, MIDI_CMD_PGM_CHANGE); - add_channel_command_menu_item (automation_items, _("Bender"), MidiPitchBenderAutomation, MIDI_CMD_BENDER); - add_channel_command_menu_item (automation_items, _("Pressure"), MidiChannelPressureAutomation, MIDI_CMD_CHANNEL_PRESSURE); + add_channel_command_menu_item (automation_items, _("Program Change"), MidiPgmChangeAutomation, 0); + add_channel_command_menu_item (automation_items, _("Bender"), MidiPitchBenderAutomation, 0); + add_channel_command_menu_item (automation_items, _("Pressure"), MidiChannelPressureAutomation, 0); /* now all MIDI controllers. Always offer the possibility that we will rebuild the controllers menu since it might need to be updated after a channel mode change or other change. Also detach it @@ -494,9 +495,9 @@ MidiTimeAxisView::add_channel_command_menu_item (Menu_Helpers::MenuList& items, visible = true; } } - + CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&chn_items.back()); - _parameter_menu_map[fully_qualified_param] = cmi; + _channel_command_menu_map[fully_qualified_param] = cmi; cmi->set_active (visible); } } @@ -527,7 +528,7 @@ MidiTimeAxisView::add_channel_command_menu_item (Menu_Helpers::MenuList& items, } CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&items.back()); - _parameter_menu_map[fully_qualified_param] = cmi; + _channel_command_menu_map[fully_qualified_param] = cmi; cmi->set_active (visible); /* one channel only */ @@ -618,7 +619,7 @@ MidiTimeAxisView::build_controller_menu () } CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&chn_items.back()); - _parameter_menu_map[fully_qualified_param] = cmi; + _controller_menu_map[fully_qualified_param] = cmi; cmi->set_active (visible); } } @@ -649,7 +650,7 @@ MidiTimeAxisView::build_controller_menu () } CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&ctl_items.back()); - _parameter_menu_map[fully_qualified_param] = cmi; + _controller_menu_map[fully_qualified_param] = cmi; cmi->set_active (visible); /* one channel only */ @@ -791,7 +792,7 @@ MidiTimeAxisView::show_existing_automation () RouteTimeAxisView::show_existing_automation (); } -/** Hide an automation track for the given parameter (pitch bend, channel pressure). +/** Create an automation track for the given parameter (pitch bend, channel pressure). */ void MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool show) @@ -1080,6 +1081,7 @@ MidiTimeAxisView::set_channel_mode (ChannelMode, uint16_t) /* TODO: Bender, PgmChange, Pressure */ /* invalidate the controller menu, so that we rebuilt it next time */ + _controller_menu_map.clear (); delete controller_menu; controller_menu = 0; @@ -1087,3 +1089,24 @@ MidiTimeAxisView::set_channel_mode (ChannelMode, uint16_t) _route->gui_changed ("track_height", this); } } + +Gtk::CheckMenuItem* +MidiTimeAxisView::automation_child_menu_item (Evoral::Parameter param) +{ + Gtk::CheckMenuItem* m = RouteTimeAxisView::automation_child_menu_item (param); + if (m) { + return m; + } + + ParameterMenuMap::iterator i = _controller_menu_map.find (param); + if (i != _controller_menu_map.end()) { + return i->second; + } + + i = _channel_command_menu_map.find (param); + if (i != _channel_command_menu_map.end()) { + return i->second; + } + + return 0; +} |