summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-07-14 18:39:50 +0200
committerRobin Gareus <robin@gareus.org>2019-07-14 18:49:30 +0200
commit53c677e08fffb04897de0a9bb7d9ee0f65ede3f2 (patch)
treede9d4fef4ea7d58a723ba141964086176f4c09ff
parent18958af3d8d9fcda926aee4707da1102a4e2303e (diff)
Remember MIDI-track note-range -- #7773
Previously only manual changes of the note-range using the scroomer. The NoteRangeChanged() was ignored for implicit changes (e.g. while recording, step-entry) and automatic-fit that didn't involve a drag event.
-rw-r--r--gtk2_ardour/midi_streamview.cc4
-rw-r--r--gtk2_ardour/midi_time_axis.cc29
-rw-r--r--gtk2_ardour/midi_time_axis.h2
3 files changed, 11 insertions, 24 deletions
diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc
index 52ac8ff3e7..1495a2898d 100644
--- a/gtk2_ardour/midi_streamview.cc
+++ b/gtk2_ardour/midi_streamview.cc
@@ -212,7 +212,7 @@ MidiStreamView::display_track (boost::shared_ptr<Track> tr)
draw_note_lines();
- NoteRangeChanged();
+ NoteRangeChanged(); /* EMIT SIGNAL*/
}
void
@@ -424,7 +424,7 @@ MidiStreamView::apply_note_range(uint8_t lowest, uint8_t highest, bool to_region
apply_note_range_to_regions ();
}
- NoteRangeChanged();
+ NoteRangeChanged(); /* EMIT SIGNAL*/
}
void
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index e6ad8ec096..0eb6a73001 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -158,6 +158,8 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
subplugin_menu.set_name ("ArdourContextMenu");
+ _note_range_changed_connection.disconnect();
+
if (!gui_property ("note-range-min").empty ()) {
midi_view()->apply_note_range (atoi (gui_property ("note-range-min").c_str()),
atoi (gui_property ("note-range-max").c_str()),
@@ -202,13 +204,6 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
_piano_roll_header->ToggleNoteSelection.connect (
sigc::mem_fun (*this, &MidiTimeAxisView::toggle_note_selection));
- /* Update StreamView during scroomer drags.*/
-
- _range_scroomer->DragStarting.connect (
- sigc::mem_fun (*this, &MidiTimeAxisView::start_scroomer_update));
- _range_scroomer->DragFinishing.connect (
- sigc::mem_fun (*this, &MidiTimeAxisView::stop_scroomer_update));
-
/* Put the scroomer and the keyboard in a VBox with a padding
label so that they can be reduced in height for stacked-view
tracks.
@@ -231,6 +226,13 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
time_axis_hbox.pack_end(*v, false, false, 0);
midi_scroomer_size_group->add_widget (*v);
+ /* callback from StreamView scroomer drags, as well as
+ * automatic changes of note-range (e.g. at rec-stop).
+ * This callback is used to save the note-range-min/max
+ * GUI Object property
+ */
+ _note_range_changed_connection = midi_view()->NoteRangeChanged.connect (
+ sigc::mem_fun (*this, &MidiTimeAxisView::note_range_changed));
/* ask for notifications of any new RegionViews */
_view->RegionViewAdded.connect (
@@ -382,19 +384,6 @@ MidiTimeAxisView::setup_midnam_patches ()
}
void
-MidiTimeAxisView::start_scroomer_update ()
-{
- _note_range_changed_connection.disconnect();
- _note_range_changed_connection = midi_view()->NoteRangeChanged.connect (
- sigc::mem_fun (*this, &MidiTimeAxisView::note_range_changed));
-}
-void
-MidiTimeAxisView::stop_scroomer_update ()
-{
- _note_range_changed_connection.disconnect();
-}
-
-void
MidiTimeAxisView::update_patch_selector ()
{
typedef MIDI::Name::MidiPatchManager PatchManager;
diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h
index 1afac3c9e5..4ca76e37dd 100644
--- a/gtk2_ardour/midi_time_axis.h
+++ b/gtk2_ardour/midi_time_axis.h
@@ -119,8 +119,6 @@ private:
void setup_midnam_patches ();
void update_patch_selector ();
- void start_scroomer_update ();
- void stop_scroomer_update ();
sigc::connection _note_range_changed_connection;
void model_changed(const std::string& model);