Lumiera  0.pre.03
TimelineController Class Reference

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


Controller to supervise the timeline display.

As a tangible element, 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 87 of file timeline-controller.hpp.

Public Member Functions

 TimelineController (ID identity, ID trackID, ctrl::BusTerm &nexus, TimelineLayout &)
 ~TimelineController ()
virtual void buildMutator (lib::diff::TreeMutator::Handle) override
 set up a binding to respond to mutation messages via UiBus More...
string const & getName () const
- 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...
void installExpander (Expander::ProbeFun, Expander::ChangeFun)
 Configure the (optional) functionality to expand or collapse the UI-Element. More...
void installRevealer (Revealer::RevealeItFun)
 Configure the (optional) functionality to bring the UI-Element into sight. 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 ()
 Cause the element to be brought into sight. More...
- Public Member Functions inherited from DiffMutable
virtual ~DiffMutable ()
 this is an interface More...

Private Attributes

std::unique_ptr< TrackPresenterfork_
vector< unique_ptr< MarkerWidget > > markers_
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 Controller
virtual void doMark (GenNode const &mark) override
 default handler for all generic mark messages. More...
- Protected Member Functions inherited from Tangible
 Tangible (ID identity, ctrl::BusTerm &nexus)
virtual bool doExpand (bool yes)
 generic default implementation of the expand/collapse functionality. More...
virtual void doReveal ()
 generic default implementation of the "reveal" functionality. More...
- Protected Attributes inherited from Tangible
Expander expand_
Revealer reveal_
ctrl::BusTerm uiBus_

Constructor & Destructor Documentation

◆ TimelineController()

TimelineController ( ID  identity,
ID  trackID,
ctrl::BusTerm nexus,
TimelineLayout layoutManager 
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 85 of file timeline-controller.cpp.

References TimelineController::fork_, TimelineController::markers_, and TimelineController::name_.

◆ ~TimelineController()

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

Member Function Documentation

◆ buildMutator()

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 140 of file timeline-controller.cpp.

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

+ Here is the call graph for this function:

◆ getName()

string const& getName ( ) const

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

References TimelineController::name_.

Member Data Documentation

◆ name_

◆ markers_

vector<unique_ptr<MarkerWidget> > markers_

◆ fork_

std::unique_ptr<TrackPresenter> fork_
+ Inheritance diagram for TimelineController:
+ Collaboration diagram for TimelineController:

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