From c1f240687b8fcc11b15e044c440c9d7322ecd0a5 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 23 Sep 2017 01:21:06 +0200 Subject: [PATCH] UI-Coordinates: elaborate and simplify DSL draft (WIP) --- tests/gui/interact/view-spec-dsl-test.cpp | 58 ++++++++++------- wiki/renderengine.html | 64 ++++++++++++------- wiki/thinkPad.ichthyo.mm | 76 ++++++++++++++++------- 3 files changed, 131 insertions(+), 67 deletions(-) diff --git a/tests/gui/interact/view-spec-dsl-test.cpp b/tests/gui/interact/view-spec-dsl-test.cpp index 4e87e3a0e..14b5e3a9c 100644 --- a/tests/gui/interact/view-spec-dsl-test.cpp +++ b/tests/gui/interact/view-spec-dsl-test.cpp @@ -26,9 +26,10 @@ #include "lib/test/run.hpp" -//#include "lib/test/test-helper.hpp" +#include "lib/test/test-helper.hpp" #include "gui/interact/view-spec-dsl.hpp" #include "gui/interact/ui-coord.hpp" +#include "lib/format-cout.hpp" //#include "lib/idi/entry-id.hpp" //#include "lib/diff/gen-node.hpp" //#include "lib/util.hpp" @@ -48,6 +49,7 @@ namespace interact { namespace test { // using lumiera::error::LUMIERA_ERROR_WRONG_TYPE; + using lib::test::showSizeof; namespace { //Test fixture... @@ -84,31 +86,41 @@ namespace test { void verify_standardUsage() { - using LocSpec = Spec; - using CntSpec = Spec; - uint allocCounter = 0; - LocSpec::Builder locationToken =[&](string pathElm) - { - return [pathElm]() - { - return UICoord::currentWindow().view(pathElm); - }; - }; + // Simulation/Example for an allocator-builder + AllocSpec limitAllocation =[&](UICoord target, uint limit) + { + if (allocCounter < limit) + return target.tab(++allocCounter); + else + return target.tab(limit); + }; + /////////TODO verify this... + cout << showSizeof(limitAllocation) < allocationToken =[&](uint limit) - { - return [&,limit](UICoord target) - { - if (allocCounter < target) - return UICoord::currentWindow().view(pathElm).elm(++allocCounter); - else - return UICoord::currentWindow().view(pathElm).elm(limit); - }; - }; - - UNIMPLEMENTED ("demonstrate the standard usage pattern"); + // the actual View Specification would then be written as... + ViewSpec locate = UICoord::currentWindow().view("viewID"); + Allocator alloc = limitAllocation(3); + + // ...and it would be evaluated as follows + UICoord targetLocation = locate; + UICoord realView1 = alloc(targetLocation); + CHECK (1 == allocCounter); + CHECK (realView1 == UICoord::currentWindow().view("viewID").tab("1")); + + UICoord realView2 = alloc(targetLocation); + CHECK (2 == allocCounter); + CHECK (realView2 == UICoord::currentWindow().view("viewID").tab("2")); + CHECK (realView2 != realView); + + UICoord realView3 = alloc(targetLocation); + CHECK (3 == allocCounter); + CHECK (realView3 == UICoord::currentWindow().view("viewID").tab("3")); + + UICoord realView3b = alloc(targetLocation); + CHECK (3 == allocCounter); + CHECK (realView3b == realView3); } diff --git a/wiki/renderengine.html b/wiki/renderengine.html index c23d0772b..6190c5be5 100644 --- a/wiki/renderengine.html +++ b/wiki/renderengine.html @@ -2747,7 +2747,7 @@ Command instances are like prototypes -- thus each additional level of different see the description in &rarr; CommandSetup -
+
//A view within the UI, featuring some component of relevance to »the model«.//
 While any UI is comprised of numerous widgets acting as //view of something,// only some of those views play the prominent role to act as //building block component// of the user interface.
 Such UI component views exhibit some substantial traits
@@ -2785,41 +2785,41 @@ Since view allocation offers a choice amongst several complex patterns of behavi
 ;Timeline
 :add to group of timelines within the timelinePanel
 {{{
-count = unlimited
+alloc = unlimited
 locate = panel(timeline)
 }}}
 ;Viewer
 :here multiple alternatives are conceivable
 :* allow only a single view instance in the whole application
 {{{
-count = onlyOne
+alloc = onlyOne
 locate = external(beamer)
-                or perspective(mediaView), panel(viewer)
+                or perspective(mediaView).panel(viewer)
                 or existingPanel(viewer)
-                or firstWindow, panel(viewer)
+                or firstWindow().panel(viewer)
 }}}
 :* allow two viewer panels (the standard layout of editing applications)
 {{{
-count = limitPerWindow(2)
-locate = perspective(edit), existingPanel(viewer)
-                or currentWindow, existingPanel(viewer)
+alloc = limitPerWindow(2)
+locate = perspective(edit).existingPanel(viewer)
+                or currentWindow().existingPanel(viewer)
                 or existingPanel(viewer)
                 or panel(viewer)
 }}}
 ;(Asset)Bin
 :within the dedicated asset panel, add to the appropriate group for the kind of asset
 {{{
-count = unlimited
-locate = currentWindow, perspective(edit), existingPanel(asset), existingGroup
-                or perspective(asset), panel(asset)
-                or firstWindow, panel(asset)
+alloc = unlimited
+locate = currentWindow().perspective(edit).existingPanel(asset).existingGroup()
+                or perspective(asset).panel(asset)
+                or firstWindow().panel(asset)
 }}}
 ;~Error-Log
 :use the current {{{InfoBoxPanel}}} if such exists, fall back to using a single view on the primary window
 {{{
-count = limitPerWindow(1)
-locate = currentWindow, existingPanel(infobox)
-                or firstWindow, panel(infobox)
+alloc = limitPerWindow(1)
+locate = currentWindow().existingPanel(infobox)
+                or firstWindow().panel(infobox)
 }}}
 ;Playcontrol
 ://not determined yet what we'll need here....//
@@ -2829,13 +2829,19 @@ locate = currentWindow, existingPanel(infobox)
 * the tokens themselves are provided as constants
 * in fact those tokens are functors
 * and are opaquely bound into {{{ViewLocator}}}'s implementation
-__Signatures__:
+
+!!!Signatures
 ;locate
-:is run first and determines the UICoord of the target view
-;count
-:is run on those coordinates and actually //allocates// the view
+:is evaluated first and determines the UICoord of the target view
+:is a disjunction of alternative specs, which are resolved to use the first applicable one
+;alloc
+:the //Allocator// is run on those coordinates and actually //allocates// the view
 :returns coordinates of an (now) existing view
-__Tokens__:
+;allocator specs
+:these are //builder functions// to yield a specifically parametrised allocator
+:typical example is an allocator to create only a limited number of view instances per window
+:the actual builder tokens are synthesised by partial function application on the given lambda
+!!!Spec Tokens
 ;locate
 :firstWindow
 : currentWindow
@@ -2843,7 +2849,7 @@ __Tokens__:
 : panel(id)
 : existingPanel(id)
 : existingGroup {{red{WIP 9/17 not clear if possible}}}
-;count
+;alloc
 : unlimited
 : onlyOne
 : limitPerWindow(cnt)
@@ -9609,6 +9615,22 @@ The dispatch of //diff messages// is directly integrated into the UI-Bus -- whic
 
 The Graphical User interface, the upper layer in this hierarchy, embodies everything of tangible relevance to the user working with the application. The interplay with Proc-Layer, the middle layer below the UI, is organised along the distinction between two realms of equal importance: on one side, there is the immediate //mechanics of the interface,// which is implemented directly within the ~UI-Layer, based on the Graphical User Interface Toolkit. And, on the other side, there are those //core concerns of working with media,// which are cast into the HighLevelModel at the heart of the middle layer.
+
+
//A topological addressing scheme to designate structural locations within the UI.//
+Contrary to conventional screen pixel coordinates, here we aim at a topological description of the UI structure. Such a framework of structural reference allows us                                                                     
+* to refer to some "place" or "space" within the interface                                    
+* to remember and return to such a location
+* to move a [[work focus (»Spot«)|Spot]] structurally within the UI
+* to describe and configure the pattern view access and arrangement
+
+As starting point for the design of such a framework, we'll pick the notion of an access path within a hierarchical structure    
+* the top-level window
+* the perspective used within that window
+* the panel within this window
+* a view group within the panel
+* plus a locally defined access path further down to the actual UI element
+
+
For any kind of playback to happen, timeline elements (or similar model objects) need to be attached to a Viewer element through a special kind of [[binding|BindingMO]], called a ''view connection''. In the most general case, this creates an additional OutputMapping (and in the typical standard case, this boils down to a 1:1 association, sending the master bus of each media kind to the standard OutputDesignation for that kind).
 
diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm
index 1ef9baf74..738e953f9 100644
--- a/wiki/thinkPad.ichthyo.mm
+++ b/wiki/thinkPad.ichthyo.mm
@@ -3856,13 +3856,13 @@
 
 
 
-
+
 
 
 
 
 
-
+
 
 
 
@@ -3878,12 +3878,26 @@
 
 
 
-
+
 
 
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -3891,14 +3905,14 @@
 
 
 
-
+
 
   
     
   
   
     

- count = unlimited + alloc = unlimited

locate = panel(timeline) @@ -3910,46 +3924,46 @@ - +

- count = onlyOne + alloc = onlyOne

locate = external(beamer)

-                or perspective(mediaView), panel(viewer) +                or perspective(mediaView).panel(viewer)

               or existingPanel(viewer)

-                or firstWindow, panel(viewer) +                or firstWindow().panel(viewer)

- +

- count = limitPerWindow(2) + alloc = limitPerWindow(2)

- locate = perspective(edit), existingPanel(viewer) + locate = perspective(edit).existingPanel(viewer)

-                or currentWindow, existingPanel(viewer) +                or currentWindow().existingPanel(viewer)

               or existingPanel(viewer) @@ -3976,23 +3990,23 @@ - +

- count = unlimited + alloc = unlimited

- locate = currentWindow, perspective(edit), existingPanel(asset), existingGroup + locate = currentWindow().perspective(edit).existingPanel(asset).existingGroup()

-                or perspective(asset), panel(asset) +                or perspective(asset)panel(asset)

-                or firstWindow, panel(asset) +                or firstWindow().panel(asset)

@@ -4001,20 +4015,20 @@
- +

- count = limitPerWindow(1) + alloc = limitPerWindow(1)

- locate = currentWindow, existingPanel(infobox) + locate = currentWindow().existingPanel(infobox)

-                or firstWindow, panel(infobox) +                or firstWindow().panel(infobox)

@@ -4052,7 +4066,23 @@ - + + + + + + + + + + + + + + + + +