From e94b294121bd63b1c27c3bb65d2cd1c019d05477 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Tue, 14 Feb 2017 03:31:12 +0100 Subject: [PATCH] UI-top-level: wiring in accordance to the new global context this pretty much resolves most of the uncertainities: we now get a set of mutually dependent services, each of which is aware of each other member's capabilities, but accesses those only through this partner's API --- src/gui/workspace/actions.hpp | 19 +++-- src/gui/workspace/global-ctx.hpp | 5 +- src/gui/workspace/interaction-director.cpp | 6 +- src/gui/workspace/interaction-director.hpp | 5 +- src/gui/workspace/ui-manager.cpp | 6 +- src/gui/workspace/ui-manager.hpp | 2 + src/gui/workspace/window-list.cpp | 10 +-- src/gui/workspace/window-list.hpp | 6 +- wiki/thinkPad.ichthyo.mm | 98 ++++++++++------------ 9 files changed, 79 insertions(+), 78 deletions(-) diff --git a/src/gui/workspace/actions.hpp b/src/gui/workspace/actions.hpp index 3d1192dd7..c95ab234b 100644 --- a/src/gui/workspace/actions.hpp +++ b/src/gui/workspace/actions.hpp @@ -37,8 +37,8 @@ #include "gui/gtk-lumiera.hpp" #include "gui/config-keys.hpp" +#include "gui/workspace/global-ctx.hpp" #include "gui/workspace/workspace-window.hpp" -#include "gui/workspace/ui-manager.hpp" #include "gui/dialog/render.hpp" #include "gui/dialog/preferences-dialog.hpp" #include "gui/dialog/name-chooser.hpp" @@ -47,6 +47,7 @@ #include #include +#include #include #include @@ -78,15 +79,13 @@ namespace workspace { * user action events. */ class Actions + : boost::noncopyable { - /**reference to the MainWindow which owns this helper */ - using GetWindow = function; - - GetWindow getWorkspaceWindow; + GlobalCtx& globalCtx_; public: - Actions (GetWindow how_to_access_current_window) - : getWorkspaceWindow(how_to_access_current_window) + Actions (GlobalCtx& globals) + : globalCtx_{globals} , is_updating_action_state(false) { } @@ -233,6 +232,12 @@ namespace workspace { private: /* ===== Internals ===== */ + WorkspaceWindow& + getWorkspaceWindow() + { + return globalCtx_.windowList_.findActiveWindow(); + } + /** * Populates a uiManager with actions for the Show Panel menu. diff --git a/src/gui/workspace/global-ctx.hpp b/src/gui/workspace/global-ctx.hpp index 6b87fc96d..a15581c34 100644 --- a/src/gui/workspace/global-ctx.hpp +++ b/src/gui/workspace/global-ctx.hpp @@ -54,10 +54,9 @@ #ifndef GUI_WORKSPACE_GLOBAL_CTX_H #define GUI_WORKSPACE_GLOBAL_CTX_H -#include "gui/gtk-lumiera.hpp" +#include "gui/gtk-base.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" @@ -89,7 +88,6 @@ namespace workspace { InteractionDirector director_; WindowList windowList_; - Actions actions_; public: @@ -101,7 +99,6 @@ namespace workspace { , uiManager_{manager} , director_{*this} , windowList_{*this} - , actions_{*this} { } private: diff --git a/src/gui/workspace/interaction-director.cpp b/src/gui/workspace/interaction-director.cpp index 08f567de5..3595bfb91 100644 --- a/src/gui/workspace/interaction-director.cpp +++ b/src/gui/workspace/interaction-director.cpp @@ -27,6 +27,7 @@ #include "gui/gtk-base.hpp" +#include "gui/workspace/global-ctx.hpp" #include "gui/workspace/interaction-director.hpp" #include "gui/ui-bus.hpp" #include "gui/ctrl/bus-term.hpp" @@ -53,8 +54,9 @@ namespace workspace { { } - InteractionDirector::InteractionDirector (UiBus& bus) - : model::Controller(proc::mobject::session::Root::getID(), bus.getAccessPoint()) + InteractionDirector::InteractionDirector (GlobalCtx& globals) + : model::Controller(proc::mobject::session::Root::getID(), globals.uiBus_.getAccessPoint()) + , globalCtx_(globals) { } diff --git a/src/gui/workspace/interaction-director.hpp b/src/gui/workspace/interaction-director.hpp index a5df50837..026463ff3 100644 --- a/src/gui/workspace/interaction-director.hpp +++ b/src/gui/workspace/interaction-director.hpp @@ -72,6 +72,7 @@ namespace workspace { //class Actions; //class WindowList; + class GlobalCtx; @@ -83,6 +84,8 @@ namespace workspace { : public model::Controller { + GlobalCtx& globalCtx_; + ////TODO: what is the model equivalent represented here??? /** set up a binding to allow some top-level UI state @@ -92,7 +95,7 @@ namespace workspace { void buildMutator (lib::diff::TreeMutator::Handle) override; public: - InteractionDirector (UiBus& bus); + InteractionDirector (GlobalCtx&); ~InteractionDirector (); diff --git a/src/gui/workspace/ui-manager.cpp b/src/gui/workspace/ui-manager.cpp index 59bb0b58e..a5eb575a4 100644 --- a/src/gui/workspace/ui-manager.cpp +++ b/src/gui/workspace/ui-manager.cpp @@ -35,6 +35,7 @@ #include "gui/config-keys.hpp" #include "gui/workspace/ui-manager.hpp" #include "gui/workspace/global-ctx.hpp" +#include "gui/workspace/actions.hpp" #include "gui/workspace/workspace-window.hpp" #include "lib/searchpath.hpp" #include "lib/util.hpp" @@ -70,6 +71,7 @@ namespace workspace { UiManager::UiManager (UiBus& bus) : Gtk::UIManager() , globals_{new GlobalCtx{bus, *this}} + , actions_{new Actions{*globals_}} , iconSearchPath_{Config::get (KEY_ICON_PATH)} , resourceSerachPath_{Config::get (KEY_UIRES_PATH)} { @@ -104,8 +106,8 @@ namespace workspace { void UiManager::createApplicationWindow() { - if (windowList_->empty()) - windowList_->newWindow(); + if (globals_->windowList_.empty()) + globals_->windowList_.newWindow(); } diff --git a/src/gui/workspace/ui-manager.hpp b/src/gui/workspace/ui-manager.hpp index fd390be90..7bf212a79 100644 --- a/src/gui/workspace/ui-manager.hpp +++ b/src/gui/workspace/ui-manager.hpp @@ -63,6 +63,7 @@ namespace workspace { using std::string; class GlobalCtx; + class Actions; @@ -78,6 +79,7 @@ namespace workspace { { unique_ptr globals_; + unique_ptr actions_; string iconSearchPath_; string resourceSerachPath_; diff --git a/src/gui/workspace/window-list.cpp b/src/gui/workspace/window-list.cpp index 283f7d19e..0f9278bc1 100644 --- a/src/gui/workspace/window-list.cpp +++ b/src/gui/workspace/window-list.cpp @@ -27,7 +27,7 @@ */ -#include "gui/workspace/ui-manager.hpp" +#include "gui/workspace/global-ctx.hpp" #include "gui/workspace/window-list.hpp" #include "gui/workspace/workspace-window.hpp" #include "lib/util.hpp" @@ -45,8 +45,8 @@ namespace workspace { - WindowList::WindowList (UiManager& uiManager) - : uiManager_{uiManager} + WindowList::WindowList (GlobalCtx& globals) + : globalCtx_{globals} , windowList_{} { } @@ -54,7 +54,7 @@ namespace workspace { void WindowList::newWindow () { - PWindow window (new WorkspaceWindow{uiManager_}); + PWindow window (new WorkspaceWindow{globalCtx_.uiManager_}); REQUIRE(window); window->signal_delete_event().connect(sigc::mem_fun( @@ -149,7 +149,7 @@ namespace workspace { void WindowList::updateCloseWindowInMenus() { - uiManager_.allowCloseWindow ( 1 < windowList_.size()); + globalCtx_.uiManager_.allowCloseWindow ( 1 < windowList_.size()); } diff --git a/src/gui/workspace/window-list.hpp b/src/gui/workspace/window-list.hpp index 837a0db3f..389193859 100644 --- a/src/gui/workspace/window-list.hpp +++ b/src/gui/workspace/window-list.hpp @@ -49,7 +49,7 @@ namespace gui { namespace workspace { - class UiManager; + class GlobalCtx; class WorkspaceWindow; using std::list; @@ -64,12 +64,12 @@ namespace workspace { { using PWindow = std::shared_ptr; - UiManager& uiManager_; + GlobalCtx& globalCtx_; list windowList_; public: - WindowList (UiManager&); + WindowList (GlobalCtx&); bool empty() const; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 6e2ebeec5..3f9c2584b 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -1670,10 +1670,6 @@ - - - - @@ -1835,8 +1831,9 @@ - + + @@ -1848,18 +1845,17 @@ - - - - - + + + + + - - - + + @@ -1947,14 +1943,40 @@ - + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + - + @@ -1980,8 +2002,7 @@ das verschiebt das Problem nur

- - +
@@ -2023,50 +2044,19 @@
- + - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - @@ -2095,7 +2085,7 @@ - +