refine ExportReport:

* combined Logscale/Rectified buttons
* use "Lg", "Rf" labels for now
* fix some layout bugs
This commit is contained in:
Robin Gareus 2016-02-15 17:37:51 +01:00
parent 7e59435ee8
commit 92875bbf07
2 changed files with 39 additions and 17 deletions

View File

@ -415,11 +415,11 @@ ExportReport::ExportReport (Session* session, StatusPtr s)
layout->get_pixel_size (w, h);
cr->set_operator (Cairo::OPERATOR_OVER);
layout->get_pixel_size (w, h);
Gtkmm2ext::rounded_rectangle (cr, 5, rint (.5 * (hh - w) - 1), h + 2, w + 2, 4);
Gtkmm2ext::rounded_rectangle (cr, 5, hh - h - 4, w + 2, h + 2, 4);
cr->set_source_rgba (.1, .1, .1, 0.7);
cr->fill ();
cr->set_source_rgba (.3, .7, .3, 1.0);
cr->move_to (6, hh - h - 2);
cr->move_to (6, hh - h - 3);
layout->show_in_cairo_context (cr);
}
@ -453,6 +453,19 @@ ExportReport::ExportReport (Session* session, StatusPtr s)
cr->stroke (); \
}
{
VBox *lrb = manage (new VBox());
ToggleButton *log = manage (new ToggleButton (S_("Logscale|Lg")));
ToggleButton *rec = manage (new ToggleButton (S_("Rectified|Rf")));
lrb->pack_start (*log, false, false, 5);
lrb->pack_end (*rec, false, false, 5);
log->signal_toggled ().connect (sigc::bind (sigc::mem_fun (*this, &ExportReport::on_logscale_toggled), log));
rec->signal_toggled ().connect (sigc::bind (sigc::mem_fun (*this, &ExportReport::on_rectivied_toggled), rec));
lrb->show_all ();
wtbl->attach (*lrb, 1, 2, wrow, wrow + p->n_channels, SHRINK, SHRINK);
}
for (uint32_t c = 0; c < p->n_channels; ++c) {
/* draw waveform */
const size_t width = sizeof (p->peaks) / sizeof (ARDOUR::PeakData::PeakDatum) / 4;
@ -469,19 +482,9 @@ ExportReport::ExportReport (Session* session, StatusPtr s)
CimgWaveArea *wv = manage (new CimgWaveArea (wave, wave_log, wave_rect, wave_lr, m_l, width));
playhead_widgets.push_back (wv);
waves.push_back (wv);
wv->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
VBox *lrb = manage (new VBox());
ToggleButton *log = manage (new ToggleButton (S_("Logscale|L")));
ToggleButton *rec = manage (new ToggleButton (S_("Rectified|R")));
lrb->pack_start (*log, false, false, 5);
lrb->pack_end (*rec, false, false, 5);
log->signal_toggled ().connect (sigc::bind (sigc::mem_fun (wv, &CimgWaveArea::set_logscale), log));
rec->signal_toggled ().connect (sigc::bind (sigc::mem_fun (wv, &CimgWaveArea::set_rectified), rec));
lrb->show_all ();
wtbl->attach (*wv, 0, 1, wrow, wrow + 1, SHRINK, SHRINK);
wtbl->attach (*lrb, 1, 2, wrow, wrow + 1, SHRINK, SHRINK);
++wrow;
}
@ -864,6 +867,24 @@ ExportReport::audition_seek (int page, float pos)
}
}
void
ExportReport::on_logscale_toggled (Gtk::ToggleButton* b)
{
bool en = b->get_active ();
for (std::list<CimgWaveArea*>::iterator i = waves.begin (); i != waves.end (); ++i) {
(*i)->set_logscale (en);
}
}
void
ExportReport::on_rectivied_toggled (Gtk::ToggleButton* b)
{
bool en = b->get_active ();
for (std::list<CimgWaveArea*>::iterator i = waves.begin (); i != waves.end (); ++i) {
(*i)->set_rectified (en);
}
}
void
ExportReport::draw_waveform (Cairo::RefPtr<Cairo::ImageSurface>& wave, ExportAnalysisPtr p, uint32_t c, int m_l, size_t width, int anw, int height, bool log, bool rect)
{

View File

@ -147,14 +147,12 @@ public:
{
}
void set_logscale (Gtk::ToggleButton *b) {
bool en = b->get_active ();
void set_logscale (bool en) {
_logscale = en;
set_dirty ();
}
void set_rectified (Gtk::ToggleButton *b) {
bool en = b->get_active ();
void set_rectified (bool en) {
_rectified = en;
set_dirty ();
}
@ -202,6 +200,8 @@ private:
void audition_seek (int, float);
void audition_progress (ARDOUR::framecnt_t, ARDOUR::framecnt_t);
void on_switch_page (GtkNotebookPage*, guint page_num);
void on_logscale_toggled (Gtk::ToggleButton*);
void on_rectivied_toggled (Gtk::ToggleButton*);
StatusPtr status;
Gtk::Notebook pages;
@ -219,6 +219,7 @@ private:
std::map<int, std::list<CimgPlayheadArea*> > timeline;
std::map<int, AuditionInfo> files;
std::list<CimgWaveArea*> waves;
int _audition_num;
int _page_num;