2008-04-12 22:15:07 +02:00
|
|
|
/*
|
2008-04-19 21:31:27 +02:00
|
|
|
timeline-panel.cpp - Implementation of the timeline panel
|
2008-04-12 22:15:07 +02:00
|
|
|
|
|
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License as
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
* *****************************************************/
|
|
|
|
|
|
2008-05-17 19:12:07 +02:00
|
|
|
#include "../gtk-lumiera.hpp"
|
2008-04-19 21:31:27 +02:00
|
|
|
#include "timeline-panel.hpp"
|
2008-04-12 22:15:07 +02:00
|
|
|
|
2008-05-22 20:19:04 +02:00
|
|
|
using namespace Gtk;
|
2008-07-16 23:33:42 +02:00
|
|
|
using namespace sigc;
|
2008-05-22 20:19:04 +02:00
|
|
|
|
2008-04-12 22:15:07 +02:00
|
|
|
namespace lumiera {
|
|
|
|
|
namespace gui {
|
|
|
|
|
namespace panels {
|
2008-07-16 23:33:42 +02:00
|
|
|
|
|
|
|
|
const int TimelinePanel::ZoomToolSteps = 2; // 2 seems comfortable
|
2008-04-12 22:15:07 +02:00
|
|
|
|
2008-04-19 21:31:27 +02:00
|
|
|
TimelinePanel::TimelinePanel() :
|
2008-07-15 20:00:24 +02:00
|
|
|
Panel("timeline", _("Timeline"), "timeline_panel"),
|
2008-07-16 23:33:42 +02:00
|
|
|
zoomIn(Stock::ZOOM_IN),
|
|
|
|
|
zoomOut(Stock::ZOOM_OUT)
|
|
|
|
|
{
|
|
|
|
|
// Setup the toolbar
|
|
|
|
|
toolbar.append(zoomIn, mem_fun(this, &TimelinePanel::on_zoom_in));
|
|
|
|
|
toolbar.append(zoomOut, mem_fun(this, &TimelinePanel::on_zoom_out));
|
|
|
|
|
|
|
|
|
|
toolbar.set_icon_size(IconSize(ICON_SIZE_SMALL_TOOLBAR));
|
|
|
|
|
toolbar.set_toolbar_style(TOOLBAR_ICONS);
|
|
|
|
|
|
|
|
|
|
// Add the toolbar
|
|
|
|
|
pack_start(toolbar, PACK_SHRINK);
|
|
|
|
|
pack_start(timelineWidget, PACK_EXPAND_WIDGET);
|
|
|
|
|
|
|
|
|
|
update_zoom_buttons();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
TimelinePanel::on_zoom_in()
|
|
|
|
|
{
|
|
|
|
|
timelineWidget.zoom_view(ZoomToolSteps);
|
|
|
|
|
update_zoom_buttons();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
TimelinePanel::on_zoom_out()
|
|
|
|
|
{
|
|
|
|
|
timelineWidget.zoom_view(-ZoomToolSteps);
|
|
|
|
|
update_zoom_buttons();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
TimelinePanel::update_zoom_buttons()
|
|
|
|
|
{
|
|
|
|
|
zoomIn.set_sensitive(timelineWidget.get_time_scale() != 1);
|
|
|
|
|
zoomOut.set_sensitive(timelineWidget.get_time_scale() !=
|
|
|
|
|
TimelineWidget::MaxScale);
|
|
|
|
|
}
|
2008-04-12 22:15:07 +02:00
|
|
|
|
|
|
|
|
} // namespace panels
|
|
|
|
|
} // namespace gui
|
|
|
|
|
} // namespace lumiera
|