From 3a1071e5e98f5ae632319c780209783a1f173bee Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 16 Mar 2015 19:04:17 +0100 Subject: [PATCH] use tri-state text-less LED for error-log button. --- gtk2_ardour/ardour_ui.cc | 3 ++- gtk2_ardour/ardour_ui.h | 10 ++++++++- gtk2_ardour/ardour_ui2.cc | 43 ++++++++++++++++++++++++++++----------- 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index c67ba6d9cb..3b303b254c 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -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); diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index de0688dfbb..00d31d9c0c 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -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 (); diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index e5fdc20423..57bcca34da 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -145,6 +145,7 @@ ARDOUR_UI::setup_tooltips () set_tip (primary_clock, _("Primary Clock 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 Esc: cancel; Enter: confirm; postfix the edit with '+' or '-' to enter delta times.\n")); set_tip (secondary_clock, _("Secondary Clock 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 Esc: cancel; Enter: 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"; + ll = LogLevelError; } else if (strcmp (prefix, _("[WARNING]: ")) == 0) { text = ""; + ll = LogLevelWarning; } else if (strcmp (prefix, _("[INFO]: ")) == 0) { text = ""; + ll = LogLevelInfo; } else { text = "???"; } + _log_not_acknowledged = std::max(_log_not_acknowledged, ll); + +#ifdef TOP_MENUBAR text += prefix; text += ""; 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; } } -- 2.30.2