summaryrefslogtreecommitdiff
path: root/gtk2_ardour/midi_streamview.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-04-16 13:31:27 +0000
committerCarl Hetherington <carl@carlh.net>2011-04-16 13:31:27 +0000
commitcb643ab9652d08a85802ce2a94c5bd57ca31256e (patch)
tree33bdd943f82f03af5e91f79a435213081c7fbeb1 /gtk2_ardour/midi_streamview.cc
parent443c51fee23855c709c83e016a80895e4e2dc0c7 (diff)
Remove some calls to process_updates() which I think prevent GTK coalescing redraw requests. Remove some debugging code. Suspend update of MIDI regions during scroomer drag to speed things up (#3954).
git-svn-id: svn://localhost/ardour2/branches/3.0@9357 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/midi_streamview.cc')
-rw-r--r--gtk2_ardour/midi_streamview.cc38
1 files changed, 34 insertions, 4 deletions
diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc
index b79a6dc6d0..fd3d5383aa 100644
--- a/gtk2_ardour/midi_streamview.cc
+++ b/gtk2_ardour/midi_streamview.cc
@@ -65,6 +65,7 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv)
, _data_note_min(60)
, _data_note_max(71)
, _note_lines (0)
+ , _updates_suspended (false)
{
/* use a group dedicated to MIDI underlays. Audio underlays are not in this group. */
midi_underlay_group = new ArdourCanvas::Group (*_canvas_group);
@@ -310,7 +311,7 @@ MidiStreamView::update_contents_height ()
void
MidiStreamView::draw_note_lines()
{
- if (!_note_lines) {
+ if (!_note_lines || _updates_suspended) {
return;
}
@@ -371,7 +372,7 @@ MidiStreamView::apply_note_range(uint8_t lowest, uint8_t highest, bool to_region
{
_highest_note = highest;
_lowest_note = lowest;
-
+
int const range = _highest_note - _lowest_note;
int const pixels_per_note = floor (child_height () / range);
@@ -405,12 +406,20 @@ MidiStreamView::apply_note_range(uint8_t lowest, uint8_t highest, bool to_region
draw_note_lines();
if (to_region_views) {
+ apply_note_range_to_regions ();
+ }
+
+ NoteRangeChanged();
+}
+
+void
+MidiStreamView::apply_note_range_to_regions ()
+{
+ if (!_updates_suspended) {
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
((MidiRegionView*)(*i))->apply_note_range(_lowest_note, _highest_note);
}
}
-
- NoteRangeChanged();
}
void
@@ -649,3 +658,24 @@ MidiStreamView::y_to_note (double y) const
return n;
}
+
+/** Suspend updates to the regions' note ranges and our
+ * note lines until resume_updates() is called.
+ */
+void
+MidiStreamView::suspend_updates ()
+{
+ _updates_suspended = true;
+}
+
+/** Resume updates to region note ranges and note lines,
+ * and update them now.
+ */
+void
+MidiStreamView::resume_updates ()
+{
+ _updates_suspended = false;
+
+ draw_note_lines ();
+ apply_note_range_to_regions ();
+}