Unified Sequence and Track together as TrackBase
This commit is contained in:
parent
5eb43b7c18
commit
7c1046e162
10 changed files with 130 additions and 62 deletions
|
|
@ -80,6 +80,8 @@ lumigui_SOURCES = \
|
|||
$(lumigui_srcdir)/widgets/timeline/timeline-clip.hpp \
|
||||
$(lumigui_srcdir)/model/project.cpp \
|
||||
$(lumigui_srcdir)/model/project.hpp \
|
||||
$(lumigui_srcdir)/model/track-base.cpp \
|
||||
$(lumigui_srcdir)/model/track-base.hpp \
|
||||
$(lumigui_srcdir)/model/sequence.cpp \
|
||||
$(lumigui_srcdir)/model/sequence.hpp \
|
||||
$(lumigui_srcdir)/model/track.cpp \
|
||||
|
|
|
|||
|
|
@ -49,29 +49,11 @@ Sequence::Sequence()
|
|||
// END TEST CODE
|
||||
}
|
||||
|
||||
const Glib::ustring
|
||||
Sequence::get_name() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
void
|
||||
Sequence::set_name(const Glib::ustring &name)
|
||||
{
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
const std::list< boost::shared_ptr<Track> >&
|
||||
Sequence::get_tracks() const
|
||||
Sequence::get_child_tracks() const
|
||||
{
|
||||
return tracks;
|
||||
}
|
||||
|
||||
void
|
||||
Sequence::add_track(shared_ptr<Track> track)
|
||||
{
|
||||
tracks.push_back(track);
|
||||
}
|
||||
|
||||
} // namespace model
|
||||
} // namespace gui
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#ifndef SEQUENCE_HPP
|
||||
#define SEQUENCE_HPP
|
||||
|
||||
#include "../gtk-lumiera.hpp"
|
||||
#include "track-base.hpp"
|
||||
|
||||
// TEST CODE
|
||||
#include "group-track.hpp"
|
||||
|
|
@ -38,22 +38,16 @@ namespace model {
|
|||
|
||||
class Track;
|
||||
|
||||
class Sequence
|
||||
class Sequence : public TrackBase
|
||||
{
|
||||
public:
|
||||
Sequence();
|
||||
|
||||
const Glib::ustring get_name() const;
|
||||
|
||||
void set_name(const Glib::ustring &name);
|
||||
|
||||
const std::list< boost::shared_ptr<Track> >& get_tracks() const;
|
||||
|
||||
void add_track(boost::shared_ptr<Track> track);
|
||||
|
||||
const std::list< boost::shared_ptr<model::Track> >&
|
||||
get_child_tracks() const;
|
||||
|
||||
private:
|
||||
Glib::ustring name;
|
||||
|
||||
//----- Data -----//
|
||||
std::list< boost::shared_ptr<Track> > tracks;
|
||||
};
|
||||
|
||||
|
|
|
|||
53
src/gui/model/track-base.cpp
Normal file
53
src/gui/model/track-base.cpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
track-base.cpp - Implementation of the TrackBase 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 "track.hpp"
|
||||
|
||||
namespace gui {
|
||||
namespace model {
|
||||
|
||||
const std::list< boost::shared_ptr<Track> > TrackBase::NoChildren;
|
||||
|
||||
TrackBase::TrackBase()
|
||||
{
|
||||
}
|
||||
|
||||
const std::list< boost::shared_ptr<model::Track> >&
|
||||
TrackBase::get_child_tracks() const
|
||||
{
|
||||
return NoChildren;
|
||||
}
|
||||
|
||||
const Glib::ustring
|
||||
TrackBase::get_name() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
void
|
||||
TrackBase::set_name(const Glib::ustring &name)
|
||||
{
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
} // namespace model
|
||||
} // namespace gui
|
||||
61
src/gui/model/track-base.hpp
Normal file
61
src/gui/model/track-base.hpp
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
track-track.hpp - Definition of the TrackBase 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.
|
||||
|
||||
*/
|
||||
/** @file track-base.hpp
|
||||
** This file contains the definition of TrackBase, a class which
|
||||
** represents a base functionality for tracks and sequences which
|
||||
** are also track parents. This class wraps proc layer data
|
||||
*/
|
||||
|
||||
#include "../gtk-lumiera.hpp"
|
||||
|
||||
#ifndef TRACK_BASE_HPP
|
||||
#define TRACK_BASE_HPP
|
||||
|
||||
namespace gui {
|
||||
namespace model {
|
||||
|
||||
class Track;
|
||||
|
||||
class TrackBase
|
||||
{
|
||||
public:
|
||||
TrackBase();
|
||||
|
||||
virtual void add_child_track(Track* child) {};
|
||||
|
||||
virtual const std::list< boost::shared_ptr<Track> >&
|
||||
get_child_tracks() const;
|
||||
|
||||
const Glib::ustring get_name() const;
|
||||
|
||||
void set_name(const Glib::ustring &name);
|
||||
|
||||
private:
|
||||
Glib::ustring name;
|
||||
|
||||
static const std::list< boost::shared_ptr<Track> > NoChildren;
|
||||
};
|
||||
|
||||
} // namespace model
|
||||
} // namespace gui
|
||||
|
||||
#endif // TRACK_BASE_HPP
|
||||
|
|
@ -20,31 +20,15 @@
|
|||
|
||||
* *****************************************************/
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "track.hpp"
|
||||
|
||||
namespace gui {
|
||||
namespace model {
|
||||
|
||||
const std::list< boost::shared_ptr<model::Track> > Track::NoChildren;
|
||||
|
||||
Track::Track()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const std::list< boost::shared_ptr<model::Track> >&
|
||||
Track::get_child_tracks() const
|
||||
{
|
||||
return NoChildren;
|
||||
}
|
||||
|
||||
Glib::ustring
|
||||
Track::get_title()
|
||||
{
|
||||
return "Hello";
|
||||
}
|
||||
|
||||
} // namespace model
|
||||
} // namespace gui
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
** represents a track, and wraps proc layer data
|
||||
*/
|
||||
|
||||
#include "../gtk-lumiera.hpp"
|
||||
#include "track-base.hpp"
|
||||
|
||||
#ifndef TRACK_HPP
|
||||
#define TRACK_HPP
|
||||
|
|
@ -32,20 +32,12 @@
|
|||
namespace gui {
|
||||
namespace model {
|
||||
|
||||
class Track
|
||||
class Track : public TrackBase
|
||||
{
|
||||
public:
|
||||
Track();
|
||||
|
||||
virtual void add_child_track(Track* child) {};
|
||||
|
||||
virtual const std::list< boost::shared_ptr<model::Track> >&
|
||||
get_child_tracks() const;
|
||||
|
||||
Glib::ustring get_title();
|
||||
|
||||
private:
|
||||
static const std::list< boost::shared_ptr<model::Track> > NoChildren;
|
||||
};
|
||||
|
||||
} // namespace model
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ TimelineWidget::update_tracks()
|
|||
|
||||
// Recalculate the total height of the timeline scrolled area
|
||||
totalHeight = 0;
|
||||
BOOST_FOREACH(shared_ptr<model::Track> track, sequence->get_tracks())
|
||||
BOOST_FOREACH(shared_ptr<model::Track> track, sequence->get_child_tracks())
|
||||
{
|
||||
ASSERT(track);
|
||||
totalHeight += measure_branch_height(track);
|
||||
|
|
@ -296,7 +296,7 @@ TimelineWidget::create_timeline_tracks()
|
|||
{
|
||||
REQUIRE(sequence);
|
||||
|
||||
BOOST_FOREACH(shared_ptr<model::Track> child, sequence->get_tracks())
|
||||
BOOST_FOREACH(shared_ptr<model::Track> child, sequence->get_child_tracks())
|
||||
create_timeline_tracks_from_branch(child);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ TimelineBody::draw_tracks(Cairo::RefPtr<Cairo::Context> cr)
|
|||
|
||||
// Interate drawing each track
|
||||
BOOST_FOREACH( shared_ptr<model::Track> model_track,
|
||||
timelineWidget->sequence->get_tracks() )
|
||||
timelineWidget->sequence->get_child_tracks() )
|
||||
draw_track_recursive(cr, model_track, allocation.get_width());
|
||||
|
||||
// Restore the view matrix
|
||||
|
|
@ -431,7 +431,7 @@ TimelineBody::track_from_point(const int y) const
|
|||
int offset = -get_vertical_offset();
|
||||
|
||||
BOOST_FOREACH( shared_ptr<model::Track> model_track,
|
||||
timelineWidget->sequence->get_tracks() )
|
||||
timelineWidget->sequence->get_child_tracks() )
|
||||
{
|
||||
shared_ptr<timeline::Track> result = track_from_branch(
|
||||
model_track, y, offset);
|
||||
|
|
|
|||
|
|
@ -502,7 +502,7 @@ TimelineHeaderContainer::get_tracks() const
|
|||
{
|
||||
REQUIRE(timelineWidget != NULL);
|
||||
REQUIRE(timelineWidget->sequence);
|
||||
return timelineWidget->sequence->get_tracks();
|
||||
return timelineWidget->sequence->get_child_tracks();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Reference in a new issue