From 33af82cf737547ed574dfcc488245dde84811393 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 5 Oct 2018 05:36:53 +0200 Subject: [PATCH] NotificationDisplay: now responding to the "Flash" message on UI-Bus solved by temporarily adding a CSS class. Mostly this was an issue of writing the Stylesheet properly. Hint: use the GTK+ inspector, i.e. run with GTK_DEBUG=interactive target/lumiera --- src/gui/ctrl/notification-hub.hpp | 14 +- src/gui/lumiera-light-theme-complement.css | 8 + src/gui/lumiera.css | 8 + src/gui/model/flash-deco.hpp | 2 + src/gui/style-scheme.cpp | 2 +- src/gui/widget/error-log-display.hpp | 17 +- wiki/thinkPad.ichthyo.mm | 198 ++++++++++++++------- 7 files changed, 171 insertions(+), 78 deletions(-) diff --git a/src/gui/ctrl/notification-hub.hpp b/src/gui/ctrl/notification-hub.hpp index c380c29c7..ec027d41f 100644 --- a/src/gui/ctrl/notification-hub.hpp +++ b/src/gui/ctrl/notification-hub.hpp @@ -26,8 +26,8 @@ ** This component is addressed in order to show error, warning and notification messages ** in the UI. It is responsible for maintaining a local log of these messages, and to ** allocate an appropriate display widgets, to show such notifications asynchronously. - ** On first use, an InfoboxPanel is allocated to hold an ErrorlogWidget for presentation - ** of those messages + ** On first use, an InfoboxPanel is allocated to hold an ErrorLogDisplay widget for + ** presentation of those messages ** ** # Notification Controller Behaviour ** @@ -47,7 +47,6 @@ ** to reveal or expand the widget (but if necessary, a new widget is allocated) ** - error messages also set an error marker state (*TODO* reflect this in the presentation), ** and they cause the display widget to be expanded - ** (*TODO* 8/18 consider also call the doRevealYourself() function) ** - the error state can be _cleared_, which also demotes all error messages to mere information. ** - information content can also be _cleared_, which removes all mere information messages, ** while retaining the error entries. @@ -70,8 +69,6 @@ #include "gui/model/w-link.hpp" #include -//#include -//#include namespace gui { @@ -188,8 +185,8 @@ namespace ctrl { ~NotificationHub() { }; - private: + private: /** external operation to find or allocate an log display widget */ WidgetAllocator allocateWidget_; @@ -204,14 +201,9 @@ namespace ctrl { widget_.connect (allocateWidget_()); return *widget_; } - }; - /** */ - - - }}// namespace gui::ctrl #endif /*GUI_CTRL_NOTIFICATION_HUB_H*/ diff --git a/src/gui/lumiera-light-theme-complement.css b/src/gui/lumiera-light-theme-complement.css index 841c07fa1..1539e5609 100644 --- a/src/gui/lumiera-light-theme-complement.css +++ b/src/gui/lumiera-light-theme-complement.css @@ -23,3 +23,11 @@ /* ---------- Styles for special markup ---------- */ + + .indication_flash, + .indication_flash * { + background-color: LightYellow; +} + .indication_flash text { + border: 4px solid red; +} diff --git a/src/gui/lumiera.css b/src/gui/lumiera.css index d9aa1a722..38b117352 100644 --- a/src/gui/lumiera.css +++ b/src/gui/lumiera.css @@ -278,3 +278,11 @@ class "gtkmm__CustomObject_TimelineHeaderWidget" style:highest "timeline_header_ /* ---------- Styles for special markup ---------- */ + + .indication_flash, + .indication_flash * { + background-color: shade(@hover_bg_color, 1.6); +} + .indication_flash text { + border: 4px solid red; +} diff --git a/src/gui/model/flash-deco.hpp b/src/gui/model/flash-deco.hpp index fd86071d5..dbd5d290c 100644 --- a/src/gui/model/flash-deco.hpp +++ b/src/gui/model/flash-deco.hpp @@ -57,9 +57,11 @@ namespace model { * Decorator for a Gtk::Widget to add a visual flash action. * @tparam WIT type of the target widget to decorate. All ctors are passed through. * @remark invoke the #flash function to trigger + * @see \ref gui::CSS_CLASS_FLASH */ template class FlashDeco + : public WIT { static_assert (std::is_base_of() ,"wrapped target type required to be a Gtk::Widget"); diff --git a/src/gui/style-scheme.cpp b/src/gui/style-scheme.cpp index 3809ab0cd..c0a9212eb 100644 --- a/src/gui/style-scheme.cpp +++ b/src/gui/style-scheme.cpp @@ -36,7 +36,7 @@ namespace gui { const Literal TAG_ERROR{"ERROR"}; ////////////////////////////////////////////////////////////TICKET #1168 : find a way to manage style of custom extended UI elements const Literal TAG_WARN{"WARN"}; - cuString CSS_CLASS_FLASH{"indication_flash"}; + cuString CSS_CLASS_FLASH{"indication_flash"}; ///< CSS class added temporarily to make a widget "flash" in response to the corresponding UI-Bus message const uint STYLE_FLASH_DURATION_in_ms = 1100; diff --git a/src/gui/widget/error-log-display.hpp b/src/gui/widget/error-log-display.hpp index 44e75ed23..3a2fce578 100644 --- a/src/gui/widget/error-log-display.hpp +++ b/src/gui/widget/error-log-display.hpp @@ -61,13 +61,12 @@ #include "gui/gtk-base.hpp" #include "gui/style-scheme.hpp" +#include "gui/model/flash-deco.hpp" #include "gui/model/expander-revealer.hpp" #include "include/gui-notification-facade.h" #include "lib/format-string.hpp" #include "lib/symbol.hpp" -//#include "lib/util.hpp" -//#include #include #include @@ -125,10 +124,11 @@ namespace widget { using Mark = Glib::RefPtr; using Entry = std::pair; + using TextWidget = model::FlashDeco; vector errorMarks_; - Gtk::TextView textLog_; - + TextWidget textLog_; + public: ~ErrorLogDisplay() { }; @@ -154,7 +154,7 @@ namespace widget { model::Revealer reveal; - /** empty buffer and discard all error bookmarks */ + /** empty text buffer and discard all error bookmarks */ void clearAll() { @@ -252,10 +252,15 @@ namespace widget { errorMarks_.clear(); } + + /** temporarily change display style to prompt for attention; + * set callback-timeout to return to normal state. + * @see \ref gui::CSS_CLASS_FLASH + */ void triggerFlash() { - UNIMPLEMENTED ("paint and set callback-timeout to return to normal state"); + textLog_.flash(); } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 0479d1cdb..0341d5f1a 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -2077,15 +2077,29 @@ - + - - + + + + + + + + + +

+ erscheint definitiv nicht als CSS-Node +

+ + +
+
@@ -2169,8 +2183,7 @@ aber eben am absoluten Ende des Buffers. Damit wird sie hinter jeder Einfügung bleiben

- - + @@ -2185,8 +2198,7 @@ ...dann Einfügestelle davor platzieren

- - +
@@ -2262,15 +2274,35 @@
- - - - + + + + - + + + + + + + + +

+ das Widget hat offensichtlich keine eigene graphische Repräsentation. +

+

+ dieser Fall dürfte häufiger auftreten +

+ + +
+
+
+ + @@ -2294,20 +2326,39 @@ Dummerweise funktioniert nun aber auch das Übersteuern mit unseren Farben nicht mehr

+
+
+ + + + + + + + + +

+ ...welches ich zusammen mit meinem +

+

+ normalen 'light' destkop-theme verwenden kann +

+
- - + + + - - + + @@ -2360,8 +2411,7 @@ Einziger Nachteil ist die etwas verwirrende Schreibweise des dekorierten Typs

- - +
@@ -2447,8 +2497,8 @@
- - + + @@ -2468,7 +2518,7 @@ - + @@ -2532,8 +2582,8 @@ - - + + @@ -2829,8 +2879,8 @@ - - + + @@ -2858,8 +2908,7 @@ Neue Revealer-Komponente bindet einen Funktor

- - +
@@ -2920,8 +2969,8 @@
- - + + @@ -2945,7 +2994,7 @@ - + @@ -3757,28 +3806,28 @@ - - - - + + + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -5339,6 +5388,37 @@ + + + + + + + + + + + + + + + + + + + +

+ den Klassennamen ohne das Namespace-Präfix "GTK", und alles lower case. +

+

+ Im Zweifelsfall den GTK+ Inspector verwenden! +

+ + +
+
+
+
@@ -5364,8 +5444,7 @@ CSS genügt

- - +
@@ -5391,8 +5470,7 @@ die ein property auf den Wert 'inherit' setzten

- - + @@ -5414,8 +5492,7 @@ }

- -
+
@@ -5604,8 +5681,7 @@ Allerdings habe ich an der Stelle immer noch GTK-Assertions

- - +
@@ -38298,6 +38374,11 @@
+ + + + + @@ -38324,8 +38405,7 @@ context->add_class("ohMy");

- - + @@ -39161,8 +39241,7 @@ stets zwischen den Zeichen

- - +
@@ -39174,8 +39253,7 @@ Danke! endlich bekommt das mal jemand korrekt hin

- -
+