lumiera_/src/gui/widgets/timeline/timeline-layout-helper.cpp

76 lines
2.1 KiB
C++
Raw Normal View History

/*
timeline-layout-helper.cpp - Implementation of the timeline
layout helper class
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.
* *****************************************************/
#include <boost/foreach.hpp>
#include "timeline-layout-helper.hpp"
#include "../timeline-widget.hpp"
#include "../../model/sequence.hpp"
using namespace Gtk;
using namespace std;
using namespace boost;
using namespace lumiera;
namespace gui {
namespace widgets {
namespace timeline {
TimelineLayoutHelper::TimelineLayoutHelper(TimelineWidget &owner)
: timelineWidget(owner)
{
}
void
TimelineLayoutHelper::clone_tree_from_sequence()
{
const shared_ptr<model::Sequence> &sequence = timelineWidget.sequence;
REQUIRE(sequence);
layoutTree.clear();
tree< shared_ptr<model::Track> >::iterator_base iterator =
layoutTree.set_head(sequence);
add_branch(iterator, sequence);
}
void
TimelineLayoutHelper::add_branch(
lumiera::tree< shared_ptr<model::Track> >::iterator_base
parent_iterator,
shared_ptr<model::Track> parent)
{
BOOST_FOREACH(shared_ptr<model::Track> child,
parent->get_child_tracks())
{
2008-12-31 18:29:57 +01:00
tree< shared_ptr<model::Track> >::iterator_base
child_iterator =
layoutTree.append_child(parent_iterator, child);
add_branch(child_iterator, child);
}
}
} // namespace timeline
} // namespace widgets
} // namespace gui