Lumiera  0.pre.03
»edit your freedom«
ui-bus.cpp
Go to the documentation of this file.
1 /*
2  UiBus - UI model and control backbone
3 
4  Copyright (C) Lumiera.org
5  2008, Joel Holdsworth <joel@airwebreathe.org.uk>
6  2015, Hermann Vosseler <Ichthyostega@web.de>
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of
11  the License, or (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 
22 * *****************************************************/
23 
24 
39 #include "stage/ui-bus.hpp"
41 
42 
43 namespace stage {
45 namespace controller {
46 
47  Controller::Controller (model::Project& modelProject)
48  : project_(modelProject)
49  , playback_()
50  { }
51 
52 
53 
54  ctrl::PlaybackController& Controller::get_playback_controller()
55  {
56  return playback_;
57  }
58 
59 }// namespace stage::controller
61 
62 
63  UiBus::UiBus()
64  : coreService_{new ctrl::CoreService}
65  { }
66 
67 
68  // emit administrative code here...
69  UiBus::~UiBus() { }
70 
71 
72  ctrl::BusTerm&
73  UiBus::getAccessPoint()
74  {
75  return *coreService_;
76  }
77 
78  ctrl::StateManager&
79  UiBus::getStateManager()
80  {
81  return coreService_->getStateManager();
82  }
83 
84 
85 
86 namespace ctrl {
87 
88  CoreService::~CoreService() { }
89 
90 
92  BusTerm::~BusTerm()
93  {
94  theBus_.routeDetach (this->endpointID_);
95  }
96 
97 
98 
99 
100 
101 
111  BusTerm
112  BusTerm::attach (ID identity, Tangible& newNode)
113  {
114  return BusTerm(identity, theBus_.routeAdd (identity,newNode));
115  }
116 
117 
118 
119  /* ==== standard implementation of the BusTerm interface ==== */
120 
138  void
139  BusTerm::act (GenNode const& command)
140  {
141  theBus_.act (command);
142  }
143 
144 
157  void
158  BusTerm::note (ID subject, GenNode const& mark)
159  {
160  theBus_.note (subject,mark);
161  }
162 
163 
176  bool
177  BusTerm::mark (ID subject, GenNode const& mark)
178  {
179  return theBus_.mark (subject,mark);
180  }
181 
182 
191  size_t
192  BusTerm::markAll (GenNode const& mark)
193  {
194  return theBus_.markAll (mark);
195  }
196 
197 
210  bool
211  BusTerm::change (ID subject, MutationMessage&& diff)
212  {
213  return theBus_.change(subject, move(diff));
214  }
215 
216 
222  BusTerm&
223  BusTerm::routeAdd (ID identity, Tangible& node)
224  {
225  return theBus_.routeAdd (identity, node);
226  }
227 
228 
233  void
234  BusTerm::routeDetach(ID node) noexcept
235  {
236  if (not isShortCircuit(node))
237  theBus_.routeDetach (node);
238  }
239 
240 
241  BusTerm::operator string() const
242  {
243  return "BusTerm-" + string(endpointID_);
244  }
245 
246 
247 
248 }}// namespace stage::ctrl
virtual void routeDetach(ID) noexcept
Definition: ui-bus.cpp:234
connection point at the UI-Bus.
Definition: bus-term.hpp:105
Under construction: the top level UI controller.
Opaque message to effect a structural change on a target, which is likewise only known in an abstract...
Dedicated service node within the UI-Bus to handle command invocation and presentation state...
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:46
virtual BusTerm & routeAdd(ID, Tangible &)
Definition: ui-bus.cpp:223
Interface common to all UI elements of relevance for the Lumiera application.
Definition: tangible.hpp:165
virtual void act(GenNode const &command)
prepare or trigger invocation of a command.
Definition: ui-bus.cpp:139
generic data element node within a tree
Definition: gen-node.hpp:231