+void
+MidiRegionView::velocity_edit ()
+{
+ if (_selection.empty()) {
+ return;
+ }
+
+ /* pick a note somewhat at random (since Selection is a set<>) to
+ * provide the "current" velocity for the dialog.
+ */
+
+ uint8_t current_velocity = (*_selection.begin())->note()->velocity ();
+ MidiVelocityDialog velocity_dialog (current_velocity);
+ int ret = velocity_dialog.run ();
+
+ switch (ret) {
+ case Gtk::RESPONSE_OK:
+ break;
+ default:
+ return;
+ }
+
+ uint8_t new_velocity = velocity_dialog.velocity ();
+
+ start_note_diff_command (_("velocity edit"));
+
+ for (Selection::iterator i = _selection.begin(); i != _selection.end(); ) {
+ Selection::iterator next = i;
+ ++next;
+ change_note_velocity (*i, new_velocity, false);
+ i = next;
+ }
+
+ apply_diff ();
+}
+