Lumiera  0.pre.03
»edit your freedom«
timeline-state.hpp
Go to the documentation of this file.
1 /*
2  TIMELINE-STATE.hpp - 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 
35 #ifndef STAGE_WIDGET_TIMELINE_STATE_H
36 #define STAGE_WIDGET_TIMELINE_STATE_H
37 
38 #include "stage/gtk-base.hpp"
39 //#include "stage/widget/timeline/timeline-view-window.hpp"////////////////////////////TODO : obsolete and removed 3/23
40 
41 #include "lib/time/timevalue.hpp"
42 #include "lib/time/mutation.hpp"
43 #include "lib/time/control.hpp"
44 
45 #include <memory>
46 
47 
48 namespace stage {
49  namespace model {
50  class Sequence;
51  }
52  namespace widget {
53  namespace timeline {
54 
55  using lib::time::Time;
56  using lib::time::Offset;
57  using lib::time::TimeVar;
58  using lib::time::TimeSpan;
60  using lib::time::Mutation;
61  using lib::time::Control;
62 
63  using std::shared_ptr;
64 
65  typedef Control<TimeSpan> SelectionControl;
66 
69  {
70  public:
71  TimelineViewWindow (Offset offset, int64_t scale)
72  {
73  NOTREACHED ("3/23: this code is dead and left in-tree for later reference only");
74  }
75  };
77 
78 
87  template<class TI>
90  {
91  sigc::signal<void, TI> valueChangedSignal_;
92 
93  public:
94  SelectionListener() { }
95 
96  void
97  operator() (TI const& changeValue) const
98  {
99  valueChangedSignal_.emit (changeValue);
100  }
101 
102 
103  void connect (const sigc::slot<void, TI> &connection)
104  {
105  valueChangedSignal_.connect (connection);
106  }
107  };
108 
109 
110 
117  {
118  public:
119 
125 
126 
127  public:
132  shared_ptr<model::Sequence> getSequence() const;
133 
138  timeline::TimelineViewWindow& getViewWindow();
139 
140 
142  getSelectionListener() { return selectionListener_; }
143 
144  Time getSelectionStart() const { return selection_.start();}
145  Time getSelectionEnd() const { return selection_.end(); }
146  Time getPlaybackPeriodStart() const { return selection_.start();}
147  Time getPlaybackPeriodEnd() const { return selection_.end(); }
148 
149  Time getPlaybackPoint() const { return playbackPoint_; }
150 
151 
154  bool isPlaying() const { return isPlayback_; }
155 
156  void setSelectionControl (SelectionControl &control);
157 
163  void setSelection(Mutation const& change,
164  bool resetPlaybackPeriod = true);
165 
166  void setPlaybackPeriod(Mutation const& change);
167 
175  void setPlaybackPoint(Time newPos);
176 
180  sigc::signal<void> selectionChangedSignal() const;
181 
186  sigc::signal<void> playbackChangedSignal() const;
187 
188 
189 
190  private: /* ========= Event Handlers ========== */
194  void on_selection_changed (TimeSpan selection);
195 
196 
197  private:
204 
205 
206 
207  /* == View State == */
208 
211 
212 
213  /* == Selection State == */
214 
217 
220 
223 
229 
230  bool isPlayback_;
231 
232 
233  /* == Signals == */
234 
238  sigc::signal<void> selectionChangedSignal_;
239 
244  sigc::signal<void> playbackChangedSignal_;
245  };
246 
247 
248 }}}// namespace stage::widget::timeline
249 #endif /*STAGE_WIDGET_TIMELINE_STATE_H*/
a mutable time value, behaving like a plain number, allowing copy and re-accessing ...
Definition: timevalue.hpp:241
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
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
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.
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.
TimelineState is a container for the state data for TimelineWidget.
TimeVar playbackPoint_
current playback position.
bool isPlaying() const
is there currently any ongoing playback process? Otherwise the #getPlaybackPoint() is meaningless ...
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:46
SelectionListener is a template class which emits a signal when the value is changed by it&#39;s associat...
Offset measures a distance in time.
Definition: timevalue.hpp:367
Manipulating and monitoring time entities with life changes.
TimeSpan selection_
currently selected time period.
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.
basic constant internal time value.
Definition: timevalue.hpp:142
A set of basic GTK includes for the UI.
sigc::signal< void > selectionChangedSignal_
A signal to notify when the selected period has changed.