+ png_surface = Cairo::ImageSurface::create (Cairo::FORMAT_RGB24, png_w, png_h);
+ Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
+ pcx->set_source_rgb (.2, .2, .2);
+ pcx->paint ();
+
+ if (channels > 0 && file_length > 0 && sample_rate > 0) {
+ png_y0 += 4;
+ // Add file-name, format, duration, sample-rate & timecode
+ pcx->set_source_rgb (.7, .7, .7);
+ layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
+ layout->set_alignment (Pango::ALIGN_LEFT);
+
+#define IMGLABEL(X0, STR, VAL) { \
+ layout->set_text (STR); \
+ pcx->move_to (X0, png_y0); \
+ layout->get_pixel_size (w, h); \
+ layout->show_in_cairo_context (pcx); \
+ layout->set_text (VAL); \
+ pcx->move_to (X0 + w + 2, png_y0); \
+ layout->show_in_cairo_context (pcx); \
+}
+
+ // TODO get max width of labels per column, right-align labels, x-align 1/3, 2/3 columns
+ const int lx0 = m_l;
+ const int lx1 = m_l + png_w * 2 / 3; // right-col is short (channels, SR, duration)
+ std::string sha1sum = ARDOUR::compute_sha1_of_file (path);
+ if (!sha1sum.empty()) {
+ sha1sum = " (sha1: " + sha1sum + ")";
+ }
+
+ IMGLABEL (lx0, _("File:"), Glib::path_get_basename (path) + sha1sum);
+ IMGLABEL (lx1, _("Channels:"), string_compose ("%1", channels));
+ png_y0 += linesp;
+
+ IMGLABEL (lx0, _("Format:"), file_fmt);
+ IMGLABEL (lx1, _("Sample rate:"), string_compose (_("%1 Hz"), sample_rate));
+ png_y0 += linesp;
+
+ if (_session) {
+ Timecode::Time tct;
+ _session->sample_to_timecode (start_off, tct, false, false);
+ IMGLABEL (lx0, _("Timecode:"), Timecode::timecode_format_time (tct));
+ }
+ IMGLABEL (lx1, _("Duration:"), Timecode::timecode_format_sampletime (file_length, sample_rate, 1000, false));
+ png_y0 += linesp;
+ }
+ }