Lumiera  0.pre.03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TimelineController Class Reference

#include "gui/timeline/timeline-controller.hpp"


Controller to supervise the timeline display.

As a [tangible element](model::Tangible), it is attached to the UI-Bus.

WIP-WIP-rewrite as of 12/2016
a Timeline always has an attached Sequence, which in turn has a single mandatory root track. This in turn might hold further child tracks, thus forming a fork of nested scopes.

Definition at line 86 of file timeline-controller.hpp.

Public Member Functions

 TimelineController (ID identity, ID trackID, ctrl::BusTerm &nexus)
 ~TimelineController ()
virtual void buildMutator (lib::diff::TreeMutator::Handle) override
 set up a binding to respond to mutation messages via UiBus More...
- Public Member Functions inherited from Tangible
virtual ~Tangible ()
 this is an interface More...
void clearErr ()
 invoke the hook to clear error markers More...
void clearMsg ()
 invoke the hook to clear notification messages More...
template<typename... ARGS>
void invoke (Symbol cmdID, ARGS &&...)
void invoke (Symbol cmdID, Rec &&arguments)
 Perform a command or action, once the execution context has been established. More...
template<typename... ARGS>
void invoke (Symbol cmdID, ARGS &&...args)
 convenience shortcut to issue a command with several arguments More...
void mark (GenNode const &)
 generic handler for all incoming "state mark" messages More...
void markErr (string error)
 push an error state tag to the element More...
void markFlash ()
 highlight the element visually to catch the user's attention More...
void markMsg (string message)
 push a notification (or warning) message to the element. More...
 operator ID () const
 operator LuidH () const
void reset ()
 invoke the generic reset hook More...
void slotCollapse ()
 Collapse or minimise this element and remember the collapsed state. More...
void slotExpand ()
 Expand this element and remember the expanded state. More...
void slotReveal (ID child)
- Public Member Functions inherited from DiffMutable
virtual ~DiffMutable ()
 this is an interface More...

Private Attributes

std::unique_ptr< TrackPresenterfork_
vector< unique_ptr
< MarkerWidget > > 
string name_

Additional Inherited Members

- Public Types inherited from Tangible
using ID = ctrl::BusTerm::ID
using LuidH = lib::hash::LuidH
- Protected Types inherited from Tangible
using GenNode = lib::diff::GenNode
using Rec = lib::diff::Rec
- Protected Member Functions inherited from Tangible
 Tangible (ID identity, ctrl::BusTerm &nexus)
- Protected Attributes inherited from Tangible
ctrl::BusTerm uiBus_

Constructor & Destructor Documentation

TimelineController ( ID  identity,
ID  trackID,
ctrl::BusTerm nexus 
identityused to refer to a corresponding timeline element in the Session
trackIDthe mandatory root track used in the associated Sequence
nexussome established connection to the UI-Bus, used for registration.

Definition at line 81 of file timeline-controller.cpp.

Definition at line 91 of file timeline-controller.cpp.

Member Function Documentation

void buildMutator ( lib::diff::TreeMutator::Handle  )

set up a binding to respond to mutation messages via UiBus

this method is invoked by the UI-Bus when dispatching a MutationMessage...

this is likely the first occasion a casual reader sees such a binding function, thus some explanations might be helpful. This is part of the »diff framework«: we use messages to communicate changes on structured data. We might as well just use a common object model, but we refrain from doing so, to avoid tight coupling, here between the core logic and the structures in the UI. Rather we assume that both sides share a roughly compatible understanding regarding the structure of the session model. Exchanging just diff messages allows us to use private implementation data structures in the UI as we see fit, without the danger of breaking anything in the core. And vice versa. You may see this as yet another way of data binding between model and view. The TreeMutator helps to accomplish this binding between a generic structure description, in our case based on GenNode elements, and the private data structure, here the private object fields and the collection of child objects within TimelineController. To ease this essentially "mechanic" and repetitive task, the TreeMutator offers some standard building blocks, plus a builder DSL, allowing just to fill in the flexible parts with some lambdas. Yet still, the technical details of getting this right can be tricky, especially since it is very important to set up those bindings in the right order. Basically we build a stack of decorators, so what is mentioned last will be checked first. Effectively this creates a structure of "onion layers", where each layer handles just one aspect of the binding. This works together with the convention that the diff message must mention all changes regarding one group (or kind) of elements together and completely. This is kind of an object description protocol, meaning that the diff has to mention the metadata (the object type) first, followed by the "attributes" (fields) and finally nested child objects. And nested elements can be handled with a nested diff, which recurses into some nested scope. In the example here, we are prepared to deal with two kinds of nested scope:
  • the fork (that is the tree of tracks) is a nested structure
  • we hold a collection of marker child objects, each of which can be entered as a nested scope. For both cases we prepare a way to build a nested mutator, and in both cases this is simply achieved by relying on the common interface of all those "elements", which is gui::model::Tangible and just happens to require each such "tangible" to offer a mutation building method, just like this one here. Simple recursive programming.
See also

Implements Tangible.

Definition at line 133 of file timeline-controller.cpp.

References GenNode::data, TimelineController::fork_, GenNode::idi, DataCap::isNested(), TimelineController::markers_, TimelineController::name_, and Tangible::uiBus_.

+ Here is the call graph for this function:

Member Data Documentation

vector<unique_ptr<MarkerWidget> > markers_

Definition at line 89 of file timeline-controller.hpp.

Referenced by TimelineController::buildMutator().

std::unique_ptr<TrackPresenter> fork_

Definition at line 90 of file timeline-controller.hpp.

Referenced by TimelineController::buildMutator().

string name_

Definition at line 92 of file timeline-controller.hpp.

Referenced by TimelineController::buildMutator().

+ Inheritance diagram for TimelineController:
+ Collaboration diagram for TimelineController:

The documentation for this class was generated from the following files: