UI-top-level: decision to form a cohesive top-level context (#1067)
This commit is contained in:
parent
4f302eb81b
commit
f8eb640dd7
5 changed files with 149 additions and 20 deletions
113
src/gui/workspace/global-ctx.hpp
Normal file
113
src/gui/workspace/global-ctx.hpp
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
GLOBAL-CTX.hpp - Context of global UI top-level entities
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2017, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/** @file global-ctx.hpp
|
||||
** Dependency context to hold all the global UI top-level entities.
|
||||
** 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
|
||||
** 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.
|
||||
**
|
||||
** Towards the outside, the interface exposed by these managers is rather narrow; basically the parts
|
||||
** comprising the UI are to be wired at startup and expected to react based on events from then on.
|
||||
** Shutdown of the GUI is effected by terminating the GTK event loop. Each of the top-level managers
|
||||
** serves a distinct purpose and will be addressed through a dedicated API, even by the collaborating
|
||||
** other top-level managers.
|
||||
**
|
||||
** The global UI context is comprised of the following members
|
||||
** - connection to the [UI-Bus](\ref ui-bus.hpp)
|
||||
** - the UiManager
|
||||
** - the InteractionDirector
|
||||
** - the WindowList
|
||||
** - the HelpController
|
||||
** - the Wizzard
|
||||
**
|
||||
** @see gtk-lumiera.hpp
|
||||
** @see ui-bus.hpp
|
||||
** @see ui-manager.hpp
|
||||
** @see interaction-director.hpp
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GUI_WORKSPACE_GLOBAL_CTX_H
|
||||
#define GUI_WORKSPACE_GLOBAL_CTX_H
|
||||
|
||||
#include "gui/gtk-lumiera.hpp"
|
||||
#include "gui/ui-bus.hpp"
|
||||
#include "gui/workspace/ui-manager.hpp"
|
||||
#include "gui/workspace/actions.hpp"
|
||||
#include "gui/workspace/window-list.hpp"
|
||||
#include "gui/workspace/interaction-director.hpp"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
//#include <string>
|
||||
//#include <memory>
|
||||
|
||||
|
||||
namespace gui {
|
||||
namespace workspace {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A global circle of top-level UI management facilities.
|
||||
* Creating an instance of this context makes the Lumiera UI operative.
|
||||
* All entities installed and wired here are mutually dependent and aware
|
||||
* of each partner's role; failure to create anyone will terminate the UI.
|
||||
*
|
||||
* @remark the UiManager is responsible to install this top-level context
|
||||
*/
|
||||
class GlobalCtx
|
||||
: boost::noncopyable
|
||||
{
|
||||
|
||||
public:
|
||||
UiBus& uiBus_;
|
||||
UiManager& uiManager_;
|
||||
|
||||
InteractionDirector director_;
|
||||
WindowList windowList_;
|
||||
Actions actions_;
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Establish the top-level UI context of the Lumiera user interface.
|
||||
*/
|
||||
GlobalCtx (UiBus& bus, UiManager& manager)
|
||||
: uiBus_{bus}
|
||||
, uiManager_{manager}
|
||||
, director_{*this}
|
||||
, windowList_{*this}
|
||||
, actions_{*this}
|
||||
{ }
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
}}// namespace gui::workspace
|
||||
#endif /*GUI_WORKSPACE_GLOBAL_CTX_H*/
|
||||
|
|
@ -33,12 +33,9 @@
|
|||
|
||||
#include "gui/gtk-lumiera.hpp"
|
||||
#include "gui/config-keys.hpp"
|
||||
#include "gui/ui-bus.hpp"
|
||||
#include "gui/workspace/ui-manager.hpp"
|
||||
#include "gui/workspace/actions.hpp"
|
||||
#include "gui/workspace/window-list.hpp"
|
||||
#include "gui/workspace/global-ctx.hpp"
|
||||
#include "gui/workspace/workspace-window.hpp"
|
||||
#include "gui/workspace/interaction-director.hpp"
|
||||
#include "lib/searchpath.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
|
|
@ -72,10 +69,7 @@ namespace workspace {
|
|||
|
||||
UiManager::UiManager (UiBus& bus)
|
||||
: Gtk::UIManager()
|
||||
, uiBus_{bus}
|
||||
, director_{new InteractionDirector{bus}}
|
||||
, windowList_{new WindowList{*this}}
|
||||
, actions_{new Actions{[this]() ->WorkspaceWindow& { return windowList_->findActiveWindow();}}}
|
||||
, globals_{new GlobalCtx{bus, *this}}
|
||||
, iconSearchPath_{Config::get (KEY_ICON_PATH)}
|
||||
, resourceSerachPath_{Config::get (KEY_UIRES_PATH)}
|
||||
{
|
||||
|
|
|
|||
|
|
@ -62,9 +62,7 @@ namespace workspace {
|
|||
using std::unique_ptr;
|
||||
using std::string;
|
||||
|
||||
class Actions;
|
||||
class WindowList;
|
||||
class InteractionDirector;
|
||||
class GlobalCtx;
|
||||
|
||||
|
||||
|
||||
|
|
@ -78,11 +76,8 @@ namespace workspace {
|
|||
: public Gtk::UIManager
|
||||
, boost::noncopyable
|
||||
{
|
||||
UiBus& uiBus_;
|
||||
|
||||
unique_ptr<InteractionDirector> director_;
|
||||
unique_ptr<WindowList> windowList_;
|
||||
unique_ptr<Actions> actions_;
|
||||
unique_ptr<GlobalCtx> globals_;
|
||||
|
||||
string iconSearchPath_;
|
||||
string resourceSerachPath_;
|
||||
|
|
|
|||
|
|
@ -2922,7 +2922,7 @@ Applying a diff changes the structure, that is, the structure of the local model
|
|||
Together this means we get a fix up stage after model changes, where the display is re-adjusted to fit the new situation. This works in concert with the [[display manager|TimelineDisplayManager]] representing only those elements as actual widgets, which get a real chance to become visible. This way we can build on the assumption that the actual number of widgets to be managed any time remains so small as to get away with simple linear list processing. It remains to be seen how far this assumption can be pushed -- the problem is that the GTK container components don't support anything beyond such simple linear list processing; there isn't even a call to remove all child widgets of a container in a single pass.
|
||||
</pre>
|
||||
</div>
|
||||
<div title="GuiTopLevel" creator="Ichthyostega" modifier="Ichthyostega" created="201701261944" modified="201702102010" tags="GuiPattern spec draft" changecount="5">
|
||||
<div title="GuiTopLevel" creator="Ichthyostega" modifier="Ichthyostega" created="201701261944" modified="201702140201" tags="GuiPattern spec draft" changecount="6">
|
||||
<pre>To a large extent, the Lumiera user interface is built around a //backbone structure,// known as the UI-Bus.
|
||||
But there are some dedicated top-level entities, collaborating to maintain a consistent application lifecycle
|
||||
;Application
|
||||
|
|
@ -2942,6 +2942,8 @@ But there are some dedicated top-level entities, collaborating to maintain a con
|
|||
;Notification Façade
|
||||
:attachment point for lower layers and anyone in need to "talk to the UI"
|
||||
:the GuiNotificationFacade is a LayerSeparationInterface and integrated with Lumiera's interface system
|
||||
|
||||
Together, these entities form a cohesive circle of collaborating global managers, known as ''global UI context''; the interplay of these facilities is essentially an implementation detail, insofar there is not much necessity (and only a narrow API) for the rest of the UI to address those directly. Rather, each member of this circle serves a dedicated purpose and is visible to the rest of the application through some kind of service abstraction. For example, the [[interactionDirector|UIInteractionDirector]] is mapped as a top-level model element into the logical model of the UI; typically, other parts of the application address this service through messages via the UI-Bus, while the Interaction Director itself is responsible to create a link between model and interaction state -- a service, which is fulfilled in a transparent way.
|
||||
</pre>
|
||||
</div>
|
||||
<div title="HighLevelModel" modifier="Ichthyostega" created="200808152311" modified="201505310109" tags="Model spec design discuss img" changecount="2">
|
||||
|
|
|
|||
|
|
@ -1954,11 +1954,13 @@
|
|||
</node>
|
||||
<node CREATED="1486942467620" HGAP="151" ID="ID_1761000392" MODIFIED="1486945029916" TEXT="Alternativen" VSHIFT="14">
|
||||
<icon BUILTIN="help"/>
|
||||
<node CREATED="1486942493208" ID="ID_805305597" MODIFIED="1486942503850" TEXT="alles via InteractionDirector">
|
||||
<node CREATED="1486942493208" ID="ID_805305597" MODIFIED="1487034053842" TEXT="alles via InteractionDirector">
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
<node CREATED="1486944032334" ID="ID_1959218653" MODIFIED="1486944046824" TEXT="er macht ohnehin fast alles">
|
||||
<icon BUILTIN="smily_bad"/>
|
||||
</node>
|
||||
<node CREATED="1486944056595" ID="ID_423413011" MODIFIED="1486944062637" TEXT="Actions wird eine leere Hülle">
|
||||
<node CREATED="1486944056595" ID="ID_423413011" MODIFIED="1487034101279" TEXT="Actions wird eine leere Hülle">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
<node CREATED="1486944064506" ID="ID_712470482" MODIFIED="1486944068493" TEXT="baut das Menü"/>
|
||||
<node CREATED="1486944068985" ID="ID_1074291755" MODIFIED="1486944074916" TEXT="stellt die Closures bereit"/>
|
||||
<node CREATED="1486944075456" ID="ID_1851635277" MODIFIED="1486944079556" TEXT="könnte Exceptions fangen"/>
|
||||
|
|
@ -1966,8 +1968,26 @@
|
|||
<icon BUILTIN="help"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1487034056153" ID="ID_1455538166" MODIFIED="1487034104662" TEXT="Rein aus dem Bauch heraus....">
|
||||
<icon BUILTIN="stop-sign"/>
|
||||
<node CREATED="1487034063408" ID="ID_1251347399" MODIFIED="1487034078308">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
das <i>verschiebt</i> das Problem nur
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
<node CREATED="1486942523724" ID="ID_843953045" MODIFIED="1486942532639" TEXT="globalen Kontext einführen">
|
||||
<node CREATED="1487034078974" ID="ID_796487731" MODIFIED="1487034094280" TEXT="verletzt das single responsibility pattern"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1486942523724" ID="ID_843953045" MODIFIED="1487034136186" TEXT="globalen Kontext einführen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1486942614400" ID="ID_872912875" MODIFIED="1486942627890" TEXT="Action-Definition "weiß" wer das konkret machen kann"/>
|
||||
<node CREATED="1486943522965" ID="ID_244569580" MODIFIED="1486943527790" TEXT="konkret...">
|
||||
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
||||
|
|
@ -2021,10 +2041,15 @@
|
|||
<icon BUILTIN="idea"/>
|
||||
<node CREATED="1486945099213" ID="ID_1118933657" MODIFIED="1486945109359" TEXT="ob alles an ihn delegiert wird"/>
|
||||
<node CREATED="1486945110091" ID="ID_1820336322" MODIFIED="1486945124685" TEXT="oder ob es einen globalen Kontext gibt">
|
||||
<node CREATED="1486945126721" ID="ID_804526091" MODIFIED="1486945133572" TEXT="und da könnte dann der UiManager sein"/>
|
||||
<node CREATED="1486945126721" ID="ID_804526091" MODIFIED="1487033614682" TEXT="und das könnte dann der UiManager sein"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1487034156380" ID="ID_1632778987" MODIFIED="1487034161495" TEXT="globaler Kontext">
|
||||
<node CREATED="1487034162275" ID="ID_28375182" MODIFIED="1487034171926" TEXT="wenige, eng zusammenarbeitende Objekte"/>
|
||||
<node CREATED="1487034172393" ID="ID_1167812745" MODIFIED="1487034180237" TEXT="...von denen doch jedes seine Aufgabe hat"/>
|
||||
<node CREATED="1487034180712" ID="ID_1371598611" MODIFIED="1487034193170" TEXT="und jedes genau weiß, was die andern können"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1485898796393" ID="ID_1217726538" MODIFIED="1485898814419" TEXT="#1069 how to refer to the current window">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue