From d3daed9a1855eec2430f9cea5475b60e660cda5b Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 2 Aug 2018 17:23:28 +0200 Subject: [PATCH] UI-Lifecycle: invstigate where to issue the trigger (#1151) --- src/gui/ctrl/global-ctx.hpp | 5 +- src/gui/ctrl/ui-manager.cpp | 15 +++ src/gui/ctrl/ui-manager.hpp | 11 +- src/gui/interact/interaction-director.cpp | 8 ++ src/gui/interact/interaction-director.hpp | 18 ++- src/gui/interact/wizard.hpp | 3 +- wiki/thinkPad.ichthyo.mm | 134 +++++++++++++++++++++- 7 files changed, 172 insertions(+), 22 deletions(-) diff --git a/src/gui/ctrl/global-ctx.hpp b/src/gui/ctrl/global-ctx.hpp index 36f728f79..8ee656c71 100644 --- a/src/gui/ctrl/global-ctx.hpp +++ b/src/gui/ctrl/global-ctx.hpp @@ -26,7 +26,7 @@ ** There is a small number of management facilities, responsible for conducting all the ** global concerns of the Lumiera UI. The circle of these _top level managers_ is quite cohesive, ** insofar each knows each other and is aware of each others responsibilities. When starting the UI, - ** this global context is established and wired in one shot, any any failure here immediately terminates + ** this global context is established and wired in one shot, and any failure here immediately terminates ** the UI-Layer. It is the UiManager's responsibility to install this management circle and this task is ** what effectively brings the UI into operative state. ** @@ -61,9 +61,6 @@ #include "gui/interact/interaction-director.hpp" #include "lib/nocopy.hpp" -//#include -//#include - namespace gui { namespace ctrl { diff --git a/src/gui/ctrl/ui-manager.cpp b/src/gui/ctrl/ui-manager.cpp index 72609c908..958038953 100644 --- a/src/gui/ctrl/ui-manager.cpp +++ b/src/gui/ctrl/ui-manager.cpp @@ -159,6 +159,21 @@ namespace ctrl { gtk_main_quit(); } + + /** + * @remarks moves the given operation into our private dispatcher queue and then + * schedules dequeuing and invocation into the UI event thread. + * @param op a completely closed lambda or functor + * @warning closure need to be by value or equivalent, since + * the operation will be executed within another call stack + */ + void + UiManager::schedule (Operation&& task) + { + UNIMPLEMENTED ("TICKET #1151 build a suitable dispatcher into the GTK loop"); + } + + void UiManager::updateWindowFocusRelatedActions() { diff --git a/src/gui/ctrl/ui-manager.hpp b/src/gui/ctrl/ui-manager.hpp index bd3a3d25c..7506b1506 100644 --- a/src/gui/ctrl/ui-manager.hpp +++ b/src/gui/ctrl/ui-manager.hpp @@ -50,8 +50,9 @@ #include "gui/gtk-base.hpp" #include "lib/nocopy.hpp" -#include +#include #include +#include namespace gui { @@ -130,6 +131,14 @@ namespace ctrl { */ void terminateUI(); + + using Operation = std::function; + /** + * perform an action within the UI event loop (GTK loop). + */ + void schedule (Operation&& task); + + /** @todo find a solution how to enable/disable menu entries according to focus * /////////////////////////////////////////////////TICKET #1076 find out how to handle this properly */ diff --git a/src/gui/interact/interaction-director.cpp b/src/gui/interact/interaction-director.cpp index b8a66a50e..23bbd79ca 100644 --- a/src/gui/interact/interaction-director.cpp +++ b/src/gui/interact/interaction-director.cpp @@ -81,6 +81,14 @@ namespace interact { { } + /** + * Setup and initialise all representations of "global-ness". + * @param globals wiring to the circle of top-level UI managers (including ourselves) + * @warning this ctor is performed within the UI thread, yet _prior_ to entering the GTK event loop. + * For this reason, all initialisation performed here must be wiring-only; any tasks requiring an + * actually operative UI need to be scheduled, by means of the NotificationService. + * @todo 7/2018 STOP no, can't be the NotificationService. ////////////////////////////////////////////TICKET #1151 : Need a new dedicated service in UiManager + */ InteractionDirector::InteractionDirector (GlobalCtx& globals) : model::Controller(session::Root::getID(), globals.uiBus_.getAccessPoint()) , globalCtx_(globals) diff --git a/src/gui/interact/interaction-director.hpp b/src/gui/interact/interaction-director.hpp index 952e1285c..8a8c67aa0 100644 --- a/src/gui/interact/interaction-director.hpp +++ b/src/gui/interact/interaction-director.hpp @@ -24,16 +24,16 @@ /** @file interaction-director.hpp ** The top-level controller to connect model and user interaction state. ** Within the Lumiera UI, relevant entities from the session model are mapped onto and represented - ** by corresponding [UI-Elements](\ref Tangible). Consequently, there is a hierarchy of - ** interrelated UI elements mirroring the hierarchy within the session model. And, while in the - ** latter, there is a _conceptual root node_ to correspond to the session itself, within the UI - ** there is a top-level controller to mirror and represent that root element: The InteractionDirector. + ** by corresponding [UI-Elements](\ref Tangible). Consequently, there is a hierarchy of interrelated + ** UI elements mirroring the hierarchy within the session model. And, while in the latter, there is + ** a _conceptual root node_ to correspond to the session itself, within the UI there is a top-level + ** controller to mirror and represent that root element: The InteractionDirector. ** ** For one, the InteractionDirector represents and exposes parts of the model as seen from top level. - ** Especially this means that, through the InteractionDirector, it is possible to open and enter the - ** UI to work with the timeline(s), with the assets and with the global session configuration. - ** Moreover, this top-level controller allows to issue likewise global actions regarding those - ** entities: + ** More specifically, through the InteractionDirector, it is possible to open and enter the UI + ** to work with the timeline(s), with the assets and with the global session configuration. + ** Moreover, this top-level controller allows to issue likewise global actions regarding + ** those top-level entities: ** - create / modify / delete timeline(s) ** - create / modify / sequences ** - save, close, open and create a session @@ -53,11 +53,9 @@ #ifndef GUI_INTERACT_INTERACTION_DIRECTOR_H #define GUI_INTERACT_INTERACTION_DIRECTOR_H -//#include "gui/gtk-base.hpp" #include "gui/model/controller.hpp" #include "lib/depend-inject.hpp" -//#include //#include #include #include diff --git a/src/gui/interact/wizard.hpp b/src/gui/interact/wizard.hpp index f134d62ef..0d541616b 100644 --- a/src/gui/interact/wizard.hpp +++ b/src/gui/interact/wizard.hpp @@ -64,7 +64,8 @@ namespace interact { /** - * Global cross-cutting navigation in interface space + * Global cross-cutting navigation in interface space, + * foundation to implement user assistance and context sensitive help. * * @todo initial draft as of 2/2017 -- actual implementation has to be filled in */ diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index a46210f46..e203c8415 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -15880,7 +15880,7 @@ - + @@ -15897,7 +15897,8 @@ - + + @@ -15938,8 +15939,51 @@ + + + + - + + + + + + + + + +

+ will sagen, +

+

+ ich gebe mir jetzt nicht mal mehr die Mühe, +

+

+ meine erratene Lösung zu verifizieren. +

+

+ +

+

+ Sie erscheint mir einfach so absolut offensichtlich, +

+

+ daß es keine weitere Mühe lohnt. +

+

+ Glib::Dispatcher ist genau das richtige Ding für diesen Zweck +

+ + +
+ +
+
+
+ + + @@ -16129,11 +16173,23 @@ - + + + + + + + + + + + + + @@ -16146,8 +16202,8 @@ - - + + @@ -16159,6 +16215,72 @@ + + + + + + + + + + + + + + + + + + + + + + +

+ das ist ein akzidentelles Problem +

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

+ denn es ist gradezu der Sinn von Glib::Dispatcher, +

+

+ schon vor der Loop verfügbar zu sein (?) +

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