define the diff bindings for the ClipPresenter

This commit is contained in:
Fischlurch 2016-12-04 00:10:59 +01:00
parent 803a71cc31
commit 6eeb23df9e
2 changed files with 51 additions and 30 deletions

View file

@ -46,6 +46,8 @@
//using util::_Fmt; //using util::_Fmt;
using lib::diff::TreeMutator; using lib::diff::TreeMutator;
using lib::diff::collection;
using std::make_unique;
//using util::contains; //using util::contains;
//using Gtk::Widget; //using Gtk::Widget;
//using sigc::mem_fun; //using sigc::mem_fun;
@ -82,57 +84,69 @@ namespace timeline {
void void
ClipPresenter::buildMutator (TreeMutator::Handle buffer) ClipPresenter::buildMutator (TreeMutator::Handle buffer)
{ {
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1039 using PChannel = unique_ptr<ClipPresenter>;
using Attrib = std::pair<const string,string>; using PEffect = unique_ptr<ClipPresenter>;
using lib::diff::collection; using PMarker = unique_ptr<MarkerWidget>;
buffer.create ( buffer.create (
TreeMutator::build() TreeMutator::build()
.attach (collection(scope) .attach (collection(markers_)
.isApplicableIf ([&](GenNode const& spec) -> bool .isApplicableIf ([&](GenNode const& spec) -> bool
{ { // »Selector« : require object-like sub scope with type-field "Marker"
return spec.data.isNested(); // »Selector« : require object-like sub scope return "Marker" == spec.data.recordType();
}) })
.matchElement ([&](GenNode const& spec, PMockElm const& elm) -> bool .matchElement ([&](GenNode const& spec, PMarker const& elm) -> bool
{ {
return spec.idi == elm->getID(); return spec.idi == ID(elm);
}) })
.constructFrom ([&](GenNode const& spec) -> PMockElm .constructFrom ([&](GenNode const& spec) -> PMarker
{ {
PMockElm child = std::make_unique<MockElm>(spec.idi, this->uiBus_); return make_unique<MarkerWidget>(spec.idi, this->uiBus_);
return child;
}) })
.buildChildMutator ([&](PMockElm& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool .buildChildMutator ([&](PMarker& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool
{ {
if (target->getID() != subID) return false; //require match on already existing child object if (ID(target) != subID) return false;
target->buildMutator (buff); // delegate to child to build nested TreeMutator target->buildMutator (buff);
return true; return true;
})) }))
.attach (collection(attrib) .attach (collection(effects_)
.isApplicableIf ([&](GenNode const& spec) -> bool .isApplicableIf ([&](GenNode const& spec) -> bool
{ { // »Selector« : require object-like sub scope with type-field "Effect"
return spec.isNamed() // »Selector« : accept attribute-like values return "Effect" == spec.data.recordType();
and not spec.data.isNested(); // but no nested objects
}) })
.matchElement ([&](GenNode const& spec, Attrib const& elm) -> bool .matchElement ([&](GenNode const& spec, PEffect const& elm) -> bool
{ {
return elm.first == spec.idi.getSym(); return spec.idi == ID(elm);
}) })
.constructFrom ([&](GenNode const& spec) -> Attrib .constructFrom ([&](GenNode const& spec) -> PEffect
{ {
string key{spec.idi.getSym()}, return make_unique<ClipPresenter>(spec.idi, this->uiBus_);
val{render(spec.data)};
return {key, val};
}) })
.assignElement ([&](Attrib& target, GenNode const& spec) -> bool .buildChildMutator ([&](PEffect& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool
{ {
string key{spec.idi.getSym()}, if (ID(target) != subID) return false;
newVal{render (spec.data)}; target->buildMutator (buff);
target.second = newVal; return true;
}))
.attach (collection(channels_)
.isApplicableIf ([&](GenNode const& spec) -> bool
{ // »Selector« : require object-like sub scope with type-field "Channel"
return "Channel" == spec.data.recordType();
})
.matchElement ([&](GenNode const& spec, PChannel const& elm) -> bool
{
return spec.idi == ID(elm);
})
.constructFrom ([&](GenNode const& spec) -> PChannel
{
return make_unique<ClipPresenter>(spec.idi, this->uiBus_);
})
.buildChildMutator ([&](PChannel& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool
{
if (ID(target) != subID) return false;
target->buildMutator (buff);
return true; return true;
}))); })));
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1039
UNIMPLEMENTED ("diff mutation binding for the ClipPresenter");
} }

View file

@ -83,6 +83,13 @@ namespace timeline {
/**
* @note we distinguish between the contents of our three nested child collections
* based on the symbolic type field send in the Record type within the diff representation
* - "Marker" designates a Marker object
* - "Clip" designates a Clip placed on this track
* - "Fork" designates a nested sub-track
*/
void void
TrackPresenter::buildMutator (TreeMutator::Handle buffer) TrackPresenter::buildMutator (TreeMutator::Handle buffer)
{ {