2009-03-23 23:22:14 +01:00
|
|
|
/*
|
|
|
|
|
timeline-state.hpp - Declaration of the timeline state object
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2009-03-23 23:22:14 +01:00
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2009-03-23 23:22:14 +01:00
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License as
|
2010-12-17 23:28:49 +01:00
|
|
|
published by the Free Software Foundation; either version 2 of
|
|
|
|
|
the License, or (at your option) any later version.
|
|
|
|
|
|
2009-03-23 23:22:14 +01:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2009-03-23 23:22:14 +01:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2009-03-23 23:22:14 +01:00
|
|
|
*/
|
|
|
|
|
/** @file widgets/timeline/timeline-state.hpp
|
|
|
|
|
** This file contains the definition of the timeline state object
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef TIMELINE_STATE_HPP
|
|
|
|
|
#define TIMELINE_STATE_HPP
|
|
|
|
|
|
|
|
|
|
#include "timeline-view-window.hpp"
|
|
|
|
|
|
|
|
|
|
namespace gui {
|
|
|
|
|
|
|
|
|
|
namespace model {
|
|
|
|
|
class Sequence;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace widgets {
|
|
|
|
|
namespace timeline {
|
|
|
|
|
|
2009-03-27 15:26:08 +01:00
|
|
|
/**
|
|
|
|
|
* TimelineState is a container for the state data for TimelineWidget.
|
|
|
|
|
* @remarks TimelineState s can be swapped out so that TimelineWidget
|
|
|
|
|
* can flip between different views.
|
2011-01-03 10:30:45 +01:00
|
|
|
*/
|
2009-03-23 23:22:14 +01:00
|
|
|
class TimelineState
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
2009-03-27 15:26:08 +01:00
|
|
|
/**
|
|
|
|
|
* Constructor
|
|
|
|
|
* @param source_sequence The sequence on which the TimelineWidget
|
|
|
|
|
* will operate when this TimelineState is attached.
|
2011-01-03 10:30:45 +01:00
|
|
|
*/
|
2009-03-23 23:22:14 +01:00
|
|
|
TimelineState(boost::shared_ptr<model::Sequence> source_sequence);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2009-03-27 15:26:08 +01:00
|
|
|
/**
|
|
|
|
|
* Gets the sequence that is attached to this timeline state object.
|
|
|
|
|
* @return Returns a shared_ptr to the sequence object.
|
2011-01-03 10:30:45 +01:00
|
|
|
*/
|
2009-03-23 23:22:14 +01:00
|
|
|
boost::shared_ptr<model::Sequence> get_sequence() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets a reference to the timeline view window object.
|
|
|
|
|
* @return Returns the timeline view window object.
|
2011-01-03 10:30:45 +01:00
|
|
|
*/
|
2009-03-23 23:22:14 +01:00
|
|
|
timeline::TimelineViewWindow& get_view_window();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the time at which the selection begins.
|
|
|
|
|
*/
|
2009-08-30 17:26:27 +02:00
|
|
|
lumiera::Time get_selection_start() const;
|
2009-03-23 23:22:14 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the time at which the selection begins.
|
|
|
|
|
*/
|
2009-08-30 17:26:27 +02:00
|
|
|
lumiera::Time get_selection_end() const;
|
2009-03-23 23:22:14 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the period of the selection.
|
|
|
|
|
* @param start The start time.
|
|
|
|
|
* @param end The end time.
|
|
|
|
|
* @param reset_playback_period Specifies whether to set the playback
|
|
|
|
|
* period to the same as this new selection.
|
|
|
|
|
*/
|
2009-08-30 17:26:27 +02:00
|
|
|
void set_selection(lumiera::Time start, lumiera::Time end,
|
2009-03-23 23:22:14 +01:00
|
|
|
bool reset_playback_period = true);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the time at which the playback period begins.
|
|
|
|
|
*/
|
2009-08-30 17:26:27 +02:00
|
|
|
lumiera::Time get_playback_period_start() const;
|
2009-03-23 23:22:14 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the time at which the playback period ends.
|
|
|
|
|
*/
|
2009-08-30 17:26:27 +02:00
|
|
|
lumiera::Time get_playback_period_end() const;
|
2009-03-23 23:22:14 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the playback period.
|
|
|
|
|
* @param start The start time.
|
|
|
|
|
* @param end The end time.
|
|
|
|
|
*/
|
2009-08-30 17:26:27 +02:00
|
|
|
void set_playback_period(lumiera::Time start, lumiera::Time end);
|
2009-03-23 23:22:14 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the time which is currenty being played back.
|
|
|
|
|
* @param point The time index being played. This value may be
|
|
|
|
|
* GAVL_TIME_UNDEFINED, if there is no playback point.
|
|
|
|
|
*/
|
2009-08-30 17:26:27 +02:00
|
|
|
void set_playback_point(lumiera::Time point);
|
2009-03-23 23:22:14 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the current playback point.
|
|
|
|
|
* @return The time index of the playback point. This value may be
|
|
|
|
|
* GAVL_TIME_UNDEFINED, if there is no playback point.
|
|
|
|
|
*/
|
2009-08-30 17:26:27 +02:00
|
|
|
lumiera::Time get_playback_point() const;
|
2009-03-23 23:22:14 +01:00
|
|
|
|
2009-03-27 15:26:08 +01:00
|
|
|
/**
|
|
|
|
|
* A signal to notify when the selected period has changed.
|
2011-01-03 10:30:45 +01:00
|
|
|
*/
|
2009-03-23 23:22:14 +01:00
|
|
|
sigc::signal<void> selection_changed_signal() const;
|
|
|
|
|
|
2009-03-27 15:26:08 +01:00
|
|
|
/**
|
|
|
|
|
* A signal to notify when the playback point or playback periods have
|
|
|
|
|
* changed.
|
2011-01-03 10:30:45 +01:00
|
|
|
*/
|
2009-03-23 23:22:14 +01:00
|
|
|
sigc::signal<void> playback_changed_signal() const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A pointer to the sequence object which this timeline_widget will
|
|
|
|
|
* represent.
|
|
|
|
|
* @remarks This pointer is set by the constructor and is constant, so
|
|
|
|
|
* will not change in value during the lifetime of the class.
|
2011-01-03 10:30:45 +01:00
|
|
|
*/
|
2009-03-23 23:22:14 +01:00
|
|
|
boost::shared_ptr<model::Sequence> sequence;
|
|
|
|
|
|
|
|
|
|
// View State
|
2009-03-27 15:26:08 +01:00
|
|
|
/**
|
|
|
|
|
* The ViewWindow for the TimelineWidget display with.
|
2011-01-03 10:30:45 +01:00
|
|
|
*/
|
2009-03-23 23:22:14 +01:00
|
|
|
timeline::TimelineViewWindow viewWindow;
|
|
|
|
|
|
|
|
|
|
// Selection State
|
2009-03-27 15:26:08 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The start time of the selection period.
|
2011-01-03 10:30:45 +01:00
|
|
|
*/
|
2009-08-30 17:26:27 +02:00
|
|
|
lumiera::Time selectionStart;
|
2009-03-27 15:26:08 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The end time of the selection period.
|
2011-01-03 10:30:45 +01:00
|
|
|
*/
|
2009-08-30 17:26:27 +02:00
|
|
|
lumiera::Time selectionEnd;
|
2009-03-27 15:26:08 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The start time of the playback period.
|
2011-01-03 10:30:45 +01:00
|
|
|
*/
|
2009-08-30 17:26:27 +02:00
|
|
|
lumiera::Time playbackPeriodStart;
|
2009-03-27 15:26:08 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The end time of the playback period.
|
2011-01-03 10:30:45 +01:00
|
|
|
*/
|
2009-08-30 17:26:27 +02:00
|
|
|
lumiera::Time playbackPeriodEnd;
|
2009-03-27 15:26:08 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The time of the playback point.
|
2011-01-03 10:30:45 +01:00
|
|
|
*/
|
2009-08-30 17:26:27 +02:00
|
|
|
lumiera::Time playbackPoint;
|
2009-03-23 23:22:14 +01:00
|
|
|
|
|
|
|
|
// Signals
|
2009-03-27 15:26:08 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A signal to notify when the selected period has changed.
|
2011-01-03 10:30:45 +01:00
|
|
|
*/
|
2009-03-23 23:22:14 +01:00
|
|
|
sigc::signal<void> selectionChangedSignal;
|
2009-03-27 15:26:08 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A signal to notify when the playback point or playback periods have
|
|
|
|
|
* changed.
|
2011-01-03 10:30:45 +01:00
|
|
|
*/
|
2009-03-23 23:22:14 +01:00
|
|
|
sigc::signal<void> playbackChangedSignal;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace timeline
|
|
|
|
|
} // namespace widgets
|
|
|
|
|
} // namespace gui
|
|
|
|
|
|
|
|
|
|
#endif // TIMELINE_STATE_HPP
|