diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 792f6543cb..c624523dd4 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1180,35 +1180,38 @@ ARDOUR_UI::set_fps_timeout_connection () void ARDOUR_UI::update_sample_rate (samplecnt_t) { - char buf[64]; + std::string heading = string_compose (X_("%1: "), _("Audio")); ENSURE_GUI_THREAD (*this, &ARDOUR_UI::update_sample_rate, ignored) if (!AudioEngine::instance()->running()) { - snprintf (buf, sizeof (buf), "%s", _("Audio: none")); + sample_rate_label.set_markup (heading + _("none")); } else { samplecnt_t rate = AudioEngine::instance()->sample_rate(); if (rate == 0) { + /* no sample rate available */ - snprintf (buf, sizeof (buf), "%s", _("Audio: none")); + sample_rate_label.set_markup (heading + _("none")); + } else { + char buf[64]; if (fmod (rate, 1000.0) != 0.0) { - snprintf (buf, sizeof (buf), _("Audio: %.1f kHz / %4.1f ms"), - (float) rate / 1000.0f, - (AudioEngine::instance()->usecs_per_cycle() / 1000.0f)); + snprintf (buf, sizeof (buf), "%.1f %s / %4.1f %s", + (float) rate / 1000.0f, _("kHz"), + (AudioEngine::instance()->usecs_per_cycle() / 1000.0f), _("ms")); } else { - snprintf (buf, sizeof (buf), _("Audio: %" PRId64 " kHz / %4.1f ms"), - rate/1000, - (AudioEngine::instance()->usecs_per_cycle() / 1000.0f)); + snprintf (buf, sizeof (buf), "%" PRId64 " %s / %4.1f %s", + rate / 1000, _("kHz"), + (AudioEngine::instance()->usecs_per_cycle() / 1000.0f), _("ms")); } + sample_rate_label.set_markup (heading + buf); } } - sample_rate_label.set_markup (buf); } void @@ -1220,7 +1223,7 @@ ARDOUR_UI::update_format () } stringstream s; - s << _("File:") << X_(" "); + s << X_("") << _("File") << X_(": "); switch (_session->config.get_native_file_header_format ()) { case BWF: @@ -1269,8 +1272,6 @@ ARDOUR_UI::update_format () break; } - s << X_(""); - format_label.set_markup (s.str ()); } @@ -1280,28 +1281,29 @@ ARDOUR_UI::update_cpu_load () const unsigned int x = _session ? _session->get_xrun_count () : 0; double const c = AudioEngine::instance()->get_dsp_load (); + std::string heading = string_compose (X_("%1: "), _("DSP")); const char* const bg = c > 90 ? " background=\"red\"" : ""; char buf[64]; if (x > 9999) { - snprintf (buf, sizeof (buf), "DSP: %.0f%% (>10k)", bg, c); + snprintf (buf, sizeof (buf), "%2.0f%% (>10k)", bg, c); } else if (x > 0) { - snprintf (buf, sizeof (buf), "DSP: %.0f%% (%d)", bg, c, x); + snprintf (buf, sizeof (buf), "%2.0f%% (%d)", bg, c, x); } else { - snprintf (buf, sizeof (buf), "DSP: %.0f%%", bg, c); + snprintf (buf, sizeof (buf), "%2.0f%%", bg, c); } - dsp_load_label.set_markup (buf); + dsp_load_label.set_markup (heading + buf); if (x > 9999) { - snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: >10k\n%s"), c, _("Shift+Click to clear xruns.")); + snprintf (buf, sizeof (buf), "%.1f%% X: >10k\n%s", c, _("Shift+Click to clear xruns.")); } else if (x > 0) { - snprintf (buf, sizeof (buf), _("DSP: %.1f%% X: %u\n%s"), c, x, _("Shift+Click to clear xruns.")); + snprintf (buf, sizeof (buf), "%.1f%% X: %u\n%s", c, x, _("Shift+Click to clear xruns.")); } else { - snprintf (buf, sizeof (buf), _("DSP: %.1f%%"), c); + snprintf (buf, sizeof (buf), "%.1f%%", c); } - ArdourWidgets::set_tooltip (dsp_load_label, buf); + ArdourWidgets::set_tooltip (dsp_load_label, heading + buf); } void @@ -1310,8 +1312,10 @@ ARDOUR_UI::update_peak_thread_work () char buf[64]; const int c = SourceFactory::peak_work_queue_length (); if (c > 0) { - snprintf (buf, sizeof (buf), _("PkBld: %d"), c >= 2 ? X_("red") : X_("green"), c); - peak_thread_work_label.set_markup (buf); + std::string heading = string_compose (X_("%1: "), _("PkBld")); + const char* const bg = c > 2 ? " background=\"red\"" : ""; + snprintf (buf, sizeof (buf), "%d", bg, c); + peak_thread_work_label.set_markup (heading + buf); } else { peak_thread_work_label.set_markup (X_("")); } @@ -1344,17 +1348,21 @@ ARDOUR_UI::format_disk_space_label (float remain_sec) snprintf (buf, sizeof(buf), _("%02dh:%02dm:%02ds"), hrs, mins, secs); ArdourWidgets::set_tooltip (disk_space_label, buf); + std::string heading = string_compose (X_("%1: "), _("Rec")); + if (remain_sec > 86400) { - disk_space_label.set_text (_("Rec: >24h")); - return; + disk_space_label.set_markup (_(">24h")); + disk_space_label.set_markup (heading + buf); } else if (remain_sec > 32400 /* 9 hours */) { - snprintf (buf, sizeof (buf), "Rec: %.0fh", remain_sec / 3600.f); + snprintf (buf, sizeof (buf), "%.0f", remain_sec / 3600.f); + disk_space_label.set_markup (heading + buf + S_("hours|h")); } else if (remain_sec > 5940 /* 99 mins */) { - snprintf (buf, sizeof (buf), "Rec: %.1fh", remain_sec / 3600.f); + snprintf (buf, sizeof (buf), "%.1f", remain_sec / 3600.f); + disk_space_label.set_markup (heading + buf + S_("hours|h")); } else { - snprintf (buf, sizeof (buf), "Rec: %.0fm", remain_sec / 60.f); + snprintf (buf, sizeof (buf), "%.0f", remain_sec / 60.f); + disk_space_label.set_markup (heading + buf + S_("minutes|m")); } - disk_space_label.set_text (buf); } @@ -1399,6 +1407,7 @@ void ARDOUR_UI::update_timecode_format () { char buf[64]; + std::string heading = string_compose (X_("%1: "), S_("Timecode|TC")); if (_session) { bool matching; @@ -1411,15 +1420,16 @@ ARDOUR_UI::update_timecode_format () matching = true; } + const char* const bg = matching ? "" : " background=\"red\""; - snprintf (buf, sizeof (buf), S_("Timecode|TC: %s"), - matching ? X_("green") : X_("red"), - Timecode::timecode_format_name (_session->config.get_timecode_format()).c_str()); + snprintf (buf, sizeof (buf), _("%s"), bg, + Timecode::timecode_format_name (_session->config.get_timecode_format()).c_str()); + + timecode_format_label.set_markup (heading + buf); } else { - snprintf (buf, sizeof (buf), "TC: n/a"); + timecode_format_label.set_markup (heading + _("n/a")); } - timecode_format_label.set_markup (buf); } gint diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index a9bb743730..6914d3e115 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -740,12 +740,13 @@ ARDOUR_UI::build_menu_bar () hbox->pack_end (error_alert_button, false, false, 2); hbox->pack_end (wall_clock_label, false, false, 2); - hbox->pack_end (dsp_load_label, false, false, 4); - hbox->pack_end (disk_space_label, false, false, 4); - hbox->pack_end (sample_rate_label, false, false, 4); - hbox->pack_end (timecode_format_label, false, false, 4); - hbox->pack_end (format_label, false, false, 4); - hbox->pack_end (peak_thread_work_label, false, false, 4); + + hbox->pack_end (dsp_load_label, false, false, 6); + hbox->pack_end (disk_space_label, false, false, 6); + hbox->pack_end (sample_rate_label, false, false, 6); + hbox->pack_end (timecode_format_label, false, false, 6); + hbox->pack_end (format_label, false, false, 6); + hbox->pack_end (peak_thread_work_label, false, false, 6); menu_hbox.pack_end (*ev, true, true, 2);