flesh out the buildup of the control hierarchy

TODO
 - define the actual diff bindings
 - find out how to inject the views
This commit is contained in:
Fischlurch 2016-12-03 06:22:21 +01:00
parent f995dd51e2
commit 8666daca94
7 changed files with 297 additions and 13 deletions

View file

@ -44,6 +44,7 @@
//using util::_Fmt;
using lib::diff::TreeMutator;
//using util::contains;
//using Gtk::Widget;
//using sigc::mem_fun;
@ -59,8 +60,11 @@ namespace timeline {
ClipPresenter::ClipPresenter ()
ClipPresenter::ClipPresenter (ID identity, ctrl::BusTerm& nexus)
: Controller{identity, nexus}
, widget_{}
{
UNIMPLEMENTED ("how inject the ClipWidget into the appropriate GTK display context");
}
@ -71,4 +75,63 @@ namespace timeline {
void
ClipPresenter::buildMutator (TreeMutator::Handle buffer)
{
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1039
using Attrib = std::pair<const string,string>;
using lib::diff::collection;
buffer.create (
TreeMutator::build()
.attach (collection(scope)
.isApplicableIf ([&](GenNode const& spec) -> bool
{
return spec.data.isNested(); // »Selector« : require object-like sub scope
})
.matchElement ([&](GenNode const& spec, PMockElm const& elm) -> bool
{
return spec.idi == elm->getID();
})
.constructFrom ([&](GenNode const& spec) -> PMockElm
{
PMockElm child = std::make_unique<MockElm>(spec.idi, this->uiBus_);
return child;
})
.buildChildMutator ([&](PMockElm& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool
{
if (target->getID() != subID) return false; //require match on already existing child object
target->buildMutator (buff); // delegate to child to build nested TreeMutator
return true;
}))
.attach (collection(attrib)
.isApplicableIf ([&](GenNode const& spec) -> bool
{
return spec.isNamed() // »Selector« : accept attribute-like values
and not spec.data.isNested(); // but no nested objects
})
.matchElement ([&](GenNode const& spec, Attrib const& elm) -> bool
{
return elm.first == spec.idi.getSym();
})
.constructFrom ([&](GenNode const& spec) -> Attrib
{
string key{spec.idi.getSym()},
val{render(spec.data)};
return {key, val};
})
.assignElement ([&](Attrib& target, GenNode const& spec) -> bool
{
string key{spec.idi.getSym()},
newVal{render (spec.data)};
target.second = newVal;
return true;
})));
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1039
UNIMPLEMENTED ("diff mutation binding for the ClipPresenter");
}
}}// namespace gui::timeline

View file

@ -52,6 +52,8 @@
#define GUI_TIMELINE_CLIP_PRESENTER_H
#include "gui/gtk-base.hpp"
#include "gui/model/controller.hpp"
#include "gui/timeline/clip-widget.hpp"
//#include "lib/util.hpp"
@ -68,13 +70,27 @@ namespace timeline {
* @todo WIP-WIP as of 12/2016
*/
class ClipPresenter
: public model::Controller
{
ClipWidget widget_;
//////////////////////////TODO collection for the Effects
//////////////////////////TODO collection for the Labels
public:
ClipPresenter();
/**
* @param identity used to refer to a corresponding session::Fork in the Session
* @param nexus a way to connect this Controller to the UI-Bus.
*/
ClipPresenter (ID identity, ctrl::BusTerm& nexus);
~ClipPresenter();
private:/* ===== Internals ===== */
/** set up a binding to respond to mutation messages via UiBus */
virtual void buildMutator (lib::diff::TreeMutator::Handle) override;
};

View file

@ -23,6 +23,14 @@
/** @file timeline-controller.cpp
** Implementation details of timeline operation management and control.
** - we build a binding to allow TimelineController to handle mutation messages
** on behalf of "the timeline". While the setup of a Timeline is quite flexible
** at the session level, here, when it comes to UI presentation, it can be
** boiled down to
** + a name
** + a single mandatory root track (which in turn could hold nested tracks)
** - thus we get a rather simple mapping, with some fixed attributes and no
** flexible child collection. The root track is implemented as TrackPresenter.
**
** @todo as of 12/2016 a complete rework of the timeline display is underway
** @see TimelineWidget
@ -32,6 +40,7 @@
#include "gui/gtk-lumiera.hpp"
#include "gui/timeline/timeline-controller.hpp"
#include "gui/timeline/track-presenter.hpp"
//#include "gui/workspace/workspace-window.hpp"
//#include "gui/ui-bus.hpp"
@ -68,7 +77,9 @@ namespace timeline {
TimelineController::TimelineController (ID identity, ctrl::BusTerm& nexus)
: Controller{identity, nexus}
, fork_{} /////////////////////////////////////////////////////////////////////////////////////TODO note that the TrackPresenter will be built later, when the diff assigns the property!!!
{
UNIMPLEMENTED ("how to make the controller operative...");
}
@ -77,6 +88,61 @@ namespace timeline {
}
void
TimelineController::buildMutator (TreeMutator::Handle buffer)
{
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1039
using Attrib = std::pair<const string,string>;
using lib::diff::collection;
buffer.create (
TreeMutator::build()
.attach (collection(scope)
.isApplicableIf ([&](GenNode const& spec) -> bool
{
return spec.data.isNested(); // »Selector« : require object-like sub scope
})
.matchElement ([&](GenNode const& spec, PMockElm const& elm) -> bool
{
return spec.idi == elm->getID();
})
.constructFrom ([&](GenNode const& spec) -> PMockElm
{
PMockElm child = std::make_unique<MockElm>(spec.idi, this->uiBus_);
return child;
})
.buildChildMutator ([&](PMockElm& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool
{
if (target->getID() != subID) return false; //require match on already existing child object
target->buildMutator (buff); // delegate to child to build nested TreeMutator
return true;
}))
.attach (collection(attrib)
.isApplicableIf ([&](GenNode const& spec) -> bool
{
return spec.isNamed() // »Selector« : accept attribute-like values
and not spec.data.isNested(); // but no nested objects
})
.matchElement ([&](GenNode const& spec, Attrib const& elm) -> bool
{
return elm.first == spec.idi.getSym();
})
.constructFrom ([&](GenNode const& spec) -> Attrib
{
string key{spec.idi.getSym()},
val{render(spec.data)};
return {key, val};
})
.assignElement ([&](Attrib& target, GenNode const& spec) -> bool
{
string key{spec.idi.getSym()},
newVal{render (spec.data)};
target.second = newVal;
return true;
})));
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1039
UNIMPLEMENTED ("diff mutation binding for the TimelineController");
}

View file

@ -58,7 +58,7 @@
#include "lib/time/timevalue.hpp"
//#include <memory>
#include <memory>
//#include <vector>
@ -66,6 +66,8 @@
namespace gui {
namespace timeline {
class TrackPresenter;
/**
* Controller to supervise the timeline display.
@ -78,6 +80,8 @@ namespace timeline {
class TimelineController
: public model::Controller
{
std::unique_ptr<TrackPresenter> fork_;
public:
/**
* @param identity used to refer to a corresponding timeline element in the Session

View file

@ -31,6 +31,7 @@
#include "gui/gtk-lumiera.hpp"
#include "gui/timeline/track-presenter.hpp"
#include "gui/timeline/clip-presenter.hpp"
//#include "gui/ui-bus.hpp"
//#include "lib/format-string.hpp"
@ -44,6 +45,7 @@
//using util::_Fmt;
using lib::diff::TreeMutator;
//using util::contains;
//using Gtk::Widget;
//using sigc::mem_fun;
@ -59,8 +61,12 @@ namespace timeline {
TrackPresenter::TrackPresenter ()
TrackPresenter::TrackPresenter (ID identity, ctrl::BusTerm& nexus)
: Controller{identity, nexus}
, subFork_{}
, clips_{}
{
UNIMPLEMENTED ("how to attach the TrackPresenter into the two relevant GTK display contexts");
}
@ -71,4 +77,63 @@ namespace timeline {
void
TrackPresenter::buildMutator (TreeMutator::Handle buffer)
{
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1039
using Attrib = std::pair<const string,string>;
using lib::diff::collection;
buffer.create (
TreeMutator::build()
.attach (collection(scope)
.isApplicableIf ([&](GenNode const& spec) -> bool
{
return spec.data.isNested(); // »Selector« : require object-like sub scope
})
.matchElement ([&](GenNode const& spec, PMockElm const& elm) -> bool
{
return spec.idi == elm->getID();
})
.constructFrom ([&](GenNode const& spec) -> PMockElm
{
PMockElm child = std::make_unique<MockElm>(spec.idi, this->uiBus_);
return child;
})
.buildChildMutator ([&](PMockElm& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool
{
if (target->getID() != subID) return false; //require match on already existing child object
target->buildMutator (buff); // delegate to child to build nested TreeMutator
return true;
}))
.attach (collection(attrib)
.isApplicableIf ([&](GenNode const& spec) -> bool
{
return spec.isNamed() // »Selector« : accept attribute-like values
and not spec.data.isNested(); // but no nested objects
})
.matchElement ([&](GenNode const& spec, Attrib const& elm) -> bool
{
return elm.first == spec.idi.getSym();
})
.constructFrom ([&](GenNode const& spec) -> Attrib
{
string key{spec.idi.getSym()},
val{render(spec.data)};
return {key, val};
})
.assignElement ([&](Attrib& target, GenNode const& spec) -> bool
{
string key{spec.idi.getSym()},
newVal{render (spec.data)};
target.second = newVal;
return true;
})));
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1039
UNIMPLEMENTED ("diff mutation binding for the TrackPresenter");
}
}}// namespace gui::timeline

View file

@ -47,29 +47,45 @@
#define GUI_TIMELINE_TRACK_PRESENTER_H
#include "gui/gtk-base.hpp"
#include "gui/model/controller.hpp"
//#include "lib/util.hpp"
//#include <memory>
//#include <vector>
#include <vector>
namespace gui {
namespace timeline {
class ClipPresenter;
/**
* @todo WIP-WIP as of 12/2016
*/
class TrackPresenter
: public model::Controller
{
std::vector<std::unique_ptr<TrackPresenter>> subFork_;
std::vector<std::unique_ptr<ClipPresenter>> clips_;
public:
TrackPresenter ();
/**
* @param identity used to refer to a corresponding session::Fork in the Session
* @param nexus a way to connect this Controller to the UI-Bus.
*/
TrackPresenter (ID identity, ctrl::BusTerm& nexus);
~TrackPresenter();
private:/* ===== Internals ===== */
/** set up a binding to respond to mutation messages via UiBus */
virtual void buildMutator (lib::diff::TreeMutator::Handle) override;
};

View file

@ -602,7 +602,11 @@
<node CREATED="1480725273775" ID="ID_1495656573" MODIFIED="1480725279987" TEXT="Bus-Term-Referenz"/>
</node>
</node>
<node CREATED="1480725377994" ID="ID_172881069" MODIFIED="1480725379629" TEXT="verwalten"/>
<node CREATED="1480725377994" ID="ID_172881069" MODIFIED="1480725379629" TEXT="verwalten">
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1480741524775" ID="ID_661893589" MODIFIED="1480741531814" TEXT="Bindings einrichten">
<icon BUILTIN="flag-yellow"/>
</node>
</node>
</node>
<node CREATED="1480694550601" ID="ID_391329400" MODIFIED="1480694554372" TEXT="TimelineController">
<node CREATED="1480694557112" ID="ID_786517324" MODIFIED="1480694570434" TEXT="Widget ist Startpunkt"/>
@ -646,17 +650,67 @@
</node>
</node>
</node>
<node CREATED="1480741498930" ID="ID_1605140473" MODIFIED="1480741509309" TEXT="hat nur einen einziten RootTrack">
<icon BUILTIN="idea"/>
</node>
<node CREATED="1480742405505" ID="ID_1590367176" MODIFIED="1480742416770" TEXT="ACHTUNG: kann leer sein">
<icon BUILTIN="messagebox_warning"/>
<node CREATED="1480742420383" ID="ID_19092812" MODIFIED="1480742430313" TEXT="kann ihn nicht gleich im ctor erzeugen"/>
<node CREATED="1480742432749" ID="ID_1840237751" MODIFIED="1480742437344" TEXT="denn wir brauchen die ID"/>
<node CREATED="1480742437892" ID="ID_1335490062" MODIFIED="1480742444383" TEXT="und die kann nur &#xfc;ber den Bus kommen"/>
<node CREATED="1480742445563" ID="ID_1224591813" MODIFIED="1480742457934" TEXT="also m&#xfc;ssen wir warten, bis das Attribut zugewiesen wird"/>
</node>
</node>
<node CREATED="1480606985087" ID="ID_885244508" MODIFIED="1480639465600" TEXT="Layout-Manager">
<node CREATED="1480639469981" ID="ID_983391388" MODIFIED="1480639472833" TEXT="Abstraktionen"/>
<node CREATED="1480639473324" ID="ID_191170582" MODIFIED="1480639510996" TEXT="eval pass"/>
</node>
<node CREATED="1480606973713" ID="ID_163713350" MODIFIED="1480606978899" TEXT="Track-Presenter"/>
<node CREATED="1480606973713" ID="ID_163713350" MODIFIED="1480606978899" TEXT="Track-Presenter">
<node CREATED="1480741594101" ID="ID_1017414696" MODIFIED="1480741611300" TEXT="mit doppeltem Display-Kontext verbinden"/>
<node CREATED="1480741545196" ID="ID_1657879480" MODIFIED="1480741551055" TEXT="TrackWidget">
<node CREATED="1480741552611" ID="ID_1987203186" MODIFIED="1480741554982" TEXT="erzeugen"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1480741555930" ID="ID_1869427213" MODIFIED="1480741587463">
<richcontent TYPE="NODE"><html>
<head>
</head>
<body>
<p>
wie in Kopf <i>und</i>&#160;Rumpf injizieren
</p>
</body>
</html>
</richcontent>
<icon BUILTIN="help"/>
</node>
</node>
</node>
<node CREATED="1480607029673" ID="ID_619470641" MODIFIED="1480607052500" TEXT="Track-Anzeige">
<node CREATED="1480607033512" ID="ID_1815699851" MODIFIED="1480607035268" TEXT="Kopf"/>
<node CREATED="1480607035712" ID="ID_1405339006" MODIFIED="1480607037355" TEXT="Rumpf"/>
</node>
<node CREATED="1480621574221" ID="ID_1217785331" MODIFIED="1480621619049" TEXT="ClipPresenter"/>
<node CREATED="1480621574221" ID="ID_1217785331" MODIFIED="1480621619049" TEXT="ClipPresenter">
<node CREATED="1480741362389" ID="ID_328415412" MODIFIED="1480741369023" TEXT="ClipWidget">
<node CREATED="1480741370347" ID="ID_1275685315" MODIFIED="1480741373623" TEXT="erzeugen"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1480741374451" ID="ID_1270677756" MODIFIED="1480741382099" TEXT="in Display injizieren">
<icon BUILTIN="flag-yellow"/>
</node>
</node>
<node CREATED="1480741386769" ID="ID_1808095573" MODIFIED="1480741388972" TEXT="Kinder">
<node CREATED="1480741389777" ID="ID_1548768233" MODIFIED="1480741396471" TEXT="welche kommen in Frage">
<icon BUILTIN="help"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1480741397880" ID="ID_299590632" MODIFIED="1480741452337" TEXT="Effekte als ClipPresenter implementieren??">
<icon BUILTIN="help"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1480741425668" ID="ID_826648354" MODIFIED="1480741461359" TEXT="wie Labels implementieren. Tangible Widget??">
<icon BUILTIN="help"/>
</node>
<node CREATED="1480741466519" ID="ID_29080454" MODIFIED="1480741471654" TEXT="das werden zwei Collections">
<icon BUILTIN="messagebox_warning"/>
</node>
</node>
</node>
<node CREATED="1480607059909" ID="ID_703281238" MODIFIED="1480607061944" TEXT="Control"/>
</node>
</node>