GenNode / Timeline: allow to mutate attribute objects with explicitly given ID
so this seems to be the better approach for dealing with this insidious problem. In some cases -- as here most prominently with the root track within the timeline -- we have to care within the domain model to prepare unique ids even for sub objects treated as attributes. In the actual case, without that special attention, all timelines would hold onto an attribute "fork" with the same ID, based on the type of the nested object plus the string "fork". Thus all root track representations in the GUI would end up listening to the same ID on the UI-Bus...
This commit is contained in:
parent
1bbe903202
commit
7cc68fadea
4 changed files with 22 additions and 7 deletions
|
|
@ -138,6 +138,7 @@ namespace timeline {
|
|||
TimelineController::buildMutator (TreeMutator::Handle buffer)
|
||||
{
|
||||
using PMarker = unique_ptr<MarkerWidget>;
|
||||
auto rootForkID = ID{*fork_};
|
||||
|
||||
buffer.create (
|
||||
TreeMutator::build()
|
||||
|
|
@ -160,13 +161,13 @@ namespace timeline {
|
|||
target->buildMutator (buff); // - delegate to child to build nested TreeMutator
|
||||
return true;
|
||||
}))
|
||||
.mutateAttrib(ATTR_fork, [&](TreeMutator::Handle buff)
|
||||
{ // »Attribute Mutator« : how to enter an object field as nested scope
|
||||
.mutateAttrib(rootForkID, [&](TreeMutator::Handle buff)
|
||||
{ // »Attribute Mutator« : how to enter the track-fork-object field as nested scope
|
||||
REQUIRE (fork_);
|
||||
fork_->buildMutator(buff);
|
||||
})
|
||||
.change(ATTR_name, [&](string val)
|
||||
{ // »Attribute Setter« : how to assign a new value to some object field
|
||||
{ // »Attribute Setter« : how to assign a new value to the name field (object member)
|
||||
name_ = val;
|
||||
}));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -359,6 +359,15 @@ namespace diff{
|
|||
return chainedBuilder<MutationOperation<PAR,CLO>> (key, mutatorBuilderClosure);
|
||||
}
|
||||
|
||||
/** Entry point for DSL builder; variation to handle an attribute-object with given ID */
|
||||
template<class PAR>
|
||||
template<typename CLO>
|
||||
inline auto
|
||||
Builder<PAR>::mutateAttrib (idi::BareEntryID const& rawID, CLO mutatorBuilderClosure)
|
||||
{
|
||||
return chainedBuilder<MutationOperation<PAR,CLO>> (rawID, mutatorBuilderClosure);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}//(END)Mutator-Builder decorator components...
|
||||
|
|
|
|||
|
|
@ -373,7 +373,12 @@ namespace diff{
|
|||
template<typename CLO>
|
||||
auto mutateAttrib (Symbol attributeID, CLO mutatorBuilderClosure);
|
||||
|
||||
///////////////////////////////////////TODO define variant taking a GenNode::ID ??
|
||||
/**
|
||||
* @param rawID the explicitly given ID of an attribute object,
|
||||
* used literally to match the attribute in question
|
||||
*/
|
||||
template<typename CLO>
|
||||
auto mutateAttrib (idi::BareEntryID const& rawID, CLO mutatorBuilderClosure);
|
||||
|
||||
|
||||
/** set up a binding to a structure of "child objects",
|
||||
|
|
|
|||
|
|
@ -21049,7 +21049,7 @@
|
|||
<node CREATED="1541545696185" ID="ID_1907010009" MODIFIED="1541545798109" TEXT="Grund: UI-Bus - Routing">
|
||||
<icon BUILTIN="info"/>
|
||||
</node>
|
||||
<node CREATED="1541545933006" ID="ID_1850412206" MODIFIED="1541547731516" TEXT="tückisches Problem">
|
||||
<node COLOR="#435e98" CREATED="1541545933006" ID="ID_1850412206" MODIFIED="1541800215407" TEXT="tückisches Problem">
|
||||
<linktarget COLOR="#c9876a" DESTINATION="ID_1850412206" ENDARROW="Default" ENDINCLINATION="49;-155;" ID="Arrow_ID_1571993328" SOURCE="ID_787025622" STARTARROW="None" STARTINCLINATION="-11;173;"/>
|
||||
<linktarget COLOR="#c9876a" DESTINATION="ID_1850412206" ENDARROW="Default" ENDINCLINATION="369;179;" ID="Arrow_ID_1229280605" SOURCE="ID_659707505" STARTARROW="None" STARTINCLINATION="586;-203;"/>
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
|
|
@ -21212,7 +21212,7 @@
|
|||
</html>
|
||||
</richcontent>
|
||||
<icon BUILTIN="yes"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1541790717726" ID="ID_1884395735" MODIFIED="1541790738652" TEXT="explizites Attribut-Binding">
|
||||
<node COLOR="#338800" CREATED="1541790717726" ID="ID_1884395735" MODIFIED="1541800179010" TEXT="explizites Attribut-Binding">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
|
|
@ -21224,7 +21224,7 @@
|
|||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1541790780342" ID="ID_683694576" MODIFIED="1541798900109" TEXT="DSL-Syntax">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue