Lumiera  0.pre.03
»edityourfreedom«
clip-presenter.cpp
Go to the documentation of this file.
1 /*
2  ClipPresenter - presentation control element for a clip within the timeline
3 
4  Copyright (C) Lumiera.org
5  2016, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
23 
33 #include "gui/gtk-base.hpp"
34 #include "include/ui-protocol.hpp"
37 
38 //#include "gui/ui-bus.hpp"
39 //#include "lib/format-string.hpp"
40 //#include "lib/format-cout.hpp"
41 
42 //#include "lib/util.hpp"
43 
44 //#include <algorithm>
45 //#include <vector>
46 
47 
48 
49 //using util::_Fmt;
51 using lib::diff::collection;
52 using std::make_unique;
53 //using util::contains;
54 //using Gtk::Widget;
55 //using sigc::mem_fun;
56 //using sigc::ptr_fun;
57 //using std::cout;
58 //using std::endl;
59 
60 
61 namespace gui {
62 namespace timeline {
63 
64 
65 
66 
67 
69  : Controller{identity, nexus}
70  , channels_{}
71  , effects_{}
72  , markers_{}
73  , widget_{}
74  {
75  UNIMPLEMENTED ("how inject the ClipWidget into the appropriate GTK display context");
76  }
77 
78 
80  {
81  }
82 
83 
84 
85 
86  void
87  ClipPresenter::buildMutator (TreeMutator::Handle buffer)
88  {
89  using PChannel = unique_ptr<ClipPresenter>;
90  using PEffect = unique_ptr<ClipPresenter>;
91  using PMarker = unique_ptr<MarkerWidget>;
92 
93  buffer.create (
94  TreeMutator::build()
95  .attach (collection(markers_)
96  .isApplicableIf ([&](GenNode const& spec) -> bool
97  { // »Selector« : require object-like sub scope with type-field "Marker"
98  return TYPE_Marker == spec.data.recordType();
99  })
100  .matchElement ([&](GenNode const& spec, PMarker const& elm) -> bool
101  {
102  return spec.idi == ID{*elm};
103  })
104  .constructFrom ([&](GenNode const& spec) -> PMarker
105  {
106  return make_unique<MarkerWidget> (spec.idi, this->uiBus_);
107  })
108  .buildChildMutator ([&](PMarker& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool
109  {
110  if (ID{*target} != subID) return false;
111  target->buildMutator (buff);
112  return true;
113  }))
114  .attach (collection(effects_)
115  .isApplicableIf ([&](GenNode const& spec) -> bool
116  { // »Selector« : require object-like sub scope with type-field "Effect"
117  return TYPE_Effect == spec.data.recordType();
118  })
119  .matchElement ([&](GenNode const& spec, PEffect const& elm) -> bool
120  {
121  return spec.idi == ID{*elm};
122  })
123  .constructFrom ([&](GenNode const& spec) -> PEffect
124  {
125  return make_unique<ClipPresenter> (spec.idi, this->uiBus_);
126  })
127  .buildChildMutator ([&](PEffect& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool
128  {
129  if (ID{*target} != subID) return false;
130  target->buildMutator (buff);
131  return true;
132  }))
133  .attach (collection(channels_)
134  .isApplicableIf ([&](GenNode const& spec) -> bool
135  { // »Selector« : require object-like sub scope with type-field "Channel"
136  return TYPE_Channel == spec.data.recordType();
137  })
138  .matchElement ([&](GenNode const& spec, PChannel const& elm) -> bool
139  {
140  return spec.idi == ID{*elm};
141  })
142  .constructFrom ([&](GenNode const& spec) -> PChannel
143  {
144  return make_unique<ClipPresenter> (spec.idi, this->uiBus_);
145  })
146  .buildChildMutator ([&](PChannel& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool
147  {
148  if (ID{*target} != subID) return false;
149  target->buildMutator (buff);
150  return true;
151  })));
152  }
153 
154 
155 
156 
157 }}// namespace gui::timeline
vector< unique_ptr< MarkerWidget > > markers_
Hard wired key constants and basic definitions for communication with the GUI.
Widget to show a marker at various places.
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:47
virtual void buildMutator(lib::diff::TreeMutator::Handle) override
set up a binding to respond to mutation messages via UiBus
Placement< Effect > PEffect
Definition: nodefactory.hpp:49
ctrl::BusTerm uiBus_
Definition: tangible.hpp:177
const Symbol TYPE_Marker
Definition: ui-protocol.cpp:38
const Symbol TYPE_Channel
Definition: ui-protocol.cpp:39
ctrl::BusTerm::ID ID
Definition: tangible.hpp:171
Presentation control element to model and manage a clip within the timeline UI.
vector< unique_ptr< ClipPresenter > > channels_
string recordType() const
peek into the type field of a nested Record<GenNode>
Definition: gen-node.hpp:704
connection point at the UI-Bus.
Definition: bus-term.hpp:105
A set of basic GTK includes for the UI.
vector< unique_ptr< ClipPresenter > > effects_
const Symbol TYPE_Effect
Definition: ui-protocol.cpp:40
generic data element node within a tree
Definition: gen-node.hpp:213
ClipPresenter(ID identity, ctrl::BusTerm &nexus)
Customisable intermediary to abstract mutating operations on arbitrary, hierarchical object-like data...