mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +01:00
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
This commit is contained in:
parent
2067937ecf
commit
8dd31447be
5 changed files with 62 additions and 20 deletions
|
|
@ -446,7 +446,7 @@ AudioTimeAxisView::build_automation_action_menu ()
|
||||||
gain_automation_item = dynamic_cast<CheckMenuItem*> (&automation_items.back ());
|
gain_automation_item = dynamic_cast<CheckMenuItem*> (&automation_items.back ());
|
||||||
gain_automation_item->set_active (gain_track->marked_for_display ());
|
gain_automation_item->set_active (gain_track->marked_for_display ());
|
||||||
|
|
||||||
_parameter_menu_map[Evoral::Parameter(GainAutomation)] = gain_automation_item;
|
_main_automation_menu_map[Evoral::Parameter(GainAutomation)] = gain_automation_item;
|
||||||
|
|
||||||
automation_items.push_back (CheckMenuElem (_("Pan"), sigc::mem_fun (*this, &AudioTimeAxisView::update_pan_track_visibility)));
|
automation_items.push_back (CheckMenuElem (_("Pan"), sigc::mem_fun (*this, &AudioTimeAxisView::update_pan_track_visibility)));
|
||||||
pan_automation_item = dynamic_cast<CheckMenuItem*> (&automation_items.back ());
|
pan_automation_item = dynamic_cast<CheckMenuItem*> (&automation_items.back ());
|
||||||
|
|
@ -454,7 +454,7 @@ AudioTimeAxisView::build_automation_action_menu ()
|
||||||
|
|
||||||
set<Evoral::Parameter> const & params = _route->panner()->what_can_be_automated ();
|
set<Evoral::Parameter> const & params = _route->panner()->what_can_be_automated ();
|
||||||
for (set<Evoral::Parameter>::iterator p = params.begin(); p != params.end(); ++p) {
|
for (set<Evoral::Parameter>::iterator p = params.begin(); p != params.end(); ++p) {
|
||||||
_parameter_menu_map[*p] = pan_automation_item;
|
_main_automation_menu_map[*p] = pan_automation_item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -387,6 +387,7 @@ MidiTimeAxisView::build_automation_action_menu ()
|
||||||
detach_menu (*controller_menu);
|
detach_menu (*controller_menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_channel_command_menu_map.clear ();
|
||||||
RouteTimeAxisView::build_automation_action_menu ();
|
RouteTimeAxisView::build_automation_action_menu ();
|
||||||
|
|
||||||
MenuList& automation_items = automation_action_menu->items();
|
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.
|
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, _("Program Change"), MidiPgmChangeAutomation, 0);
|
||||||
add_channel_command_menu_item (automation_items, _("Bender"), MidiPitchBenderAutomation, MIDI_CMD_BENDER);
|
add_channel_command_menu_item (automation_items, _("Bender"), MidiPitchBenderAutomation, 0);
|
||||||
add_channel_command_menu_item (automation_items, _("Pressure"), MidiChannelPressureAutomation, MIDI_CMD_CHANNEL_PRESSURE);
|
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
|
/* 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
|
since it might need to be updated after a channel mode change or other change. Also detach it
|
||||||
|
|
@ -496,7 +497,7 @@ MidiTimeAxisView::add_channel_command_menu_item (Menu_Helpers::MenuList& items,
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&chn_items.back());
|
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);
|
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());
|
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);
|
cmi->set_active (visible);
|
||||||
|
|
||||||
/* one channel only */
|
/* one channel only */
|
||||||
|
|
@ -618,7 +619,7 @@ MidiTimeAxisView::build_controller_menu ()
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&chn_items.back());
|
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);
|
cmi->set_active (visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -649,7 +650,7 @@ MidiTimeAxisView::build_controller_menu ()
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&ctl_items.back());
|
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);
|
cmi->set_active (visible);
|
||||||
|
|
||||||
/* one channel only */
|
/* one channel only */
|
||||||
|
|
@ -791,7 +792,7 @@ MidiTimeAxisView::show_existing_automation ()
|
||||||
RouteTimeAxisView::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
|
void
|
||||||
MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool show)
|
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 */
|
/* TODO: Bender, PgmChange, Pressure */
|
||||||
|
|
||||||
/* invalidate the controller menu, so that we rebuilt it next time */
|
/* invalidate the controller menu, so that we rebuilt it next time */
|
||||||
|
_controller_menu_map.clear ();
|
||||||
delete controller_menu;
|
delete controller_menu;
|
||||||
controller_menu = 0;
|
controller_menu = 0;
|
||||||
|
|
||||||
|
|
@ -1087,3 +1089,24 @@ MidiTimeAxisView::set_channel_mode (ChannelMode, uint16_t)
|
||||||
_route->gui_changed ("track_height", this);
|
_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;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,8 @@ class MidiTimeAxisView : public RouteTimeAxisView
|
||||||
|
|
||||||
const MidiMultipleChannelSelector& channel_selector() { return _channel_selector; }
|
const MidiMultipleChannelSelector& channel_selector() { return _channel_selector; }
|
||||||
|
|
||||||
|
Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
sigc::signal<void, std::string, std::string> _midi_patch_settings_changed;
|
sigc::signal<void, std::string, std::string> _midi_patch_settings_changed;
|
||||||
|
|
||||||
|
|
@ -152,6 +154,11 @@ class MidiTimeAxisView : public RouteTimeAxisView
|
||||||
void add_note_selection_region_view (RegionView* rv, uint8_t note, uint16_t chn_mask);
|
void add_note_selection_region_view (RegionView* rv, uint8_t note, uint16_t chn_mask);
|
||||||
void extend_note_selection_region_view (RegionView*, uint8_t note, uint16_t chn_mask);
|
void extend_note_selection_region_view (RegionView*, uint8_t note, uint16_t chn_mask);
|
||||||
void toggle_note_selection_region_view (RegionView*, uint8_t note, uint16_t chn_mask);
|
void toggle_note_selection_region_view (RegionView*, uint8_t note, uint16_t chn_mask);
|
||||||
|
|
||||||
|
/** parameter -> menu item map for the channel command items */
|
||||||
|
ParameterMenuMap _channel_command_menu_map;
|
||||||
|
/** parameter -> menu item map for the controller menu */
|
||||||
|
ParameterMenuMap _controller_menu_map;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __ardour_midi_time_axis_h__ */
|
#endif /* __ardour_midi_time_axis_h__ */
|
||||||
|
|
|
||||||
|
|
@ -264,6 +264,7 @@ RouteTimeAxisView::post_construct ()
|
||||||
|
|
||||||
update_diskstream_display ();
|
update_diskstream_display ();
|
||||||
|
|
||||||
|
_subplugin_menu_map.clear ();
|
||||||
subplugin_menu.items().clear ();
|
subplugin_menu.items().clear ();
|
||||||
_route->foreach_processor (sigc::mem_fun (*this, &RouteTimeAxisView::add_processor_to_subplugin_menu));
|
_route->foreach_processor (sigc::mem_fun (*this, &RouteTimeAxisView::add_processor_to_subplugin_menu));
|
||||||
_route->foreach_processor (sigc::mem_fun (*this, &RouteTimeAxisView::add_existing_processor_automation_curves));
|
_route->foreach_processor (sigc::mem_fun (*this, &RouteTimeAxisView::add_existing_processor_automation_curves));
|
||||||
|
|
@ -397,6 +398,7 @@ RouteTimeAxisView::build_automation_action_menu ()
|
||||||
|
|
||||||
detach_menu (subplugin_menu);
|
detach_menu (subplugin_menu);
|
||||||
|
|
||||||
|
_main_automation_menu_map.clear ();
|
||||||
delete automation_action_menu;
|
delete automation_action_menu;
|
||||||
automation_action_menu = new Menu;
|
automation_action_menu = new Menu;
|
||||||
|
|
||||||
|
|
@ -1689,8 +1691,9 @@ RouteTimeAxisView::show_existing_automation ()
|
||||||
i->second->get_state_node()->add_property ("shown", X_("yes"));
|
i->second->get_state_node()->add_property ("shown", X_("yes"));
|
||||||
|
|
||||||
Gtk::CheckMenuItem* menu = automation_child_menu_item (i->first);
|
Gtk::CheckMenuItem* menu = automation_child_menu_item (i->first);
|
||||||
assert (menu);
|
if (menu) {
|
||||||
menu->set_active(true);
|
menu->set_active(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2008,7 +2011,7 @@ RouteTimeAxisView::add_processor_to_subplugin_menu (boost::weak_ptr<Processor> p
|
||||||
items.push_back (CheckMenuElem (name));
|
items.push_back (CheckMenuElem (name));
|
||||||
mitem = dynamic_cast<CheckMenuItem*> (&items.back());
|
mitem = dynamic_cast<CheckMenuItem*> (&items.back());
|
||||||
|
|
||||||
_parameter_menu_map[*i] = mitem;
|
_subplugin_menu_map[*i] = mitem;
|
||||||
|
|
||||||
if (has_visible_automation.find((*i)) != has_visible_automation.end()) {
|
if (has_visible_automation.find((*i)) != has_visible_automation.end()) {
|
||||||
mitem->set_active(true);
|
mitem->set_active(true);
|
||||||
|
|
@ -2089,6 +2092,7 @@ RouteTimeAxisView::processors_changed (RouteProcessorChange c)
|
||||||
(*i)->valid = false;
|
(*i)->valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_subplugin_menu_map.clear ();
|
||||||
subplugin_menu.items().clear ();
|
subplugin_menu.items().clear ();
|
||||||
|
|
||||||
_route->foreach_processor (sigc::mem_fun (*this, &RouteTimeAxisView::add_processor_to_subplugin_menu));
|
_route->foreach_processor (sigc::mem_fun (*this, &RouteTimeAxisView::add_processor_to_subplugin_menu));
|
||||||
|
|
@ -2373,10 +2377,15 @@ RouteTimeAxisView::set_button_names ()
|
||||||
Gtk::CheckMenuItem*
|
Gtk::CheckMenuItem*
|
||||||
RouteTimeAxisView::automation_child_menu_item (Evoral::Parameter param)
|
RouteTimeAxisView::automation_child_menu_item (Evoral::Parameter param)
|
||||||
{
|
{
|
||||||
ParameterMenuMap::iterator i = _parameter_menu_map.find (param);
|
ParameterMenuMap::iterator i = _main_automation_menu_map.find (param);
|
||||||
if (i == _parameter_menu_map.end()) {
|
if (i != _main_automation_menu_map.end()) {
|
||||||
return 0;
|
return i->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
return i->second;
|
i = _subplugin_menu_map.find (param);
|
||||||
|
if (i != _subplugin_menu_map.end()) {
|
||||||
|
return i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ public:
|
||||||
AutomationTracks automation_tracks() { return _automation_tracks; }
|
AutomationTracks automation_tracks() { return _automation_tracks; }
|
||||||
|
|
||||||
boost::shared_ptr<AutomationTimeAxisView> automation_child(Evoral::Parameter param);
|
boost::shared_ptr<AutomationTimeAxisView> automation_child(Evoral::Parameter param);
|
||||||
Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
|
virtual Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
|
||||||
|
|
||||||
std::string name() const;
|
std::string name() const;
|
||||||
StreamView* view() const { return _view; }
|
StreamView* view() const { return _view; }
|
||||||
|
|
@ -287,7 +287,10 @@ protected:
|
||||||
|
|
||||||
AutomationTracks _automation_tracks;
|
AutomationTracks _automation_tracks;
|
||||||
typedef std::map<Evoral::Parameter, Gtk::CheckMenuItem*> ParameterMenuMap;
|
typedef std::map<Evoral::Parameter, Gtk::CheckMenuItem*> ParameterMenuMap;
|
||||||
ParameterMenuMap _parameter_menu_map;
|
/** parameter -> menu item map for the main automation menu */
|
||||||
|
ParameterMenuMap _main_automation_menu_map;
|
||||||
|
/** parameter -> menu item map for the plugin automation menu */
|
||||||
|
ParameterMenuMap _subplugin_menu_map;
|
||||||
|
|
||||||
void post_construct ();
|
void post_construct ();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue