diff options
author | Carl Hetherington <carl@carlh.net> | 2011-04-16 13:31:27 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-04-16 13:31:27 +0000 |
commit | cb643ab9652d08a85802ce2a94c5bd57ca31256e (patch) | |
tree | 33bdd943f82f03af5e91f79a435213081c7fbeb1 /gtk2_ardour | |
parent | 443c51fee23855c709c83e016a80895e4e2dc0c7 (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')
-rw-r--r-- | gtk2_ardour/midi_streamview.cc | 38 | ||||
-rw-r--r-- | gtk2_ardour/midi_streamview.h | 6 | ||||
-rw-r--r-- | gtk2_ardour/midi_time_axis.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/piano_roll_header.cc | 7 |
4 files changed, 44 insertions, 11 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 (); +} diff --git a/gtk2_ardour/midi_streamview.h b/gtk2_ardour/midi_streamview.h index a939d8ea7d..aceb59e69f 100644 --- a/gtk2_ardour/midi_streamview.h +++ b/gtk2_ardour/midi_streamview.h @@ -97,6 +97,9 @@ class MidiStreamView : public StreamView void apply_note_range(uint8_t lowest, uint8_t highest, bool to_region_views); + void suspend_updates (); + void resume_updates (); + private: void setup_rec_box (); void update_rec_box (); @@ -118,6 +121,7 @@ class MidiStreamView : public StreamView void color_handler (); void note_range_adjustment_changed(); + void apply_note_range_to_regions (); bool _range_dirty; double _range_sum_cache; @@ -126,6 +130,8 @@ class MidiStreamView : public StreamView uint8_t _data_note_min; ///< in data uint8_t _data_note_max; ///< in data ArdourCanvas::LineSet* _note_lines; + /** true if updates to the note lines and regions are currently suspended */ + bool _updates_suspended; }; #endif /* __ardour_midi_streamview_h__ */ diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index bf0adfd361..2f809ce2e1 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -154,6 +154,10 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess, _range_scroomer = new MidiScroomer(midi_view()->note_range_adjustment); + /* Suspend updates of the StreamView during scroomer drags to speed things up */ + _range_scroomer->DragStarting.connect (sigc::mem_fun (*midi_view(), &MidiStreamView::suspend_updates)); + _range_scroomer->DragFinishing.connect (sigc::mem_fun (*midi_view(), &MidiStreamView::resume_updates)); + controls_hbox.pack_start(*_range_scroomer); controls_hbox.pack_start(*_piano_roll_header); diff --git a/gtk2_ardour/piano_roll_header.cc b/gtk2_ardour/piano_roll_header.cc index 28398678a1..4bb8250fea 100644 --- a/gtk2_ardour/piano_roll_header.cc +++ b/gtk2_ardour/piano_roll_header.cc @@ -587,14 +587,7 @@ void PianoRollHeader::note_range_changed() { _note_height = floor(_view.note_height()) + 0.5f; - queue_draw(); - - Glib::RefPtr<Gdk::Window> win = get_window(); - - if (win) { - win->process_updates(false); - } } void |