From 60adaa5639da261349959e98f6a5e394b3645ec0 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 19 Feb 2017 04:27:09 +0100 Subject: [PATCH] UI-top-level: simplify name and namespace the (Presentation)StateManager interface and implementation seems to fit in more into the ctrl package --- .../state-manager.hpp} | 18 +++--- .../state-map-grouping-storage.hpp | 4 +- src/gui/{interact => ctrl}/state-recorder.hpp | 16 ++--- src/gui/ctrl/ui-state.cpp | 5 ++ .../interact/presentation-state-manager.cpp | 62 ------------------- src/gui/ui-bus.hpp | 2 + tests/gui/bus-term-test.cpp | 8 +-- .../state-map-grouping-storage-test.cpp | 4 +- tests/gui/test/test-nexus.cpp | 12 ++-- tests/gui/test/test-nexus.hpp | 6 +- 10 files changed, 41 insertions(+), 96 deletions(-) rename src/gui/{interact/presentation-state-manager.hpp => ctrl/state-manager.hpp} (89%) rename src/gui/{interact => ctrl}/state-map-grouping-storage.hpp (99%) rename src/gui/{interact => ctrl}/state-recorder.hpp (94%) delete mode 100644 src/gui/interact/presentation-state-manager.cpp diff --git a/src/gui/interact/presentation-state-manager.hpp b/src/gui/ctrl/state-manager.hpp similarity index 89% rename from src/gui/interact/presentation-state-manager.hpp rename to src/gui/ctrl/state-manager.hpp index c8fe47b68..0362fd7d3 100644 --- a/src/gui/interact/presentation-state-manager.hpp +++ b/src/gui/ctrl/state-manager.hpp @@ -1,5 +1,5 @@ /* - PRESENTATION-STATE-MANAGER.hpp - maintaining persistent interface state + STATE-MANAGER.hpp - maintaining persistent interface state Copyright (C) Lumiera.org 2016, Hermann Vosseler @@ -21,7 +21,7 @@ */ -/** @file presentation-state-manager.hpp +/** @file state-manager.hpp ** Interface: a component to maintain persistent interface state. ** Here, "presentation state" is understood as state not rooted within the ** model and without effect on the final rendered result. Most of this state @@ -49,8 +49,8 @@ */ -#ifndef GUI_INTERACT_PRESENTATION_STATE_MANAGER_H -#define GUI_INTERACT_PRESENTATION_STATE_MANAGER_H +#ifndef GUI_CTRL_STATE_MANAGER_H +#define GUI_CTRL_STATE_MANAGER_H #include "lib/idi/entry-id.hpp" @@ -61,7 +61,7 @@ namespace gui { -namespace interact { +namespace ctrl { using std::string; @@ -76,11 +76,11 @@ namespace interact { * element, and recorded per distinct property within each * element. */ - class PresentationStateManager + class StateManager : boost::noncopyable { protected: - virtual ~PresentationStateManager(); ///< this is an interface + virtual ~StateManager(); ///< this is an interface using ID = lib::idi::BareEntryID const&; using StateMark = lib::diff::GenNode const&; @@ -109,5 +109,5 @@ namespace interact { -}} // namespace gui::interact -#endif /*GUI_INTERACT_PRESENTATION_STATE_MANAGER_H*/ +}} // namespace gui::ctrl +#endif /*GUI_CTRL_STATE_MANAGER_H*/ diff --git a/src/gui/interact/state-map-grouping-storage.hpp b/src/gui/ctrl/state-map-grouping-storage.hpp similarity index 99% rename from src/gui/interact/state-map-grouping-storage.hpp rename to src/gui/ctrl/state-map-grouping-storage.hpp index 6e110473a..25be8c5c4 100644 --- a/src/gui/interact/state-map-grouping-storage.hpp +++ b/src/gui/ctrl/state-map-grouping-storage.hpp @@ -49,7 +49,7 @@ namespace gui { -namespace interact { +namespace ctrl { using lib::idi::BareEntryID; using lib::diff::GenNode; @@ -222,5 +222,5 @@ namespace interact { -}} // namespace gui::interact +}} // namespace gui::ctrl #endif /*GUI_INTERACT_STATE_MAP_GROUPING_STORAGE_H*/ diff --git a/src/gui/interact/state-recorder.hpp b/src/gui/ctrl/state-recorder.hpp similarity index 94% rename from src/gui/interact/state-recorder.hpp rename to src/gui/ctrl/state-recorder.hpp index cb2d10178..47d15ee1e 100644 --- a/src/gui/interact/state-recorder.hpp +++ b/src/gui/ctrl/state-recorder.hpp @@ -49,22 +49,22 @@ */ -#ifndef GUI_INTERACT_STATE_RECORDER_H -#define GUI_INTERACT_STATE_RECORDER_H +#ifndef GUI_CTRL_STATE_RECORDER_H +#define GUI_CTRL_STATE_RECORDER_H #include "lib/error.hpp" #include "lib/idi/entry-id.hpp" #include "lib/diff/gen-node.hpp" #include "gui/ctrl/bus-term.hpp" -#include "gui/interact/presentation-state-manager.hpp" -#include "gui/interact/state-map-grouping-storage.hpp" +#include "gui/ctrl/state-manager.hpp" +#include "gui/ctrl/state-map-grouping-storage.hpp" #include namespace gui { -namespace interact { +namespace ctrl { using gui::ctrl::BusTerm; using lib::diff::GenNode; @@ -89,7 +89,7 @@ namespace interact { * @see StateMapGroupingStorage storage implementation */ class StateRecorder - : public PresentationStateManager + : public StateManager { using Storage = StateMapGroupingStorage; using Record = Storage::Record const&; @@ -198,5 +198,5 @@ namespace interact { -}} // namespace gui::interact -#endif /*GUI_INTERACT_STATE_RECORDER_H*/ +}} // namespace gui::ctrl +#endif /*GUI_CTRL_STATE_RECORDER_H*/ diff --git a/src/gui/ctrl/ui-state.cpp b/src/gui/ctrl/ui-state.cpp index 5cd9c331d..bb1337bb9 100644 --- a/src/gui/ctrl/ui-state.cpp +++ b/src/gui/ctrl/ui-state.cpp @@ -29,6 +29,7 @@ //#include "gui/gtk-lumiera.hpp" #include "gui/ctrl/ui-state.hpp" +#include "gui/ctrl/state-manager.hpp" #include "gui/interact/focus-tracker.hpp" //#include "gui/ctrl/global-ctx.hpp" //#include "lib/util.hpp" @@ -43,6 +44,10 @@ namespace ctrl { using interact::FocusTracker; + // emit VTable here... + StateManager::~StateManager() + { } + // emit nested dtor code here... UiState::~UiState() { } diff --git a/src/gui/interact/presentation-state-manager.cpp b/src/gui/interact/presentation-state-manager.cpp deleted file mode 100644 index eb3efcb30..000000000 --- a/src/gui/interact/presentation-state-manager.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - PresentationStateManager - maintaining persistent interface state - - Copyright (C) Lumiera.org - 2016, Hermann Vosseler - - 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 presentation-state-manager.cpp - ** Implementation details of persistent presentation state organisation. - ** - ** @see BusTerm_test - ** - */ - - -//#include "lib/util.hpp" -//#include "lib/symbol.hpp" -//#include "include/logging.h" -#include "gui/interact/presentation-state-manager.hpp" - -//#include -//#include -//#include - -//using std::map; -//using std::string; - -//using util::contains; -//using util::isnil; - -namespace gui { -namespace interact { - - namespace { // internal details - - } // internal details - - - PresentationStateManager::~PresentationStateManager() { } // Emit VTables here... - - - - - /** nonsense */ - -}} // namespace gui::interact diff --git a/src/gui/ui-bus.hpp b/src/gui/ui-bus.hpp index db01ee4ab..cf586b263 100644 --- a/src/gui/ui-bus.hpp +++ b/src/gui/ui-bus.hpp @@ -136,7 +136,9 @@ namespace gui { }// namespace gui::controller ///////////////////////////////////////////////////////////////////////////////////TICKET #959 : scheduled for termination.... + namespace ctrl { + class StateManager; class CoreService; class BusTerm; } diff --git a/tests/gui/bus-term-test.cpp b/tests/gui/bus-term-test.cpp index 8e432b12d..2a1fa7e45 100644 --- a/tests/gui/bus-term-test.cpp +++ b/tests/gui/bus-term-test.cpp @@ -24,7 +24,7 @@ #include "lib/test/run.hpp" #include "lib/test/test-helper.hpp" #include "gui/ctrl/bus-term.hpp" -#include "gui/interact/presentation-state-manager.hpp" +#include "gui/ctrl/state-manager.hpp" #include "test/test-nexus.hpp" #include "test/mock-elm.hpp" #include "lib/idi/entry-id.hpp" @@ -38,7 +38,7 @@ using lib::idi::EntryID; using lib::idi::BareEntryID; -using gui::interact::PresentationStateManager; +using gui::ctrl::StateManager; using gui::ctrl::BusTerm; using gui::test::MockElm; using lib::diff::GenNode; @@ -244,7 +244,7 @@ namespace test { { MARK_TEST_FUN gui::test::Nexus::startNewLog(); - PresentationStateManager& stateManager = gui::test::Nexus::useMockStateManager(); + StateManager& stateManager = gui::test::Nexus::useMockStateManager(); MockElm mockA("alpha"); BareEntryID alpha = mockA.getID(); MockElm mockB("bravo"); BareEntryID bravo = mockB.getID(); @@ -287,7 +287,7 @@ namespace test { replayStateMark() { MARK_TEST_FUN - PresentationStateManager& stateManager = gui::test::Nexus::getMockStateManager(); + StateManager& stateManager = gui::test::Nexus::getMockStateManager(); MockElm mockA("alpha"); // no "bravo" this time diff --git a/tests/gui/interact/state-map-grouping-storage-test.cpp b/tests/gui/interact/state-map-grouping-storage-test.cpp index 9c0300d2a..625172ffc 100644 --- a/tests/gui/interact/state-map-grouping-storage-test.cpp +++ b/tests/gui/interact/state-map-grouping-storage-test.cpp @@ -23,7 +23,7 @@ #include "lib/test/run.hpp" #include "lib/test/test-helper.hpp" -#include "gui/interact/state-map-grouping-storage.hpp" +#include "gui/ctrl/state-map-grouping-storage.hpp" #include "lib/idi/entry-id.hpp" #include "lib/diff/gen-node.hpp" #include "lib/util.hpp" @@ -39,7 +39,7 @@ using util::isnil; namespace gui { -namespace interact{ +namespace ctrl { namespace test { using lumiera::error::LUMIERA_ERROR_WRONG_TYPE; diff --git a/tests/gui/test/test-nexus.cpp b/tests/gui/test/test-nexus.cpp index 8e22a0e63..d4145d64f 100644 --- a/tests/gui/test/test-nexus.cpp +++ b/tests/gui/test/test-nexus.cpp @@ -50,7 +50,7 @@ #include "lib/test/event-log.hpp" #include "gui/ctrl/nexus.hpp" #include "gui/ctrl/mutation-message.hpp" -#include "gui/interact/state-recorder.hpp" +#include "gui/ctrl/state-recorder.hpp" #include "proc/control/command.hpp" #include "lib/diff/gen-node.hpp" #include "lib/idi/entry-id.hpp" @@ -77,8 +77,8 @@ using lib::idi::instanceTypeID; using lib::test::EventLog; using gui::ctrl::BusTerm; using gui::ctrl::MutationMessage; -using gui::interact::PresentationStateManager; -using gui::interact::StateRecorder; +using gui::ctrl::StateManager; +using gui::ctrl::StateRecorder; using proc::control::Command; using proc::control::CommandImpl; using proc::control::HandlingPattern; @@ -609,7 +609,7 @@ namespace test{ : StateRecorder{testNexus()} { } - using PresentationStateManager::clearState; + using StateManager::clearState; }; lib::Depend stateManager; @@ -626,7 +626,7 @@ namespace test{ * notification messages appearing after that point * at the test-UI-Bus will be accounted for. */ - interact::PresentationStateManager& + ctrl::StateManager& Nexus::useMockStateManager() { // discard possible leftover @@ -642,7 +642,7 @@ namespace test{ return getMockStateManager(); } - interact::PresentationStateManager& + ctrl::StateManager& Nexus::getMockStateManager() { return stateManager(); diff --git a/tests/gui/test/test-nexus.hpp b/tests/gui/test/test-nexus.hpp index 8b0909241..a0cd9727f 100644 --- a/tests/gui/test/test-nexus.hpp +++ b/tests/gui/test/test-nexus.hpp @@ -48,7 +48,7 @@ #include "lib/error.hpp" #include "gui/ctrl/bus-term.hpp" #include "gui/model/tangible.hpp" -#include "gui/interact/presentation-state-manager.hpp" +#include "gui/ctrl/state-manager.hpp" #include "test/placeholder-command.hpp" #include "lib/test/event-log.hpp" #include "lib/diff/gen-node.hpp" @@ -97,8 +97,8 @@ namespace test{ static void setStateMarkHandler (StateMarkHandler =StateMarkHandler()); - static interact::PresentationStateManager& useMockStateManager(); - static interact::PresentationStateManager& getMockStateManager(); + static ctrl::StateManager& useMockStateManager(); + static ctrl::StateManager& getMockStateManager(); using Cmd = interact::InvocationTrail;