ViewSpec: pick up with dependency-injection into the DSL tokens (#1126)
Attempt to find my way back to the point where the digression regarding dependency-injection started. As it turns out, this was a valuable digression, since we can rid ourselves from lots of ad-hoc functionality, which basically does in a shitty way what DependencyFactory now provides as standard solution FIRST STEP is to expose the Navigator as generic "LocationQuery" service through lib::Depend<LocationQuery>
This commit is contained in:
parent
fb8a5333fc
commit
71bb2b48b6
6 changed files with 36 additions and 18 deletions
|
|
@ -35,6 +35,7 @@
|
|||
#include "gui/interact/spot-locator.hpp"
|
||||
#include "gui/interact/navigator.hpp"
|
||||
#include "gui/interact/focus-tracker.hpp"
|
||||
#include "gui/interact/ui-coord-resolver.hpp"
|
||||
#include "gui/dialog/preferences-dialog.hpp"
|
||||
#include "gui/dialog/render.hpp"
|
||||
#include "gui/workspace/workspace-window.hpp"
|
||||
|
|
@ -85,7 +86,7 @@ namespace interact {
|
|||
, globalCtx_(globals)
|
||||
, viewLocator_{new ViewLocator{globals, [this]() -> LocationQuery& { return *navigator_; }}}
|
||||
, spotLocator_{new SpotLocator}
|
||||
, navigator_{new Navigator{*spotLocator_, *viewLocator_}}
|
||||
, navigator_{*spotLocator_, *viewLocator_} // Service exposed as Depend<LocationQuery>
|
||||
, tracker_{new FocusTracker{*navigator_}}
|
||||
, uiState_{new UiState{globals.uiBus_.getStateManager(), *tracker_}}
|
||||
, assets_{new AssetController{session::Root::getAssetID(), this->uiBus_}}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
|
||||
//#include "gui/gtk-base.hpp"
|
||||
#include "gui/model/controller.hpp"
|
||||
#include "lib/depend-inject.hpp"
|
||||
|
||||
//#include <cairomm/cairomm.h>
|
||||
//#include <string>
|
||||
|
|
@ -85,8 +86,10 @@ namespace interact {
|
|||
using std::unique_ptr;
|
||||
|
||||
//class Actions;
|
||||
class SpotLocator;
|
||||
class LocationQuery;
|
||||
|
||||
class Navigator;
|
||||
class SpotLocator;
|
||||
class FocusTracker;
|
||||
class ViewLocator;
|
||||
|
||||
|
|
@ -101,10 +104,14 @@ namespace interact {
|
|||
{
|
||||
ctrl::GlobalCtx& globalCtx_;
|
||||
|
||||
// == exposed to Depend on ==
|
||||
using Service_LocationQuery = lib::DependInject<LocationQuery>::ServiceInstance<Navigator>;
|
||||
|
||||
|
||||
// == global Services ==
|
||||
unique_ptr<ViewLocator> viewLocator_;
|
||||
unique_ptr<SpotLocator> spotLocator_;
|
||||
unique_ptr<Navigator> navigator_;
|
||||
Service_LocationQuery navigator_;
|
||||
unique_ptr<FocusTracker> tracker_;
|
||||
|
||||
// == Model globals ==
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
|
||||
/** @file ui-location-resolver.hpp
|
||||
/** @file ui-location-solver.hpp
|
||||
** A solver to match incomplete coordinate specifications against the actual UI topology.
|
||||
** Within the Lumiera UI, a _component view_ is typically _created or retrieved_ to live at some position
|
||||
** within the tree-like topology of the interface. Such happens as a consequence of interaction or other
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
** As a minimum requirement, each LocationRule should be concluded with such a "catch-all" explicit
|
||||
** create clause, which describes the standard location of the element in question.
|
||||
**
|
||||
** @see UILocationResolver_test
|
||||
** @see UILocationSolver_test
|
||||
** @see ViewSpecDSL_test
|
||||
** @see UICoordResolver
|
||||
** @see view-locator.hpp
|
||||
|
|
@ -230,7 +230,7 @@ namespace interact {
|
|||
/**
|
||||
* Service to determine the location of an UI component view.
|
||||
* @see LocationRule
|
||||
* @see UILocationResolver_test::simple_usage_example()
|
||||
* @see UILocationSolver_test::simple_usage_example()
|
||||
*/
|
||||
class UILocationSolver
|
||||
: util::NonCopyable
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ namespace interact {
|
|||
|
||||
/**
|
||||
* A specification to describe the desired location of a component view within the Lumiera UI.
|
||||
* ViewSpec is basically a set of [UI coordinates](\ref UICoord), with the additional possibility
|
||||
* LocatorSpec is basically a set of [UI coordinates](\ref UICoord), with the additional possibility
|
||||
* of specifying several alternatives, with the intention to pick the first applicable one.
|
||||
* @tparam depth the level in the tree addressed by this locator
|
||||
* @remarks Locator is build from a DSL expression, which is basically a UICoord::Builder.
|
||||
|
|
@ -232,7 +232,7 @@ namespace interact {
|
|||
"Additional parameters of the allocator function must match the AllocSpec<ARGS> template parameters");
|
||||
|
||||
|
||||
typedef Tuple<FurtherArgs> ArgTuple;
|
||||
using ArgTuple = Tuple<FurtherArgs>;
|
||||
|
||||
return [=](auto&&... args) -> Allocator
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
* *****************************************************/
|
||||
|
||||
/** @file ui-location-resolver-test.cpp
|
||||
/** @file ui-location-solver-test.cpp
|
||||
** unit test \ref UILocationSolver_test
|
||||
*/
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ namespace test {
|
|||
}
|
||||
|
||||
|
||||
/** @test demonstrate the typical invocation and usage" */
|
||||
/** @test demonstrate the typical invocation and usage */
|
||||
void
|
||||
simple_usage_example()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10416,6 +10416,15 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1522804403692" ID="ID_281326685" MODIFIED="1522804412796" TEXT="globale Variable zurückbauen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1522804419777" ID="ID_631271577" MODIFIED="1522804468779" TEXT="locationQuery">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1522804436623" ID="ID_968463465" MODIFIED="1522804473410" TEXT="view-locator.cpp">
|
||||
<icon BUILTIN="info"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1520721753927" ID="ID_1564232821" MODIFIED="1520721763166" TEXT="DependencyFactory verwenden">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1520721767005" ID="ID_364557801" MODIFIED="1520721776960" TEXT="dazu muß diese erst mal ausgebaut werden"/>
|
||||
|
|
@ -10423,6 +10432,11 @@
|
|||
<arrowlink COLOR="#7188b5" DESTINATION="ID_451964727" ENDARROW="Default" ENDINCLINATION="2227;-4042;" ID="Arrow_ID_1654818003" STARTARROW="None" STARTINCLINATION="775;393;"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1522804252041" HGAP="-15" ID="ID_557569003" MODIFIED="1522804294049" TEXT="Verdrahtung einrichten" VSHIFT="61">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1522804312832" ID="ID_1841038371" MODIFIED="1522804485667" STYLE="fork" TEXT="InteractionDirector -> Navigator == Service LocationQuery"/>
|
||||
<node CREATED="1522804344916" ID="ID_456601994" MODIFIED="1522804392465" TEXT="ViewLocator -> UILocationSolver == Service"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1517507576168" ID="ID_700127725" MODIFIED="1518487921069" TEXT="LocationClause">
|
||||
|
|
@ -28563,8 +28577,7 @@
|
|||
explizit eine Template-Instaniierung triggern, und zwar für
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
<arrowlink COLOR="#b49ca6" DESTINATION="ID_1547993807" ENDARROW="Default" ENDINCLINATION="10;-59;" ID="Arrow_ID_1421481593" STARTARROW="None" STARTINCLINATION="323;-44;"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1522733831301" ID="ID_1741953995" MODIFIED="1522733846627" TEXT="Spezialisierung + explizite Template-Instanz">
|
||||
|
|
@ -28680,8 +28693,7 @@
|
|||
<b>Problem</b> ist nun, diese umgeleiteten Funktionsdefinitionen können <i>nur einen Typ</i> (Template-Parameter) bekommen, und dieser Typ wiederum muß -- zumindest als abstrakter Platzhalter -- in allen TU sichtbar sein.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1522709471957" ID="ID_170352206" MODIFIED="1522709540572" TEXT="scheint nicht lösbar">
|
||||
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
||||
|
|
@ -28737,8 +28749,7 @@
|
|||
Allerdings erscheint es mir nicht sinnvoll, hier mit Tricksereien zu arbeiten!
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
</node>
|
||||
<node CREATED="1522733618506" ID="ID_1873321000" MODIFIED="1522733895572" TEXT="man könnte stattdesen Link instantiieren">
|
||||
<icon BUILTIN="idea"/>
|
||||
|
|
@ -28772,8 +28783,7 @@
|
|||
da nur wenige Variable erstetzt werden müßten.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue