From 14bf40cfe3b2cba29ea21eefb3025f4c347c2203 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 15 Feb 2016 19:12:46 +0100 Subject: more Export Report GUI tweaks: * properly indent y-axis labels * show N/A if EBU-R128 is not available (mono/stereo only) --- gtk2_ardour/export_report.cc | 97 ++++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 45 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/export_report.cc b/gtk2_ardour/export_report.cc index c639db7b6e..4741070d1c 100644 --- a/gtk2_ardour/export_report.cc +++ b/gtk2_ardour/export_report.cc @@ -346,64 +346,71 @@ ExportReport::ExportReport (Session* session, StatusPtr s) cr->set_line_width (1.0); if (p->loudness_hist_max > 0 && i->second->have_loudness) { + // draw data for (size_t x = 0 ; x < 510; ++x) { cr->move_to (x - .5, hh); cr->line_to (x - .5, (float) hh * (1.0 - p->loudness_hist[x] / (float) p->loudness_hist_max)); cr->stroke (); } - } else { - // TODO print "Not Avail" - } - layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ()); - layout->set_alignment (Pango::ALIGN_CENTER); - - // Label - layout->set_text (_("LUFS\n(short)")); - layout->get_pixel_size (w, h); - Gtkmm2ext::rounded_rectangle (cr, 5, rint (.5 * (hh - w) - 1), h + 2, w + 2, 4); - cr->set_source_rgba (.1, .1, .1, 0.7); - cr->fill (); - cr->save (); - cr->move_to (6, rint (.5 * (hh + w))); - cr->set_source_rgba (.9, .9, .9, 1.0); - cr->rotate (M_PI / -2.0); - layout->show_in_cairo_context (cr); - cr->restore (); + layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ()); + layout->set_alignment (Pango::ALIGN_CENTER); - // x-Axis - layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ()); - layout->set_alignment (Pango::ALIGN_LEFT); - for (int g = -53; g <= -8; g += 5) { - // grid-lines. [110] -59LUFS .. [650]: -5 LUFS - layout->set_text (string_compose ("%1", std::setw(3), std::setfill(' '), g)); + // y-axis label + layout->set_text (_("LUFS\n(short)")); layout->get_pixel_size (w, h); - - cr->set_operator (Cairo::OPERATOR_OVER); - Gtkmm2ext::rounded_rectangle (cr, - rint ((g + 59.0) * 10.0 - h * .5), 5, - h + 2, w + 2, 4); - const float pk = (g + 59.0) / 54.0; - ArdourCanvas::Color c = ArdourCanvas::hsva_to_color (252 - 260 * pk, .9, .3 + pk * .4, .6); - ArdourCanvas::set_source_rgba (cr, c); + Gtkmm2ext::rounded_rectangle (cr, 5, rint (.5 * (hh - w) - 1), h + 2, w + 2, 4); + cr->set_source_rgba (.1, .1, .1, 0.7); cr->fill (); - cr->save (); + cr->move_to (6, rint (.5 * (hh + w))); cr->set_source_rgba (.9, .9, .9, 1.0); - cr->move_to (rint ((g + 59.0) * 10.0 - h * .5), w + 6.0); cr->rotate (M_PI / -2.0); layout->show_in_cairo_context (cr); cr->restore (); - cr->set_operator (Cairo::OPERATOR_ADD); - cr->save (); - cr->set_source_rgba (.3, .3, .3, 1.0); - cr->set_dash (dashes, 1.0); - cr->set_line_cap (Cairo::LINE_CAP_ROUND); - cr->move_to (rint ((g + 59.0) * 10.0) + .5, w + 8.0); - cr->line_to (rint ((g + 59.0) * 10.0) + .5, hh); - cr->stroke (); - cr->restore (); + // x-Axis labels + layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ()); + layout->set_alignment (Pango::ALIGN_LEFT); + for (int g = -53; g <= -8; g += 5) { + // grid-lines. [110] -59LUFS .. [650]: -5 LUFS + layout->set_text (string_compose ("%1", std::setw(3), std::setfill(' '), g)); + layout->get_pixel_size (w, h); + + cr->set_operator (Cairo::OPERATOR_OVER); + Gtkmm2ext::rounded_rectangle (cr, + rint ((g + 59.0) * 10.0 - h * .5), 5, + h + 2, w + 2, 4); + const float pk = (g + 59.0) / 54.0; + ArdourCanvas::Color c = ArdourCanvas::hsva_to_color (252 - 260 * pk, .9, .3 + pk * .4, .6); + ArdourCanvas::set_source_rgba (cr, c); + cr->fill (); + + cr->save (); + cr->set_source_rgba (.9, .9, .9, 1.0); + cr->move_to (rint ((g + 59.0) * 10.0 - h * .5), w + 6.0); + cr->rotate (M_PI / -2.0); + layout->show_in_cairo_context (cr); + cr->restore (); + + cr->set_operator (Cairo::OPERATOR_ADD); + cr->save (); + cr->set_source_rgba (.3, .3, .3, 1.0); + cr->set_dash (dashes, 1.0); + cr->set_line_cap (Cairo::LINE_CAP_ROUND); + cr->move_to (rint ((g + 59.0) * 10.0) + .5, w + 8.0); + cr->line_to (rint ((g + 59.0) * 10.0) + .5, hh); + cr->stroke (); + cr->restore (); + } + + } else { + layout->set_alignment (Pango::ALIGN_CENTER); + layout->set_font_description (UIConfiguration::instance ().get_LargeFont ()); + layout->set_text (_("Not\nAvailable")); + layout->get_pixel_size (w, h); + cr->move_to (rint ((510 - w) * .5), rint ((hh - h) * .5)); + layout->show_in_cairo_context (cr); } // add normalization gain factor here (for want of a better place) @@ -534,7 +541,7 @@ ExportReport::ExportReport (Session* session, StatusPtr s) layout->set_text (_("Time")); cr->set_source_rgba (.9, .9, .9, 1.0); layout->get_pixel_size (w, h); - cr->move_to (rint (m_l - w - anw - 2), rint (.5 * (height - h))); + cr->move_to (rint (m_l - w - 8), rint (.5 * (height - h))); layout->show_in_cairo_context (cr); ytme->flush (); @@ -576,7 +583,7 @@ ExportReport::ExportReport (Session* session, StatusPtr s) layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ()); layout->set_text (_("Hz")); layout->get_pixel_size (w, h); - cr->move_to (rint (m_l - h - anw - 2), rint ((height + w) * .5)); + cr->move_to (rint (m_l - h - anw - 10), rint ((height + w) * .5)); cr->set_source_rgba (.9, .9, .9, 1.0); cr->save (); cr->rotate (M_PI / -2.0); -- cgit v1.2.3