show playhead on all export report widgets
This commit is contained in:
parent
f23bb163a8
commit
1e2299b254
|
@ -78,6 +78,8 @@ ExportReport::ExportReport (Session* session, StatusPtr s)
|
||||||
std::string path = i->first;
|
std::string path = i->first;
|
||||||
ExportAnalysisPtr p = i->second;
|
ExportAnalysisPtr p = i->second;
|
||||||
|
|
||||||
|
std::list<CimgArea*> playhead_widgets;
|
||||||
|
|
||||||
l = manage (new Label (_("File:"), ALIGN_END));
|
l = manage (new Label (_("File:"), ALIGN_END));
|
||||||
t->attach (*l, 0, 1, 0, 1);
|
t->attach (*l, 0, 1, 0, 1);
|
||||||
l = manage (new Label ());
|
l = manage (new Label ());
|
||||||
|
@ -499,6 +501,9 @@ ExportReport::ExportReport (Session* session, StatusPtr s)
|
||||||
|
|
||||||
wave->flush ();
|
wave->flush ();
|
||||||
CimgArea *wv = manage (new CimgArea (wave));
|
CimgArea *wv = manage (new CimgArea (wave));
|
||||||
|
wv->set_audition_axis (m_l, width);
|
||||||
|
playhead_widgets.push_back (wv);
|
||||||
|
wv->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
|
||||||
vb->pack_start (*wv);
|
vb->pack_start (*wv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,12 +558,10 @@ ExportReport::ExportReport (Session* session, StatusPtr s)
|
||||||
|
|
||||||
ytme->flush ();
|
ytme->flush ();
|
||||||
CimgArea *tm = manage (new CimgArea (ytme));
|
CimgArea *tm = manage (new CimgArea (ytme));
|
||||||
tm->set_audition_axis (m_l, width);
|
tm->set_audition_axis (m_l, width, true);
|
||||||
|
playhead_widgets.push_back (tm);
|
||||||
tm->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
|
tm->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
|
||||||
timeline.push_back (tm);
|
|
||||||
vb->pack_start (*tm);
|
vb->pack_start (*tm);
|
||||||
} else {
|
|
||||||
timeline.push_back (0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -614,9 +617,13 @@ ExportReport::ExportReport (Session* session, StatusPtr s)
|
||||||
|
|
||||||
spec->flush ();
|
spec->flush ();
|
||||||
CimgArea *sp = manage (new CimgArea (spec));
|
CimgArea *sp = manage (new CimgArea (spec));
|
||||||
|
sp->set_audition_axis (m_l, width);
|
||||||
|
playhead_widgets.push_back (sp);
|
||||||
|
sp->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
|
||||||
vb->pack_start (*sp);
|
vb->pack_start (*sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timeline[page] = playhead_widgets;
|
||||||
pages.pages ().push_back (Notebook_Helpers::TabElem (*vb, Glib::path_get_basename (i->first)));
|
pages.pages ().push_back (Notebook_Helpers::TabElem (*vb, Glib::path_get_basename (i->first)));
|
||||||
pages.signal_switch_page().connect (sigc::mem_fun (*this, &ExportReport::on_switch_page));
|
pages.signal_switch_page().connect (sigc::mem_fun (*this, &ExportReport::on_switch_page));
|
||||||
}
|
}
|
||||||
|
@ -670,8 +677,11 @@ ExportReport::audition_active (bool active)
|
||||||
{
|
{
|
||||||
stop_btn->set_sensitive (active);
|
stop_btn->set_sensitive (active);
|
||||||
if (!active && _audition_num == _page_num) {
|
if (!active && _audition_num == _page_num) {
|
||||||
assert (timeline[_audition_num]);
|
for (std::list<CimgArea*>::const_iterator i = timeline[_audition_num].begin();
|
||||||
timeline[_audition_num]->set_playhead (-1);
|
i != timeline[_audition_num].end();
|
||||||
|
++i) {
|
||||||
|
(*i)->set_playhead (-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -742,8 +752,11 @@ void
|
||||||
ExportReport::stop_audition ()
|
ExportReport::stop_audition ()
|
||||||
{
|
{
|
||||||
if (_audition_num == _page_num) {
|
if (_audition_num == _page_num) {
|
||||||
assert (timeline[_audition_num]);
|
for (std::list<CimgArea*>::const_iterator i = timeline[_audition_num].begin();
|
||||||
timeline[_audition_num]->set_playhead (-1);
|
i != timeline[_audition_num].end();
|
||||||
|
++i) {
|
||||||
|
(*i)->set_playhead (-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (_session) {
|
if (_session) {
|
||||||
_session->cancel_audition();
|
_session->cancel_audition();
|
||||||
|
@ -755,8 +768,11 @@ void
|
||||||
ExportReport::on_switch_page (GtkNotebookPage*, guint page_num)
|
ExportReport::on_switch_page (GtkNotebookPage*, guint page_num)
|
||||||
{
|
{
|
||||||
if (_audition_num == _page_num) {
|
if (_audition_num == _page_num) {
|
||||||
assert (timeline[_audition_num]);
|
for (std::list<CimgArea*>::const_iterator i = timeline[_audition_num].begin();
|
||||||
timeline[_audition_num]->set_playhead (-1);
|
i != timeline[_audition_num].end();
|
||||||
|
++i) {
|
||||||
|
(*i)->set_playhead (-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_page_num = page_num;
|
_page_num = page_num;
|
||||||
}
|
}
|
||||||
|
@ -765,8 +781,12 @@ void
|
||||||
ExportReport::audition_progress (framecnt_t pos, framecnt_t len)
|
ExportReport::audition_progress (framecnt_t pos, framecnt_t len)
|
||||||
{
|
{
|
||||||
if (_audition_num == _page_num) {
|
if (_audition_num == _page_num) {
|
||||||
assert (timeline[_audition_num]);
|
const float p = (float)pos / len;
|
||||||
timeline[_audition_num]->set_playhead ((float)pos / len);
|
for (std::list<CimgArea*>::const_iterator i = timeline[_audition_num].begin();
|
||||||
|
i != timeline[_audition_num].end();
|
||||||
|
++i) {
|
||||||
|
(*i)->set_playhead (p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ public:
|
||||||
, _playhead(-1)
|
, _playhead(-1)
|
||||||
, _x0 (0)
|
, _x0 (0)
|
||||||
, _aw (0)
|
, _aw (0)
|
||||||
|
, _highlight (false)
|
||||||
{
|
{
|
||||||
set_size_request (sf->get_width (), sf->get_height ());
|
set_size_request (sf->get_width (), sf->get_height ());
|
||||||
}
|
}
|
||||||
|
@ -48,9 +49,11 @@ public:
|
||||||
cairo_paint (cr);
|
cairo_paint (cr);
|
||||||
|
|
||||||
if (_playhead > 0 && _playhead < 1.0 && _aw > 0) {
|
if (_playhead > 0 && _playhead < 1.0 && _aw > 0) {
|
||||||
cairo_rectangle (cr, _x0, 0, _aw, _surface->get_height());
|
if (_highlight) {
|
||||||
cairo_set_source_rgba (cr, .4, .4, .6, .4);
|
cairo_rectangle (cr, _x0, 0, _aw, _surface->get_height());
|
||||||
cairo_fill (cr);
|
cairo_set_source_rgba (cr, .4, .4, .6, .4);
|
||||||
|
cairo_fill (cr);
|
||||||
|
}
|
||||||
|
|
||||||
const float x = _playhead * _aw;
|
const float x = _playhead * _aw;
|
||||||
const float h = _surface->get_height();
|
const float h = _surface->get_height();
|
||||||
|
@ -75,9 +78,10 @@ public:
|
||||||
_playhead = pos;
|
_playhead = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_audition_axis (float x0, float w) {
|
void set_audition_axis (float x0, float w, bool h = false) {
|
||||||
_x0 = x0;
|
_x0 = x0;
|
||||||
_aw = w;
|
_aw = w;
|
||||||
|
_highlight = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
sigc::signal<void, float> seek_playhead;
|
sigc::signal<void, float> seek_playhead;
|
||||||
|
@ -95,6 +99,7 @@ private:
|
||||||
Cairo::RefPtr<Cairo::ImageSurface> _surface;
|
Cairo::RefPtr<Cairo::ImageSurface> _surface;
|
||||||
float _playhead;
|
float _playhead;
|
||||||
float _x0, _aw;
|
float _x0, _aw;
|
||||||
|
bool _highlight;
|
||||||
|
|
||||||
void invalidate (float pos) {
|
void invalidate (float pos) {
|
||||||
if (pos < 0 || pos > 1) { return; }
|
if (pos < 0 || pos > 1) { return; }
|
||||||
|
@ -130,7 +135,7 @@ private:
|
||||||
Gtk::Button* stop_btn;
|
Gtk::Button* stop_btn;
|
||||||
PBD::ScopedConnectionList auditioner_connections;
|
PBD::ScopedConnectionList auditioner_connections;
|
||||||
|
|
||||||
std::vector<CimgArea*> timeline;
|
std::map<int, std::list<CimgArea*> > timeline;
|
||||||
int _audition_num;
|
int _audition_num;
|
||||||
int _page_num;
|
int _page_num;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user