From fc5c247aa152235a749180bd0e86efe0ce32a20a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 13 Feb 2016 13:51:10 +0100 Subject: add post-export audition seeking --- gtk2_ardour/export_report.cc | 9 +++++++++ gtk2_ardour/export_report.h | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/gtk2_ardour/export_report.cc b/gtk2_ardour/export_report.cc index 1f443d1e05..894d12364e 100644 --- a/gtk2_ardour/export_report.cc +++ b/gtk2_ardour/export_report.cc @@ -554,6 +554,7 @@ ExportReport::ExportReport (Session* session, StatusPtr s) ytme->flush (); CimgArea *tm = manage (new CimgArea (ytme)); tm->set_audition_axis (m_l, width); + tm->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page)); timeline.push_back (tm); vb->pack_start (*tm); } else { @@ -764,3 +765,11 @@ ExportReport::audition_progress (framecnt_t pos, framecnt_t len) timeline[_audition_num]->set_playhead ((float)pos / len); } } + +void +ExportReport::audition_seek (int page, float pos) +{ + if (_audition_num == page && _session) { + _session->the_auditioner()->seek_to_percent (100.f * pos); + } +} diff --git a/gtk2_ardour/export_report.h b/gtk2_ardour/export_report.h index ba83343eda..6c4ae28a8c 100644 --- a/gtk2_ardour/export_report.h +++ b/gtk2_ardour/export_report.h @@ -80,6 +80,17 @@ public: _aw = w; } + sigc::signal seek_playhead; + +protected: + bool on_button_press_event (GdkEventButton *ev) { + CairoWidget::on_button_press_event (ev); + if (ev->button == 1 && _aw > 0 && ev->x >= _x0 && ev->x <= _x0 + _aw) { + seek_playhead (((float) ev->x - _x0) / (float)_aw); + } + return true; + } + private: Cairo::RefPtr _surface; float _playhead; @@ -109,6 +120,7 @@ private: void audition (std::string, unsigned int, int); void stop_audition (); void audition_active (bool); + void audition_seek (int, float); void audition_progress (ARDOUR::framecnt_t, ARDOUR::framecnt_t); void on_switch_page (GtkNotebookPage*, guint page_num); -- cgit v1.2.3