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 
32 #include "gui/gtk-base.hpp"
35 
36 //#include "gui/ui-bus.hpp"
37 //#include "lib/format-string.hpp"
38 //#include "lib/format-cout.hpp"
39 
40 //#include "lib/util.hpp"
41 
42 //#include <algorithm>
43 //#include <vector>
44 
45 
46 
47 //using util::_Fmt;
49 using lib::diff::collection;
50 using std::make_unique;
51 //using util::contains;
52 //using Gtk::Widget;
53 //using sigc::mem_fun;
54 //using sigc::ptr_fun;
55 //using std::cout;
56 //using std::endl;
57 
58 
59 namespace gui {
60 namespace timeline {
61 
62 
63 
64 
65 
67  : Controller{identity, nexus}
68  , channels_{}
69  , effects_{}
70  , markers_{}
71  , widget_{}
72  {
73  UNIMPLEMENTED ("how inject the ClipWidget into the appropriate GTK display context");
74  }
75 
76 
78  {
79  }
80 
81 
82 
83 
84  void
85  ClipPresenter::buildMutator (TreeMutator::Handle buffer)
86  {
87  using PChannel = unique_ptr<ClipPresenter>;
88  using PEffect = unique_ptr<ClipPresenter>;
89  using PMarker = unique_ptr<MarkerWidget>;
90 
91  buffer.create (
92  TreeMutator::build()
93  .attach (collection(markers_)
94  .isApplicableIf ([&](GenNode const& spec) -> bool
95  { // »Selector« : require object-like sub scope with type-field "Marker"
96  return "Marker" == spec.data.recordType();
97  })
98  .matchElement ([&](GenNode const& spec, PMarker const& elm) -> bool
99  {
100  return spec.idi == ID(elm);
101  })
102  .constructFrom ([&](GenNode const& spec) -> PMarker
103  {
104  return make_unique<MarkerWidget>(spec.idi, this->uiBus_);
105  })
106  .buildChildMutator ([&](PMarker& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool
107  {
108  if (ID(target) != subID) return false;
109  target->buildMutator (buff);
110  return true;
111  }))
112  .attach (collection(effects_)
113  .isApplicableIf ([&](GenNode const& spec) -> bool
114  { // »Selector« : require object-like sub scope with type-field "Effect"
115  return "Effect" == spec.data.recordType();
116  })
117  .matchElement ([&](GenNode const& spec, PEffect const& elm) -> bool
118  {
119  return spec.idi == ID(elm);
120  })
121  .constructFrom ([&](GenNode const& spec) -> PEffect
122  {
123  return make_unique<ClipPresenter>(spec.idi, this->uiBus_);
124  })
125  .buildChildMutator ([&](PEffect& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool
126  {
127  if (ID(target) != subID) return false;
128  target->buildMutator (buff);
129  return true;
130  }))
131  .attach (collection(channels_)
132  .isApplicableIf ([&](GenNode const& spec) -> bool
133  { // »Selector« : require object-like sub scope with type-field "Channel"
134  return "Channel" == spec.data.recordType();
135  })
136  .matchElement ([&](GenNode const& spec, PChannel const& elm) -> bool
137  {
138  return spec.idi == ID(elm);
139  })
140  .constructFrom ([&](GenNode const& spec) -> PChannel
141  {
142  return make_unique<ClipPresenter>(spec.idi, this->uiBus_);
143  })
144  .buildChildMutator ([&](PChannel& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool
145  {
146  if (ID(target) != subID) return false;
147  target->buildMutator (buff);
148  return true;
149  })));
150  }
151 
152 
153 
154 
155 }}// namespace gui::timeline
vector< unique_ptr< MarkerWidget > > markers_
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
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:703
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_
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...