Fix named controls menu to display all controls (don't miss the last submenu).
authorDavid Robillard <d@drobilla.net>
Sat, 26 Jan 2013 22:08:06 +0000 (22:08 +0000)
committerDavid Robillard <d@drobilla.net>
Sat, 26 Jan 2013 22:08:06 +0000 (22:08 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@14000 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/midi_time_axis.cc

index 2b42d65a73912338dae0e73cb533da7842d6de68..fc87ed89d0f4a3b8ff7a0bf65238028768b2177f 100644 (file)
@@ -217,7 +217,6 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
                }
        }
 
-
        MIDI::Name::MidiPatchManager& patch_manager = MIDI::Name::MidiPatchManager::instance();
 
        MIDI::Name::MasterDeviceNames::Models::const_iterator m = patch_manager.all_models().begin();
@@ -836,10 +835,11 @@ MidiTimeAxisView::build_controller_menu ()
                        Menu*                              ctl_menu  = NULL;
                        
                        for (ControlNameList::Controls::const_iterator c = name_list->controls().begin();
-                            c != name_list->controls().end(); ++c) {
+                            c != name_list->controls().end();) {
                                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 */
+                                       /* FIXME: If this is the last control, the last submenu might be lost */
                                        continue;
                                }
                                
@@ -854,7 +854,8 @@ MidiTimeAxisView::build_controller_menu ()
                                } else {
                                        add_single_channel_controller_item(ctl_items, ctl, c->second->name());
                                }
-                               
+
+                               ++c;
                                if (++n_items == 16 || c == name_list->controls().end()) {
                                        /* Submenu has 16 items, add it to controller menu and reset */
                                        items.push_back(
@@ -1388,7 +1389,6 @@ MidiTimeAxisView::stop_step_editing ()
        }
 }
 
-
 /** @return channel (counted from 0) to add an event to, based on the current setting
  *  of the channel selector.
  */