From 25b4913c78cd5a0d44ca594ac604d01da8fdd112 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 14 Aug 2011 18:40:57 +0000 Subject: [PATCH] Save position of MIDI scroomers (#4140). git-svn-id: svn://localhost/ardour2/branches/3.0@9993 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/midi_streamview.cc | 6 ------ gtk2_ardour/midi_time_axis.cc | 11 +++++++++++ gtk2_ardour/midi_time_axis.h | 1 + 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index 79b30502b8..9c109c2c21 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -275,12 +275,6 @@ MidiStreamView::redisplay_track () _data_note_max = 71; } - // Extend visible range to show newly recorded data, if necessary - _lowest_note = std::min(_lowest_note, _data_note_min); - _highest_note = std::max(_highest_note, _data_note_max); - - veto_note_range(_lowest_note, _highest_note); - // Flag region views as invalid and disable drawing for (i = region_views.begin(); i != region_views.end(); ++i) { (*i)->set_valid(false); diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 0adb02725f..63f92f71b0 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -127,6 +127,10 @@ MidiTimeAxisView::set_route (boost::shared_ptr rt) subplugin_menu.set_name ("ArdourContextMenu"); _view = new MidiStreamView (*this); + 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()), true); + } + midi_view()->NoteRangeChanged.connect (sigc::mem_fun (*this, &MidiTimeAxisView::note_range_changed)); ignore_toggle = false; @@ -1163,3 +1167,10 @@ MidiTimeAxisView::get_channel_for_add () const return channel; } + +void +MidiTimeAxisView::note_range_changed () +{ + set_gui_property ("note-range-min", (int) midi_view()->lowest_note ()); + set_gui_property ("note-range-max", (int) midi_view()->highest_note ()); +} diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h index 8c4aee65c1..b3c916ea69 100644 --- a/gtk2_ardour/midi_time_axis.h +++ b/gtk2_ardour/midi_time_axis.h @@ -122,6 +122,7 @@ class MidiTimeAxisView : public RouteTimeAxisView void set_note_range(MidiStreamView::VisibleNoteRange range); void route_active_changed (); + void note_range_changed (); bool _ignore_signals; MidiScroomer* _range_scroomer;