Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
timeline-controller.cpp
Go to the documentation of this file.
1/*
2 TimelineController - coordinate operation of timeline display
3
4 Copyright (C)
5 2016, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
14
32#include "stage/gtk-base.hpp"
38
39//#include "stage/workspace/workspace-window.hpp"
40//#include "stage/ui-bus.hpp"
41//#include "lib/format-string.hpp"
42//#include "lib/format-cout.hpp"
43
44//#include "lib/util.hpp"
45//#include <algorithm>
46//#include <cstdlib>
47
48
49
50//using util::_Fmt;
52using lib::diff::collection;
53using std::make_unique;
54//using std::shared_ptr;
55//using std::weak_ptr;
56//using util::contains;
57//using Gtk::Widget;
58//using sigc::mem_fun;
59//using sigc::ptr_fun;
60//using std::cout;
61//using std::endl;
62
63
64namespace stage {
65namespace timeline {
66
67//const int TimelineWidget::TrackPadding = 1;
68//const int TimelineWidget::HeaderWidth = 150;
69//const int TimelineWidget::HeaderIndentWidth = 10;
70 class TrackHeadWidget;
71 class TrackBody;
72
73
74
75
76 TimelineController::TimelineController (ID identity, ID trackID, ctrl::BusTerm& nexus, TimelineLayout& layoutManager)
77 : Controller{identity, nexus}
78 , name_{identity.getSym()} // fallback initialise name from human-readable ID symbol
79 , markers_{}
80 , fork_{new TrackPresenter{trackID, nexus, layoutManager}}
81 {
82 layoutManager.setupStructure (*fork_);
83 }
84
85
89
90
132 void
134 {
135 using PMarker = unique_ptr<MarkerWidget>;
136 auto rootForkID = fork_->getID();
137
138 buffer.emplace(
140 .attach (collection(markers_)
141 .isApplicableIf ([&](GenNode const& spec) -> bool
142 { // »Selector« : require object-like sub scope
143 return spec.data.isNested();
144 })
145 .constructFrom ([&](GenNode const& spec) -> PMarker
146 { // »Constructor« : what to do when the diff mentions a new entity
147 return make_unique<MarkerWidget>(spec.idi, this->uiBus_);
148 })
149 .buildChildMutator ([&](PMarker& target, GenNode::ID const&, TreeMutator::Handle buff) -> bool
150 { // »Mutator« : how to apply the diff recursively to a nested scope
151 target->buildMutator (buff); // : delegate to child for building a nested TreeMutator
152 return true;
153 }))
154 .mutateAttrib(rootForkID, [&](TreeMutator::Handle buff)
155 { // »Attribute Mutator« : how to enter the track-fork-object field as nested scope
156 REQUIRE (fork_);
157 fork_->buildMutator(buff);
158 })
159 .change(ATTR_name, [&](string val)
160 { // »Attribute Setter« : how to assign a new value to the name field (object member)
161 name_ = val;
162 }));
163 }
164
165
166
167}}// namespace stage::timeline
A handle to allow for safe »remote implantation« of an unknown subclass into a given opaque InPlaceBu...
SUB & emplace(SUB &&implementation)
move-construct an instance of a subclass into the opaque buffer
bool isNested() const
determine if payload constitutes a nested scope ("object")
Definition gen-node.hpp:769
Customisable intermediary to abstract mutating operations on arbitrary, hierarchical object-like data...
static Builder< TreeMutator > build()
DSL: start building a custom adapted tree mutator, where the operations are tied by closures or wrapp...
connection point at the UI-Bus.
Definition bus-term.hpp:98
ctrl::BusTerm::ID ID
Definition tangible.hpp:162
vector< unique_ptr< MarkerWidget > > markers_
TimelineController(ID identity, ID trackID, ctrl::BusTerm &nexus, TimelineLayout &)
std::unique_ptr< TrackPresenter > fork_
virtual void buildMutator(lib::diff::TreeMutator::Handle) override
set up a binding to respond to mutation messages via UiBus
Top-level anchor point for the timeline display (widgets).
void setupStructure(LayoutElement &)
A View-Model entity to represent a timeline track in the UI.
A set of basic GTK includes for the UI.
Widget to show a marker at various places.
Lumiera GTK UI implementation root.
Definition guifacade.cpp:37
const Symbol ATTR_name
generic data element node within a tree
Definition gen-node.hpp:224
Controller to supervise operation of timeline display in the UI.
A core service of the timeline UI to ensure consistent display and layout of all components within th...
Presentation control element to model and manage a track within the timeline UI.
Hard wired key constants and basic definitions for communication with the GUI.