Use standard Labels again.
Since the Gauges become little more than text with colored background, prepare their removal. If color is wanted, use named widget-style.
This commit is contained in:
parent
110317aad6
commit
66732e4791
|
@ -79,6 +79,7 @@
|
|||
|
||||
#include "widgets/fastmeter.h"
|
||||
#include "widgets/prompter.h"
|
||||
#include "widgets/tooltips.h"
|
||||
|
||||
#include "ardour/ardour.h"
|
||||
#include "ardour/audio_backend.h"
|
||||
|
@ -583,7 +584,6 @@ ARDOUR_UI::engine_running ()
|
|||
}
|
||||
update_disk_space ();
|
||||
update_cpu_load ();
|
||||
update_xrun_count ();
|
||||
update_sample_rate (AudioEngine::instance()->sample_rate());
|
||||
update_timecode_format ();
|
||||
update_peak_thread_work ();
|
||||
|
@ -1508,8 +1508,6 @@ void
|
|||
ARDOUR_UI::every_second ()
|
||||
{
|
||||
update_cpu_load ();
|
||||
update_xrun_count ();
|
||||
update_buffer_load ();
|
||||
update_disk_space ();
|
||||
update_timecode_format ();
|
||||
update_peak_thread_work ();
|
||||
|
@ -1675,30 +1673,32 @@ ARDOUR_UI::update_format ()
|
|||
format_label.set_markup (s.str ());
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::update_xrun_count ()
|
||||
{
|
||||
/* If this text is changed, the set_size_request_to_display_given_text call in ARDOUR_UI::resize_text_widgets
|
||||
should also be changed.
|
||||
*/
|
||||
|
||||
if (_session) {
|
||||
const unsigned int x = _session->get_xrun_count ();
|
||||
dsp_load_gauge.set_xrun_count (x);
|
||||
} else {
|
||||
dsp_load_gauge.set_xrun_count (UINT_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::update_cpu_load ()
|
||||
{
|
||||
/* If this text is changed, the set_size_request_to_display_given_text call in ARDOUR_UI::resize_text_widgets
|
||||
should also be changed.
|
||||
*/
|
||||
|
||||
const unsigned int x = _session ? _session->get_xrun_count () : 0;
|
||||
double const c = AudioEngine::instance()->get_dsp_load ();
|
||||
dsp_load_gauge.set_dsp_load (c);
|
||||
|
||||
char buf[64];
|
||||
if (x > 9999) {
|
||||
snprintf (buf, sizeof (buf), "DSP: %.0f%% (>10k)", c);
|
||||
} else if (x > 0) {
|
||||
snprintf (buf, sizeof (buf), "DSP: %.0f%% (%d)", c, x);
|
||||
} else {
|
||||
snprintf (buf, sizeof (buf), "DSP: %.0f%%", c);
|
||||
}
|
||||
|
||||
dsp_load_label.set_text (buf);
|
||||
|
||||
if (x > 9999) {
|
||||
snprintf (buf, sizeof (buf), _("DSP: %.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."));
|
||||
} else {
|
||||
snprintf (buf, sizeof (buf), _("DSP: %.1f%%"), c);
|
||||
}
|
||||
|
||||
ArdourWidgets::set_tooltip (dsp_load_label, buf);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1714,14 +1714,6 @@ ARDOUR_UI::update_peak_thread_work ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::update_buffer_load ()
|
||||
{
|
||||
uint32_t const playback = _session ? _session->playback_load () : 100;
|
||||
uint32_t const capture = _session ? _session->capture_load () : 100;
|
||||
disk_io_gauge.set_disk_io(playback, capture);
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::count_recenabled_streams (Route& route)
|
||||
{
|
||||
|
@ -1731,11 +1723,43 @@ ARDOUR_UI::count_recenabled_streams (Route& route)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::format_disk_space_label (float remain_sec)
|
||||
{
|
||||
if (remain_sec < 0) {
|
||||
disk_space_label.set_text (_("N/A"));
|
||||
ArdourWidgets::set_tooltip (disk_space_label, _("Unknown"));
|
||||
return;
|
||||
}
|
||||
|
||||
char buf[64];
|
||||
|
||||
int sec = floor (remain_sec);
|
||||
int hrs = sec / 3600;
|
||||
int mins = (sec / 60) % 60;
|
||||
int secs = sec % 60;
|
||||
snprintf (buf, sizeof(buf), _("%02dh:%02dm:%02ds"), hrs, mins, secs);
|
||||
ArdourWidgets::set_tooltip (disk_space_label, buf);
|
||||
|
||||
if (remain_sec > 86400) {
|
||||
disk_space_label.set_text (_("Rec: >24h"));
|
||||
return;
|
||||
} else if (remain_sec > 32400 /* 9 hours */) {
|
||||
snprintf (buf, sizeof (buf), "Rec: %.0fh", remain_sec / 3600.f);
|
||||
} else if (remain_sec > 5940 /* 99 mins */) {
|
||||
snprintf (buf, sizeof (buf), "Rec: %.1fh", remain_sec / 3600.f);
|
||||
} else {
|
||||
snprintf (buf, sizeof (buf), "Rec: %.0fm", remain_sec / 60.f);
|
||||
}
|
||||
disk_space_label.set_text (buf);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::update_disk_space()
|
||||
{
|
||||
if (_session == 0) {
|
||||
disk_space_gauge.set_available_disk_sec (-1);
|
||||
format_disk_space_label (-1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1744,15 +1768,15 @@ ARDOUR_UI::update_disk_space()
|
|||
|
||||
if (fr == 0) {
|
||||
/* skip update - no SR available */
|
||||
disk_space_gauge.set_available_disk_sec (-1);
|
||||
format_disk_space_label (-1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!opt_samples) {
|
||||
/* Available space is unknown */
|
||||
disk_space_gauge.set_available_disk_sec (-1);
|
||||
format_disk_space_label (-1);
|
||||
} else if (opt_samples.get_value_or (0) == max_samplecnt) {
|
||||
disk_space_gauge.set_available_disk_sec (max_samplecnt);
|
||||
format_disk_space_label (max_samplecnt);
|
||||
} else {
|
||||
rec_enabled_streams = 0;
|
||||
_session->foreach_route (this, &ARDOUR_UI::count_recenabled_streams, false);
|
||||
|
@ -1763,7 +1787,7 @@ ARDOUR_UI::update_disk_space()
|
|||
samples /= rec_enabled_streams;
|
||||
}
|
||||
|
||||
disk_space_gauge.set_available_disk_sec (samples / (float)fr);
|
||||
format_disk_space_label (samples / (float)fr);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2577,9 +2601,6 @@ ARDOUR_UI::blink_handler (bool blink_on)
|
|||
solo_blink (blink_on);
|
||||
audition_blink (blink_on);
|
||||
feedback_blink (blink_on);
|
||||
|
||||
dsp_load_gauge.blink(blink_on);
|
||||
disk_space_gauge.blink(blink_on);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -4867,10 +4888,6 @@ ARDOUR_UI::xrun_handler (samplepos_t where)
|
|||
|
||||
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::xrun_handler, where)
|
||||
|
||||
if (_session && _session->actively_recording()) {
|
||||
dsp_load_gauge.set_xrun_while_recording();
|
||||
}
|
||||
|
||||
if (_session && Config->get_create_xrun_marker() && _session->actively_recording()) {
|
||||
create_xrun_marker(where);
|
||||
}
|
||||
|
|
|
@ -74,9 +74,6 @@
|
|||
#include "add_route_dialog.h"
|
||||
#include "ardour_dialog.h"
|
||||
#include "ardour_window.h"
|
||||
#include "dsp_load_gauge.h"
|
||||
#include "disk_space_gauge.h"
|
||||
#include "disk_io_gauge.h"
|
||||
#include "editing.h"
|
||||
#include "enums.h"
|
||||
#include "mini_timeline.h"
|
||||
|
@ -492,9 +489,6 @@ private:
|
|||
MiniTimeline mini_timeline;
|
||||
TimeInfoBox* time_info_box;
|
||||
|
||||
DspLoadGauge dsp_load_gauge;
|
||||
DiskIoGauge disk_io_gauge;
|
||||
DiskSpaceGauge disk_space_gauge;
|
||||
|
||||
ArdourWidgets::ArdourVSpacer meterbox_spacer;
|
||||
ArdourWidgets::ArdourVSpacer meterbox_spacer2;
|
||||
|
@ -567,20 +561,19 @@ private:
|
|||
Gtk::Label wall_clock_label;
|
||||
gint update_wall_clock ();
|
||||
|
||||
Gtk::Label disk_space_label;
|
||||
void update_disk_space ();
|
||||
void format_disk_space_label (float);
|
||||
|
||||
Gtk::Label timecode_format_label;
|
||||
void update_timecode_format ();
|
||||
|
||||
Gtk::Label dsp_load_label;
|
||||
void update_cpu_load ();
|
||||
|
||||
void update_xrun_count ();
|
||||
|
||||
Gtk::Label peak_thread_work_label;
|
||||
void update_peak_thread_work ();
|
||||
|
||||
void update_buffer_load ();
|
||||
|
||||
Gtk::Label sample_rate_label;
|
||||
void update_sample_rate (ARDOUR::samplecnt_t);
|
||||
|
||||
|
|
|
@ -337,7 +337,6 @@ ARDOUR_UI::unload_session (bool hide_stuff)
|
|||
|
||||
session_loaded = false;
|
||||
|
||||
update_buffer_load ();
|
||||
update_title ();
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -695,11 +695,8 @@ ARDOUR_UI::build_menu_bar ()
|
|||
#endif
|
||||
|
||||
hbox->pack_end (error_alert_button, false, false, 2);
|
||||
|
||||
hbox->pack_end (dsp_load_gauge, false, false, 4);
|
||||
|
||||
hbox->pack_end (disk_space_gauge, false, false, 4);
|
||||
hbox->pack_end (disk_io_gauge, false, false, 4);
|
||||
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);
|
||||
|
@ -719,9 +716,8 @@ ARDOUR_UI::build_menu_bar ()
|
|||
_status_bar_visibility.add (&format_label, X_("Format"), _("File Format"), false);
|
||||
_status_bar_visibility.add (&timecode_format_label, X_("TCFormat"), _("Timecode Format"), false);
|
||||
_status_bar_visibility.add (&sample_rate_label, X_("Audio"), _("Audio"), true);
|
||||
_status_bar_visibility.add (&disk_io_gauge, X_("Buffers"), _("Buffers"), true);
|
||||
_status_bar_visibility.add (&disk_space_gauge, X_("Disk"), _("Disk Space"), !Profile->get_small_screen());
|
||||
_status_bar_visibility.add (&dsp_load_gauge, X_("DSP"), _("DSP"), true);
|
||||
_status_bar_visibility.add (&disk_space_label, X_("Disk"), _("Disk Space"), !Profile->get_small_screen());
|
||||
_status_bar_visibility.add (&dsp_load_label, X_("DSP"), _("DSP"), true);
|
||||
|
||||
ev->signal_button_press_event().connect (sigc::mem_fun (_status_bar_visibility, &VisibilityGroup::button_press_event));
|
||||
ev->signal_button_release_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::xrun_button_release));
|
||||
|
@ -857,7 +853,6 @@ ARDOUR_UI::save_ardour_state ()
|
|||
void
|
||||
ARDOUR_UI::resize_text_widgets ()
|
||||
{
|
||||
//ToDo: maybe resize the gauges to fit translated text
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -877,7 +872,7 @@ ARDOUR_UI::xrun_button_release (GdkEventButton* ev)
|
|||
|
||||
if (_session) {
|
||||
_session->reset_xrun_count ();
|
||||
update_xrun_count ();
|
||||
update_cpu_load ();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue