diff options
author | David Robillard <d@drobilla.net> | 2013-01-20 08:56:00 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-01-20 08:56:00 +0000 |
commit | 4e6d0c9e61b62931a4a2120b548f0ff02a966351 (patch) | |
tree | 17c395d18338fb92d7af62fa635a8e957d523f93 /gtk2_ardour/midi_time_axis.cc | |
parent | 0ebad4279b765d3fbe85649e9ef29e5b61c1d162 (diff) |
Show matching controller name in automation lane header.
Completely eliminate static MIDI controller name code.
Reduce dependency on midnam_patch.h (which would have saved me several hours if I did it earlier).
Store controller name numbers as an integer.
Keep controller names in a map keyed by int instead of a list for fast lookup.
More cleanup of MIDI::Name code.
git-svn-id: svn://localhost/ardour2/branches/3.0@13927 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/midi_time_axis.cc')
-rw-r--r-- | gtk2_ardour/midi_time_axis.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 9d96ca756f..2b42d65a73 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -55,8 +55,6 @@ #include "ardour/track.h" #include "ardour/types.h" -#include "midi++/names.h" - #include "ardour_ui.h" #include "ardour_button.h" #include "automation_line.h" @@ -829,14 +827,17 @@ MidiTimeAxisView::build_controller_menu () /* Controllers names available in midnam file, generate fancy menu */ unsigned n_items = 0; unsigned n_groups = 0; + + /* TODO: This is not correct, should look up the currently applicable ControlNameList + and only build a menu for that one. */ for (MasterDeviceNames::ControlNameLists::const_iterator l = device_names->controls().begin(); l != device_names->controls().end(); ++l) { - boost::shared_ptr<ControlNameList> name_list = *l; + boost::shared_ptr<ControlNameList> name_list = l->second; Menu* ctl_menu = NULL; - for (ControlNameList::Controls::const_iterator c = (*l)->controls().begin(); - c != (*l)->controls().end(); ++c) { - const int ctl = atoi((*c)->number().c_str()); + for (ControlNameList::Controls::const_iterator c = name_list->controls().begin(); + c != name_list->controls().end(); ++c) { + const uint16_t ctl = c->second->number(); if (ctl == MIDI_CTL_MSB_BANK || ctl == MIDI_CTL_LSB_BANK) { /* Skip bank select controllers since they're handled specially */ continue; @@ -849,12 +850,12 @@ MidiTimeAxisView::build_controller_menu () MenuList& ctl_items (ctl_menu->items()); if (chn_cnt > 1) { - add_multi_channel_controller_item(ctl_items, ctl, (*c)->name()); + add_multi_channel_controller_item(ctl_items, ctl, c->second->name()); } else { - add_single_channel_controller_item(ctl_items, ctl, (*c)->name()); + add_single_channel_controller_item(ctl_items, ctl, c->second->name()); } - if (++n_items == 16 || c == (*l)->controls().end()) { + if (++n_items == 16 || c == name_list->controls().end()) { /* Submenu has 16 items, add it to controller menu and reset */ items.push_back( MenuElem(string_compose(_("Controllers %1-%2"), |