lumiera_/src/gui/panels/timeline-panel.hpp

215 lines
4.7 KiB
C++
Raw Normal View History

/*
2008-04-19 21:31:27 +02:00
timeline-panel.hpp - Definition of the timeline panel
2010-12-17 23:28:49 +01:00
Copyright (C) Lumiera.org
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
2010-12-17 23:28:49 +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.
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
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
*/
2008-04-19 21:31:27 +02:00
/** @file timeline-panel.hpp
** This file contains the definition of the timeline panel
*/
2008-04-19 21:31:27 +02:00
#ifndef TIMELINE_PANEL_HPP
#define TIMELINE_PANEL_HPP
#include "panel.hpp"
#include "gui/widgets/timecode-widget.hpp"
#include "gui/widgets/timeline-widget.hpp"
2008-04-19 21:31:27 +02:00
#include <boost/scoped_ptr.hpp>
#include <boost/weak_ptr.hpp>
using namespace gui::widgets;
namespace gui {
2009-03-27 15:26:08 +01:00
2008-11-22 20:08:12 +01:00
namespace model {
class Sequence;
}
namespace panels {
2008-08-16 18:41:57 +02:00
/**
* The definition of the timeline panel class, which holds timeline
* widgets.
*/
class TimelinePanel : public Panel
{
public:
2008-08-16 18:41:57 +02:00
/**
2010-07-11 19:59:08 +02:00
* Constructor.
2009-04-13 17:11:50 +02:00
* @param panel_manager The owner panel manager widget.
* @param dock_item The GdlDockItem that will host this panel.
*/
2009-04-13 17:11:50 +02:00
TimelinePanel(workspace::PanelManager &panel_manager,
GdlDockItem *dock_item);
/**
* Destructor
*/
~TimelinePanel();
/**
* Get the title of the panel.
* @return Returns a pointer to the string title of the panel.
*/
static const char* get_title();
2009-04-04 19:53:09 +02:00
/**
* Get the stock id for this type panel.
* @return Returns a pointer to the string stock id of the panel.
*/
2009-04-04 19:53:09 +02:00
static const gchar* get_stock_id();
private:
//----- Event Handlers -----//
2008-10-07 22:17:29 +02:00
void on_play_pause();
void on_stop();
void on_arrow_tool();
void on_ibeam_tool();
void on_zoom_in();
void on_zoom_out();
2008-08-16 23:06:46 +02:00
void on_time_pressed();
2009-03-27 15:26:08 +01:00
2008-08-16 23:06:46 +02:00
void on_mouse_hover(gavl_time_t time);
2008-10-07 22:17:29 +02:00
void on_playback_period_drag_released();
2008-08-16 23:06:46 +02:00
2009-03-27 15:26:08 +01:00
/**
* An event handler for when the list of sequences changes.
*/
2008-11-22 20:08:12 +01:00
void on_sequence_list_changed();
2009-03-27 15:26:08 +01:00
/**
* An event handler for when a new sequence is chosen in the
* sequenceChooser.
*/
2009-03-27 15:26:08 +01:00
void on_sequence_chosen();
private:
2009-03-21 17:57:56 +01:00
void update_sequence_chooser();
2009-03-27 15:26:08 +01:00
2008-10-07 22:17:29 +02:00
void update_playback_buttons();
void update_tool_buttons();
void update_zoom_buttons();
2008-08-30 15:00:47 +02:00
2008-10-07 22:17:29 +02:00
void play();
void pause();
2009-04-13 17:11:50 +02:00
bool is_playing();
2008-10-07 22:17:29 +02:00
void set_tool(gui::widgets::timeline::ToolType tool);
2008-08-30 15:00:47 +02:00
void show_time(gavl_time_t time);
2009-03-27 15:26:08 +01:00
boost::shared_ptr<widgets::timeline::TimelineState> load_state(
boost::weak_ptr<model::Sequence> sequence);
2009-03-27 15:26:08 +01:00
private:
/**
* The definition of the sequence chooser combo box columns
*/
2009-03-27 15:26:08 +01:00
class SequenceChooserColumns : public Gtk::TreeModel::ColumnRecord
{
public:
/**
* Constructor
*/
2009-03-27 15:26:08 +01:00
SequenceChooserColumns()
{ add(nameColumn); add(sequenceColumn); }
/**
* An invisible column which will be used to identify the sequence
* of a row.
*/
2009-03-27 15:26:08 +01:00
Gtk::TreeModelColumn< boost::weak_ptr<model::Sequence> >
sequenceColumn;
/**
* The column to use as the label for the combo box widget items.
*/
2009-03-27 15:26:08 +01:00
Gtk::TreeModelColumn< Glib::ustring > nameColumn;
};
private:
//----- Data -----//
2009-03-21 17:57:56 +01:00
// Grip Widgets
2009-03-09 21:45:50 +01:00
ButtonBar toolbar;
2009-03-27 15:26:08 +01:00
// Sequence Chooser
SequenceChooserColumns sequenceChooserColumns;
Glib::RefPtr<Gtk::ListStore> sequenceChooserModel;
Gtk::ComboBox sequenceChooser;
sigc::connection sequenceChooserChangedConnection;
// Body Widgets
2009-03-27 15:26:08 +01:00
boost::scoped_ptr<TimelineWidget> timelineWidget;
std::map< boost::weak_ptr<model::Sequence>,
boost::shared_ptr<widgets::timeline::TimelineState> >
timelineStates;
// Toolbar Widgets
TimeCode timeCode;
2008-09-12 21:55:54 +02:00
MiniButton previousButton;
MiniButton rewindButton;
MiniButton playPauseButton;
MiniButton stopButton;
MiniButton forwardButton;
MiniButton nextButton;
2008-09-12 21:55:54 +02:00
MiniToggleButton arrowTool;
MiniToggleButton iBeamTool;
2010-12-24 23:17:28 +01:00
Gtk::SeparatorToolItem separator1;
2008-08-04 13:20:13 +02:00
MiniButton zoomIn;
MiniButton zoomOut;
2010-12-24 23:17:28 +01:00
Gtk::SeparatorToolItem separator2;
2008-09-12 21:55:54 +02:00
// Internals
bool updatingToolbar;
gui::widgets::timeline::ToolType currentTool;
2008-10-07 22:17:29 +02:00
private:
// TEST CODE
bool on_frame();
//----- Constants -----//
2008-10-07 22:17:29 +02:00
private:
static const int ZoomToolSteps;
};
} // namespace panels
} // namespace gui
2008-04-19 21:31:27 +02:00
#endif // TIMELINE_PANEL_H