Lumiera  0.pre.03
»edit your freedom«
timeline-state.cpp
Go to the documentation of this file.
1 /*
2  TimelineState - timeline presentation state holder
3 
4  Copyright (C)
5  2008, Joel Holdsworth <joel@airwebreathe.org.uk>
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 
25 #include "lib/time/timevalue.hpp"
26 #include "lib/time/mutation.hpp"
27 #include "lib/time/control.hpp"
28 
29 using namespace Gtk;
30 using namespace sigc;
31 
32 namespace stage {
33 namespace widget {
34 namespace timeline {
35 
36  using lib::time::FSecs;
37  using lib::time::Offset;
38  using lib::time::Duration;
39  using lib::time::Mutation;
40  using lib::time::Control;
41  using std::shared_ptr;
42 
43 
44  TimelineState::TimelineState (shared_ptr<model::Sequence> sourceSequence)
45  : sequence_(sourceSequence)
46  , viewWindow_(Offset(Time::ZERO), 1)
47  , selection_(Time::ZERO, Duration::NIL)
48  , selectionListener_()
49  , playbackPeriod_(Time::ZERO, Duration::NIL)
50  , playbackPoint_(Time::ZERO)
51  , isPlayback_(false)
52  {
53  REQUIRE(sequence_);
54 
55  // Initialise the selection listener
57  selectionListener_.connect(
58  mem_fun(*this, &TimelineState::on_selection_changed));
59 
61  const int64_t DEFAULT_TIMELINE_SCALE =6400;
62 
63  NOTREACHED ("3/23: this code is dead and left in-tree for later reference only");
64 // viewWindow_.set_time_scale(DEFAULT_TIMELINE_SCALE);
65 
69  }
70 
71 
74  {
75  return sequence_;
76  }
77 
78 
81  {
82  return viewWindow_;
83  }
84 
85 
86  void
88  bool resetPlaybackPeriod)
89  {
90  selection_.accept (change);
91  if (resetPlaybackPeriod)
92  setPlaybackPeriod(change);
93 
95  }
96 
97 
98  void
99  TimelineState::setPlaybackPeriod (Mutation const& change)
100  {
101  playbackPeriod_.accept (change);
102  playbackChangedSignal_.emit();
103  }
104 
105 
106  void
108  {
109  playbackPoint_ = newPosition;
110  playbackChangedSignal_.emit();
111  }
112 
113 
114  void
115  TimelineState::setSelectionControl (SelectionControl &control)
116  {
117  control.disconnect();
118  selection_.accept (control);
120  }
121 
122 
123  sigc::signal<void>
125  {
127  }
128 
129 
130  sigc::signal<void>
132  {
133  return playbackChangedSignal_;
134  }
135 
136 
137  void
139  {
141  }
142 
143 
144 }}}// namespace stage::widget::timeline
void connectChangeNotification(SIG const &toNotify)
install a callback functor to be invoked as notification for any changes imposed onto the observed ti...
Definition: control.hpp:215
Modifying time and timecode values.
Frontend/Interface: controller-element to retrieve and change running time values.
Definition: control.hpp:125
SelectionListener< TimeSpan > selectionListener_
listens for a selection change
shared_ptr< model::Sequence > getSequence() const
Gets the sequence that is attached to this timeline state object.
static EncapsulatedMutation changeTime(Time)
Convenience factory to yield a simple Mutation changing the absolute start time.
Definition: mutation.cpp:285
void accept(Mutation const &)
may change start / duration
Definition: mutation.hpp:123
void on_selection_changed(TimeSpan selection)
Event handler for when the selection is changed.
Interface: an opaque change imposed onto some time value.
Definition: mutation.hpp:91
shared_ptr< model::Sequence > sequence_
A pointer to the sequence object which this timeline_widget will represent.
static const Duration NIL
constant to indicate "no duration"
Definition: timevalue.hpp:506
TimeSpan playbackPeriod_
current playback period.
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:299
sigc::signal< void > playbackChangedSignal_
A signal to notify when the playback point or playback periods have changed.
void setPlaybackPoint(Time newPos)
Sets the time which is currently being played back.
TimeVar playbackPoint_
current playback position.
sigc::signal< void > selectionChangedSignal() const
A signal to notify when the selected period has changed.
Presentation state for the first draft of the timeline display.
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:37
void setSelection(Mutation const &change, bool resetPlaybackPeriod=true)
Sets the period of the selection.
boost::rational< int64_t > FSecs
rational representation of fractional seconds
Definition: timevalue.hpp:220
sigc::signal< void > playbackChangedSignal() const
A signal to notify when the playback point or playback periods have changed.
void disconnect()
disconnect from observed entity and cease any change notification
Definition: control.hpp:206
Offset measures a distance in time.
Definition: timevalue.hpp:358
Manipulating and monitoring time entities with life changes.
TimeSpan selection_
currently selected time period.
Duration is the internal Lumiera time metric.
Definition: timevalue.hpp:468
static EncapsulatedMutation changeDuration(Duration)
Convenience factory: simple Mutation to adjust the duration or length of a timespan.
Definition: mutation.cpp:296
timeline::TimelineViewWindow & getViewWindow()
Gets a reference to the timeline view window object.
abstract entry, not yet allocated
timeline::TimelineViewWindow viewWindow_
ViewWindow for the TimelineWidget display.
A time interval anchored at a specific point in time.
Definition: timevalue.hpp:573
a family of time value like entities and their relationships.
sigc::signal< void > selectionChangedSignal_
A signal to notify when the selected period has changed.