use tri-state text-less LED for error-log button.

This commit is contained in:
Robin Gareus 2015-03-16 19:04:17 +01:00
parent 28e4708825
commit 3a1071e5e9
3 changed files with 42 additions and 14 deletions

View File

@ -211,7 +211,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
, auditioning_alert_button (_("Audition"))
, solo_alert_button (_("Solo"))
, feedback_alert_button (_("Feedback"))
, error_alert_button (_("Errors"))
, error_alert_button ( ArdourButton::Element (ArdourButton::Edge | ArdourButton::Indicator) )
, editor_meter(0)
, editor_meter_peak_display()
@ -234,6 +234,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
, _status_bar_visibility (X_("status-bar"))
, _feedback_exists (false)
, _log_not_acknowledged (LogLevelNone)
{
Gtkmm2ext::init(localedir);

View File

@ -770,7 +770,15 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void successful_graph_sort ();
bool _feedback_exists;
bool _error_not_acknowledged;
enum ArdourLogLevel {
LogLevelNone = 0,
LogLevelInfo,
LogLevelWarning,
LogLevelError
};
ArdourLogLevel _log_not_acknowledged;
void resize_text_widgets ();

View File

@ -145,6 +145,7 @@ ARDOUR_UI::setup_tooltips ()
set_tip (primary_clock, _("<b>Primary Clock</b> right-click to set display mode. Click to edit, click+drag a digit or mouse-over+scroll wheel to modify.\nText edits: right-to-left overwrite <tt>Esc</tt>: cancel; <tt>Enter</tt>: confirm; postfix the edit with '+' or '-' to enter delta times.\n"));
set_tip (secondary_clock, _("<b>Secondary Clock</b> right-click to set display mode. Click to edit, click+drag a digit or mouse-over+scroll wheel to modify.\nText edits: right-to-left overwrite <tt>Esc</tt>: cancel; <tt>Enter</tt>: confirm; postfix the edit with '+' or '-' to enter delta times.\n"));
set_tip (editor_meter_peak_display, _("Reset All Peak Indicators"));
set_tip (error_alert_button, _("Show Error Log and acknowledge warnings"));
synchronize_sync_source_and_video_pullup ();
@ -175,22 +176,24 @@ ARDOUR_UI::display_message (const char *prefix, gint prefix_len, RefPtr<TextBuff
UI::display_message (prefix, prefix_len, ptag, mtag, msg);
if (!strcmp (prefix, _("[ERROR]: ")) || !strcmp (prefix, _("[WARNING]: "))) {
_error_not_acknowledged = true;
}
#ifdef TOP_MENUBAR
ArdourLogLevel ll = LogLevelNone;
if (strcmp (prefix, _("[ERROR]: ")) == 0) {
text = "<span color=\"red\" weight=\"bold\">";
ll = LogLevelError;
} else if (strcmp (prefix, _("[WARNING]: ")) == 0) {
text = "<span color=\"yellow\" weight=\"bold\">";
ll = LogLevelWarning;
} else if (strcmp (prefix, _("[INFO]: ")) == 0) {
text = "<span color=\"green\" weight=\"bold\">";
ll = LogLevelInfo;
} else {
text = "<span color=\"white\" weight=\"bold\">???";
}
_log_not_acknowledged = std::max(_log_not_acknowledged, ll);
#ifdef TOP_MENUBAR
text += prefix;
text += "</span>";
text += msg;
@ -545,7 +548,8 @@ ARDOUR_UI::feedback_alert_press (GdkEventButton *)
bool
ARDOUR_UI::error_alert_press (GdkEventButton*)
{
_error_not_acknowledged = false;
_log_not_acknowledged = LogLevelNone;
error_blink (false); // immediate acknowledge
UI::show_errors();
return true;
}
@ -626,14 +630,29 @@ ARDOUR_UI::feedback_blink (bool onoff)
void
ARDOUR_UI::error_blink (bool onoff)
{
if (_error_not_acknowledged) {
if (onoff) {
switch (_log_not_acknowledged) {
case LogLevelError:
// blink
if (onoff) {
error_alert_button.set_custom_led_color(0xff0000ff); // bright red
error_alert_button.set_active (true);
} else {
error_alert_button.set_custom_led_color(0x880000ff); // dark red
error_alert_button.set_active (false);
}
break;
case LogLevelWarning:
error_alert_button.set_custom_led_color(0xccaa00ff); // yellow
error_alert_button.set_active (true);
} else {
break;
case LogLevelInfo:
error_alert_button.set_custom_led_color(0x88cc00ff); // lime green
error_alert_button.set_active (true);
break;
default:
error_alert_button.set_custom_led_color(0x333333ff); // gray
error_alert_button.set_active (false);
}
} else {
error_alert_button.set_active (false);
break;
}
}