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) Lumiera.org
5  2008, Joel Holdsworth <joel@airwebreathe.org.uk>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
23 
34 #include "lib/time/timevalue.hpp"
35 #include "lib/time/mutation.hpp"
36 #include "lib/time/control.hpp"
37 
38 using namespace Gtk;
39 using namespace sigc;
40 
41 namespace stage {
42 namespace widget {
43 namespace timeline {
44 
45  using lib::time::FSecs;
46  using lib::time::Offset;
47  using lib::time::Duration;
48  using lib::time::Mutation;
49  using lib::time::Control;
50  using std::shared_ptr;
51 
52 
53  TimelineState::TimelineState (shared_ptr<model::Sequence> sourceSequence)
54  : sequence_(sourceSequence)
55  , viewWindow_(Offset(Time::ZERO), 1)
56  , selection_(Time::ZERO, Duration::NIL)
57  , selectionListener_()
58  , playbackPeriod_(Time::ZERO, Duration::NIL)
59  , playbackPoint_(Time::ZERO)
60  , isPlayback_(false)
61  {
62  REQUIRE(sequence_);
63 
64  // Initialise the selection listener
66  selectionListener_.connect(
67  mem_fun(*this, &TimelineState::on_selection_changed));
68 
70  const int64_t DEFAULT_TIMELINE_SCALE =6400;
71 
72  NOTREACHED ("3/23: this code is dead and left in-tree for later reference only");
73 // viewWindow_.set_time_scale(DEFAULT_TIMELINE_SCALE);
74 
78  }
79 
80 
83  {
84  return sequence_;
85  }
86 
87 
90  {
91  return viewWindow_;
92  }
93 
94 
95  void
97  bool resetPlaybackPeriod)
98  {
99  selection_.accept (change);
100  if (resetPlaybackPeriod)
101  setPlaybackPeriod(change);
102 
104  }
105 
106 
107  void
108  TimelineState::setPlaybackPeriod (Mutation const& change)
109  {
110  playbackPeriod_.accept (change);
111  playbackChangedSignal_.emit();
112  }
113 
114 
115  void
117  {
118  playbackPoint_ = newPosition;
119  playbackChangedSignal_.emit();
120  }
121 
122 
123  void
124  TimelineState::setSelectionControl (SelectionControl &control)
125  {
126  control.disconnect();
127  selection_.accept (control);
129  }
130 
131 
132  sigc::signal<void>
134  {
136  }
137 
138 
139  sigc::signal<void>
141  {
142  return playbackChangedSignal_;
143  }
144 
145 
146  void
148  {
150  }
151 
152 
153 }}}// 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:224
Modifying time and timecode values.
Frontend/Interface: controller-element to retrieve and change running time values.
Definition: control.hpp:134
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:294
void accept(Mutation const &)
may change start / duration
Definition: mutation.hpp:132
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:100
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:515
TimeSpan playbackPeriod_
current playback period.
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:308
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:46
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:229
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:215
Offset measures a distance in time.
Definition: timevalue.hpp:367
Manipulating and monitoring time entities with life changes.
TimeSpan selection_
currently selected time period.
Duration is the internal Lumiera time metric.
Definition: timevalue.hpp:477
static EncapsulatedMutation changeDuration(Duration)
Convenience factory: simple Mutation to adjust the duration or length of a timespan.
Definition: mutation.cpp:305
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:582
a family of time value like entities and their relationships.
sigc::signal< void > selectionChangedSignal_
A signal to notify when the selected period has changed.