mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-11 00:56:33 +01:00
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
This commit is contained in:
parent
443c51fee2
commit
cb643ab965
6 changed files with 49 additions and 37 deletions
|
|
@ -65,6 +65,7 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv)
|
||||||
, _data_note_min(60)
|
, _data_note_min(60)
|
||||||
, _data_note_max(71)
|
, _data_note_max(71)
|
||||||
, _note_lines (0)
|
, _note_lines (0)
|
||||||
|
, _updates_suspended (false)
|
||||||
{
|
{
|
||||||
/* use a group dedicated to MIDI underlays. Audio underlays are not in this group. */
|
/* use a group dedicated to MIDI underlays. Audio underlays are not in this group. */
|
||||||
midi_underlay_group = new ArdourCanvas::Group (*_canvas_group);
|
midi_underlay_group = new ArdourCanvas::Group (*_canvas_group);
|
||||||
|
|
@ -310,7 +311,7 @@ MidiStreamView::update_contents_height ()
|
||||||
void
|
void
|
||||||
MidiStreamView::draw_note_lines()
|
MidiStreamView::draw_note_lines()
|
||||||
{
|
{
|
||||||
if (!_note_lines) {
|
if (!_note_lines || _updates_suspended) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -405,12 +406,20 @@ MidiStreamView::apply_note_range(uint8_t lowest, uint8_t highest, bool to_region
|
||||||
draw_note_lines();
|
draw_note_lines();
|
||||||
|
|
||||||
if (to_region_views) {
|
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) {
|
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
|
||||||
((MidiRegionView*)(*i))->apply_note_range(_lowest_note, _highest_note);
|
((MidiRegionView*)(*i))->apply_note_range(_lowest_note, _highest_note);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NoteRangeChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -649,3 +658,24 @@ MidiStreamView::y_to_note (double y) const
|
||||||
|
|
||||||
return n;
|
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 ();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,9 @@ class MidiStreamView : public StreamView
|
||||||
|
|
||||||
void apply_note_range(uint8_t lowest, uint8_t highest, bool to_region_views);
|
void apply_note_range(uint8_t lowest, uint8_t highest, bool to_region_views);
|
||||||
|
|
||||||
|
void suspend_updates ();
|
||||||
|
void resume_updates ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setup_rec_box ();
|
void setup_rec_box ();
|
||||||
void update_rec_box ();
|
void update_rec_box ();
|
||||||
|
|
@ -118,6 +121,7 @@ class MidiStreamView : public StreamView
|
||||||
void color_handler ();
|
void color_handler ();
|
||||||
|
|
||||||
void note_range_adjustment_changed();
|
void note_range_adjustment_changed();
|
||||||
|
void apply_note_range_to_regions ();
|
||||||
|
|
||||||
bool _range_dirty;
|
bool _range_dirty;
|
||||||
double _range_sum_cache;
|
double _range_sum_cache;
|
||||||
|
|
@ -126,6 +130,8 @@ class MidiStreamView : public StreamView
|
||||||
uint8_t _data_note_min; ///< in data
|
uint8_t _data_note_min; ///< in data
|
||||||
uint8_t _data_note_max; ///< in data
|
uint8_t _data_note_max; ///< in data
|
||||||
ArdourCanvas::LineSet* _note_lines;
|
ArdourCanvas::LineSet* _note_lines;
|
||||||
|
/** true if updates to the note lines and regions are currently suspended */
|
||||||
|
bool _updates_suspended;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __ardour_midi_streamview_h__ */
|
#endif /* __ardour_midi_streamview_h__ */
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,10 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess,
|
||||||
|
|
||||||
_range_scroomer = new MidiScroomer(midi_view()->note_range_adjustment);
|
_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(*_range_scroomer);
|
||||||
controls_hbox.pack_start(*_piano_roll_header);
|
controls_hbox.pack_start(*_piano_roll_header);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -587,14 +587,7 @@ void
|
||||||
PianoRollHeader::note_range_changed()
|
PianoRollHeader::note_range_changed()
|
||||||
{
|
{
|
||||||
_note_height = floor(_view.note_height()) + 0.5f;
|
_note_height = floor(_view.note_height()) + 0.5f;
|
||||||
|
|
||||||
queue_draw();
|
queue_draw();
|
||||||
|
|
||||||
Glib::RefPtr<Gdk::Window> win = get_window();
|
|
||||||
|
|
||||||
if (win) {
|
|
||||||
win->process_updates(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,8 @@ public:
|
||||||
|
|
||||||
inline int position_of(Component comp) { return position[comp]; }
|
inline int position_of(Component comp) { return position[comp]; }
|
||||||
|
|
||||||
// debug
|
sigc::signal0<void> DragStarting;
|
||||||
std::string get_comp_name(Component);
|
sigc::signal0<void> DragFinishing;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Gtk::Adjustment& adj;
|
Gtk::Adjustment& adj;
|
||||||
|
|
|
||||||
|
|
@ -241,6 +241,8 @@ Scroomer::on_button_press_event (GdkEventButton* ev)
|
||||||
} else {
|
} else {
|
||||||
pinch = false;
|
pinch = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DragStarting (); /* EMIT SIGNAL */
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -281,6 +283,7 @@ Scroomer::on_button_release_event (GdkEventButton* ev)
|
||||||
grab_comp = None;
|
grab_comp = None;
|
||||||
|
|
||||||
remove_modal_grab();
|
remove_modal_grab();
|
||||||
|
DragFinishing (); /* EMIT SIGNAL */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -391,29 +394,5 @@ Scroomer::adjustment_changed()
|
||||||
rect.set_height(position[BottomBase] - old_pos[Handle2]);
|
rect.set_height(position[BottomBase] - old_pos[Handle2]);
|
||||||
win->invalidate_rect(rect, false);
|
win->invalidate_rect(rect, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
win->process_updates(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
|
||||||
Scroomer::get_comp_name(Component c)
|
|
||||||
{
|
|
||||||
switch (c) {
|
|
||||||
case TopBase:
|
|
||||||
return "TopBase";
|
|
||||||
case Handle1:
|
|
||||||
return "Handle1";
|
|
||||||
case Slider:
|
|
||||||
return "Slider";
|
|
||||||
case Handle2:
|
|
||||||
return "Handle2";
|
|
||||||
case BottomBase:
|
|
||||||
return "BottomBase";
|
|
||||||
case Total:
|
|
||||||
return "Total";
|
|
||||||
case None:
|
|
||||||
return "None";
|
|
||||||
default:
|
|
||||||
return "ERROR";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue