X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fautomation_line.cc;h=6586aed966350a0fa79a5765784c4aea4e8d73e4;hb=0532e2063b73ec32d4dd108b58e90a0f20ae91b3;hp=4a21e7905a3dc51eef7e4fd7a8e02f9271e23546;hpb=b04cd7d7045dd40a1e3ae819ad3a2f9bb08a01f1;p=ardour.git diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 4a21e7905a..6586aed966 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -28,6 +28,8 @@ #include "ardour/automation_list.h" #include "ardour/dB.h" +#include "ardour/debug.h" + #include "evoral/Curve.hpp" #include "simplerect.h" @@ -79,6 +81,7 @@ AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanv _visible = Line; update_pending = false; + have_timeout = false; _uses_gain_mapping = false; no_draw = false; _is_boolean = false; @@ -123,15 +126,6 @@ AutomationLine::event_handler (GdkEvent* event) return PublicEditor::instance().canvas_line_event (event, line, this); } -void -AutomationLine::queue_reset () -{ - if (!update_pending) { - update_pending = true; - Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&AutomationLine::reset, this)); - } -} - void AutomationLine::show () { @@ -829,7 +823,12 @@ void AutomationLine::set_colors () void AutomationLine::list_changed () { - queue_reset (); + DEBUG_TRACE (DEBUG::Automation, string_compose ("\tline changed, existing update pending? %1\n", update_pending)); + + if (!update_pending) { + update_pending = true; + Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&AutomationLine::queue_reset, this)); + } } void @@ -936,7 +935,9 @@ AutomationLine::reset_callback (const Evoral::ControlList& events) void AutomationLine::reset () { + DEBUG_TRACE (DEBUG::Automation, "\t\tLINE RESET\n"); update_pending = false; + have_timeout = false; if (no_draw) { return; @@ -945,6 +946,27 @@ AutomationLine::reset () alist->apply_to_points (*this, &AutomationLine::reset_callback); } +void +AutomationLine::queue_reset () +{ + /* this must be called from the GUI thread + */ + + if (trackview.editor().session()->transport_rolling() && alist->automation_write()) { + /* automation write pass ... defer to a timeout */ + /* redraw in 1/4 second */ + if (!have_timeout) { + DEBUG_TRACE (DEBUG::Automation, "\tqueue timeout\n"); + Glib::signal_timeout().connect (sigc::bind_return (sigc::mem_fun (*this, &AutomationLine::reset), false), 250); + have_timeout = true; + } else { + DEBUG_TRACE (DEBUG::Automation, "\ttimeout already queued, change ignored\n"); + } + } else { + reset (); + } +} + void AutomationLine::clear () {