Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
interaction-director.cpp
Go to the documentation of this file.
1/*
2 interactionDirector - Global UI Manager
3
4 Copyright (C)
5 2017, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
14
20#include "stage/gtk-base.hpp"
21#include "stage/ui-bus.hpp"
37//#include "stage/timeline/timeline-widget.hpp"
38//#include "stage/timeline/timeline-controller.hpp" /////////////////TODO still required?
43#include "steam/cmd.hpp"
44#include "vault/real-clock.hpp"
46#include "lib/format-string.hpp"
47#include "lib/format-obj.hpp"
48//#include "stage/ui-bus.hpp"
49//#include "lib/util.hpp"
50
51//#include <memory>
52//#include <list>
53
54//using util::isnil;
55using util::_Fmt;
56//using std::list;
57//using std::shared_ptr;
60using lib::diff::Rec;
62using lib::diff::collection;
63using LERR_(DIFF_STRUCTURE);
64using std::make_unique;
65using util::toString;
66
67
68namespace stage {
69namespace interact {
70
72 namespace cmd = steam::cmd;
73
74 using ctrl::GlobalCtx;
75 using ctrl::UiState;
76 using setting::AssetController;
77 using timeline::TimelineController;
78
79
80 // emit dtors of children here...
83
84
93 : model::Controller(session::Root::getID(), globals.uiBus_.getAccessPoint())
94 , globalCtx_(globals)
95 , gestureState_{}
96 , viewLocator_{new ViewLocator}
97 , spotLocator_{new SpotLocator}
98 , navigator_{*spotLocator_, *viewLocator_} // Service exposed as Depend<LocationQuery>
99 , tracker_{new FocusTracker{*navigator_}}
100 , uiState_{new UiState{globals.uiBus_.getStateManager(), *tracker_}}
101 , assets_{new AssetController{session::Root::getAssetID(), this->uiBus_}}
102 , timelines_{}
103 {
104 Glib::signal_timeout()
105 .connect_once (sigc::mem_fun(*this, &InteractionDirector::populateContent_afterStart)
107 ,Glib::PRIORITY_LOW); // after all initial drawing tasks
108 }
109
110
111 void
116
117
118 namespace { // Temporary Junk
119 inline void
121 {
122 WARN (stage, "%s is not yet implemented. So sorry.", todo);
123 }
124 }
125
126
127
128 void
129 InteractionDirector::buildMutator (TreeMutator::Handle buffer)
130 {
131 buffer.emplace(
132 TreeMutator::build()
133 .attach (collection(timelines_)
134 .isApplicableIf ([&](GenNode const& spec) -> bool
135 { // »Selector« : require object-like sub scope
136 return spec.data.isNested();
137 })
138 .constructFrom ([&](GenNode const& spec) -> TimelineGui
139 { // »Constructor« : what to do when the diff mentions a new entity
140 return injectTimeline (spec);
141 }))
142 .mutateAttrib(ATTR_fork, [&](TreeMutator::Handle buff)
143 { // »Attribute Mutator« : how to enter an object field as nested scope
144 REQUIRE (assets_);
145 assets_->buildMutator(buff);
146 }));
147 }
148
149
158 void
160 {
161 unimplemented ("launch project setup UI");
162 }
163
164
171 void
173 {
174 string snapshotID{"snap-" + toString(vault::RealClock::now())};
175 invoke (cmd::session_saveSnapshot, snapshotID);
176 }
177
178
191 void
193 {
194 unimplemented ("launch project setup UI to create a fork of the project under new name");
195 }
196
197
207 void
209 {
211 dialog.run();
212
213 unimplemented ("edit global configuration");
214 }
215
216
224 void
226 {
227 unimplemented ("open file");
228 }
229
230
239 void
241 {
243 dialog.run();
244
245 unimplemented ("start render");
246 }
247
248
259 void
261 {
262 LuidH anchor{*this};
264 invoke (cmd::session_newSequence, anchor, newSeqID);
265 }
266
267
283 void
285 {
286 LuidH anchor{*this};
288 invoke (cmd::sequence_newTrack, anchor, newTrackID);
289 }
290
291
297
298
299 namespace {
315 ID
317 {
318 if (not (spec.data.isNested()
319 and spec.data.get<Rec>().hasAttribute(string{ATTR_fork})
320 and TYPE_Fork == spec.data.get<Rec>().get(string{ATTR_fork}).data.recordType()
321 ) )
322 throw error::State (_Fmt{"When populating a new Timeline, a root track must be given immediately"
323 "nested into INS message. We got the following initialisation payload: %s"}
324 % spec
325 , LERR_(DIFF_STRUCTURE));
326
327 return spec.data.get<Rec>().get(string{ATTR_fork}).idi;
328 }
329 }
330
338 TimelineGui
340 {
341 ID rootTrack = verifyDiffStructure_and_extract_RootTrack (spec);
342 TimelineGui anchorProxy{spec.idi, rootTrack};
343
345 .locatePanel()
347 .addTimeline (
348 anchorProxy.buildTimelineWidget (this->uiBus_));
349
350 globalCtx_.uiManager_.configureStyle (*anchorProxy);
351 return anchorProxy;
352 }
353
354
355
356
357}}// namespace stage::interact
User interface for asset management.
Attachment point to the UI-Bus.
Inline string literal.
Definition symbol.hpp:78
bool isNested() const
determine if payload constitutes a nested scope ("object")
Definition gen-node.hpp:769
object-like record of data.
Definition record.hpp:142
Customisable intermediary to abstract mutating operations on arbitrary, hierarchical object-like data...
Hash implementation based on a lumiera unique object id (LUID) When invoking the default ctor,...
LuidH const & getHash() const
Definition entry-id.hpp:175
A global circle of top-level UI management facilities.
WindowLocator windowLoc_
PAN & find_or_create()
lookup or allocate "the" instance of the indicated Panel(subtype).
void configureStyle(timeline::TimelineWidget const &)
Store and manage persistent interface state.
Definition ui-state.hpp:77
workspace::WorkspaceWindow & findActiveWindow()
find and retrieve a WorkspaceWindow (top-level window) marked as 'active' by GTK.
A dialog to choose render output format and name.
Definition render.hpp:38
Helper to pick up typical focus/activity changes, for the purpose of keeping a coherent system of Wor...
void newSequence()
Establish a pristine new sequence within the session.
TimelineGui injectTimeline(GenNode const &)
void newTrack()
Establish a empty new track close to the current scope.
void populateContent_afterStart()
ask Session to push up structures for presentation
void saveSnapshot()
Save a snapshot of the current project's contents and the UI state.
void forkProject()
Continue evolution of the currently active project under a new identity.
InteractionDirector(ctrl::GlobalCtx &)
Setup and initialise all representations of "global-ness".
void editSetup()
Edit global configuration and setup.
void openFile()
Select and open a file to perform a suitable operation.
void newProject()
setup a new editing project, possibly close the current one.
workspace::WorkspaceWindow & getWorkspaceWindow()
void buildMutator(lib::diff::TreeMutator::Handle) override
set up a binding to allow some top-level UI state to be treated as part of the session model
Control and navigate the global centre of activity.
Access or allocate a UI component view.
void invoke(Symbol cmdID, ARGS &&...)
ctrl::BusTerm::ID ID
Definition tangible.hpp:162
Dockable panel to hold timeline widget(s).
Top level controller for the asset management section in the UI.
smart-Handle as anchor point for "the UI representation" of a timeline.
The main Lumiera workspace window.
A front-end for using printf-style formatting.
static Time now()
Common ID definitions for Steam-Layer commands.
#define LERR_(_NAME_)
Definition error.hpp:45
Helper to track focus/activation changes to move the activity "Spot" automatically.
Organisational grouping device within the Session model ("Track" / "Media Bin").
Simple functions to represent objects, for debugging and diagnostics.
Front-end for printf-style string template interpolation.
Sub-Service of the InteractionDirector: Hold and maintain InteractionState.
Dependency context to hold all the global UI top-level entities.
A set of basic GTK includes for the UI.
The top-level controller to connect model and user interaction state.
LumieraError< LERR_(STATE)> State
Definition error.hpp:209
ID verifyDiffStructure_and_extract_RootTrack(GenNode const &spec)
The timeline is actually a front-end for a binding to some root track.
Lumiera GTK UI implementation root.
Definition guifacade.cpp:37
lib::idi::BareEntryID const & ID
const Symbol ATTR_fork
const Symbol TYPE_Fork
CommandSetup session_newSequence
CommandSetup sequence_newTrack
CommandSetup test_meta_activateContentDiff
CommandSetup session_saveSnapshot
Namespace of Session and user visible high-level objects.
Definition sequence.hpp:65
std::string toString(TY const &val) noexcept
get some string representation of any object, reliably.
Global interface navigation control.
Dialog to manage application preferences.
Front-end for simplified access to the current wall clock time.
Dialog to set up a renter process and define output name and format.
MObject within the session to represent "the session itself".
Structural building block of the session: a sequence of clips.
Navigating a centre of user activity globally.
generic data element node within a tree
Definition gen-node.hpp:224
typed symbolic and hash ID for asset-like position accounting.
Definition entry-id.hpp:219
A dockable container to hold a notebook of timeline displays.
Customisable intermediary to abstract generic tree mutation operations.
Under construction: the top level UI controller.
Evaluation of UI coordinates against a concrete window topology.
Hard wired key constants and basic definitions for communication with the GUI.
Establish and handle persistent interface state.
Access and allocation of UI component views.
This file contains the definition of the main workspace window parent, which is the toplevel parent o...