Split pretty much the entire GUI in 3. Audio and Midi "editor strips" and

associated stuff are now separated (with common things in base classes).

Extremely dirty and in progress, but builds, runs, and audio/midi tracks/busses
all look (and really are) distinct in the GUI.


git-svn-id: svn://localhost/ardour2/branches/midi@691 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2006-07-23 12:03:19 +00:00
parent 2f7622e72c
commit 60454cc8dc
73 changed files with 6095 additions and 4016 deletions

View file

@ -77,9 +77,6 @@ class AudioPlaylist : public ARDOUR::Playlist
bool destroy_region (Region*);
void get_equivalent_regions (const AudioRegion&, std::vector<AudioRegion*>&);
void get_region_list_equivalent_regions (const AudioRegion&, std::vector<AudioRegion*>&);
void drop_all_states ();
protected:

View file

@ -75,11 +75,7 @@ class AudioRegion : public Region
AudioRegion (SourceList &, const XMLNode&);
~AudioRegion();
bool region_list_equivalent (const AudioRegion&) const ;
bool source_equivalent (const AudioRegion&) const;
bool equivalent (const AudioRegion&) const;
bool size_equivalent (const AudioRegion&) const;
bool overlap_equivalent (const AudioRegion&) const;
bool source_equivalent (const Region&) const;
bool speed_mismatch (float) const;

View file

@ -81,6 +81,8 @@ class IO : public Stateful, public ARDOUR::StateManager
void set_output_minimum (int n);
void set_output_maximum (int n);
Buffer::Type default_type() const { return _default_type; }
const string& name() const { return _name; }
virtual int set_name (string str, void *src);

View file

@ -59,11 +59,7 @@ class MidiRegion : public Region
MidiRegion (SourceList &, const XMLNode&);
~MidiRegion();
bool region_list_equivalent (const MidiRegion&) const ;
bool source_equivalent (const MidiRegion&) const;
bool equivalent (const MidiRegion&) const;
bool size_equivalent (const MidiRegion&) const;
bool overlap_equivalent (const MidiRegion&) const;
bool source_equivalent (const Region&) const;
bool speed_mismatch (float) const;

View file

@ -81,6 +81,8 @@ class Playlist : public Stateful, public StateManager {
void add_region (const Region&, jack_nframes_t position, float times = 1, bool with_save = true);
void remove_region (Region *);
void get_equivalent_regions (const Region&, std::vector<Region*>&);
void get_region_list_equivalent_regions (const Region&, std::vector<Region*>&);
void replace_region (Region& old, Region& newr, jack_nframes_t pos);
void split_region (Region&, jack_nframes_t position);
void partition (jack_nframes_t start, jack_nframes_t end, bool just_top_level);

View file

@ -121,7 +121,7 @@ class Region : public Stateful, public StateManager
bool hidden() const { return _flags & Hidden; }
bool muted() const { return _flags & Muted; }
bool opaque () const { return _flags & Opaque; }
bool envelope_active () const { return _flags & EnvelopeActive; }
//bool envelope_active () const { return _flags & EnvelopeActive; }
bool locked() const { return _flags & Locked; }
bool automatic() const { return _flags & Automatic; }
bool whole_file() const { return _flags & WholeFile ; }
@ -139,6 +139,12 @@ class Region : public Stateful, public StateManager
OverlapType coverage (jack_nframes_t start, jack_nframes_t end) const {
return ARDOUR::coverage (_position, _position + _length - 1, start, end);
}
bool equivalent (const Region&) const;
bool size_equivalent (const Region&) const;
bool overlap_equivalent (const Region&) const;
bool region_list_equivalent (const Region&) const;
virtual bool source_equivalent (const Region&) const = 0;
/*virtual jack_nframes_t read_at (Sample *buf, Sample *mixdown_buffer,
float *gain_buffer, char * workbuf, jack_nframes_t position, jack_nframes_t cnt,
@ -173,7 +179,7 @@ class Region : public Stateful, public StateManager
void set_hidden (bool yn);
void set_muted (bool yn);
void set_opaque (bool yn);
void set_envelope_active (bool yn);
//void set_envelope_active (bool yn);
void set_locked (bool yn);
virtual uint32_t read_data_count() const { return _read_data_count; }

View file

@ -636,7 +636,7 @@ class Session : public sigc::trackable, public Stateful
string path_from_region_name (string name, string identifier);
AudioRegion* find_whole_file_parent (AudioRegion&);
void find_equivalent_playlist_regions (AudioRegion&, std::vector<AudioRegion*>& result);
void find_equivalent_playlist_regions (Region&, std::vector<Region*>& result);
AudioRegion *XMLRegionFactory (const XMLNode&, bool full);

View file

@ -882,38 +882,6 @@ AudioPlaylist::crossfade_changed (Change ignored)
notify_modified ();
}
void
AudioPlaylist::get_equivalent_regions (const AudioRegion& other, vector<AudioRegion*>& results)
{
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
AudioRegion* ar = dynamic_cast<AudioRegion*> (*i);
if (ar) {
if (Config->get_use_overlap_equivalency()) {
if (ar->overlap_equivalent (other)) {
results.push_back (ar);
} else if (ar->equivalent (other)) {
results.push_back (ar);
}
}
}
}
}
void
AudioPlaylist::get_region_list_equivalent_regions (const AudioRegion& other, vector<AudioRegion*>& results)
{
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
AudioRegion* ar = dynamic_cast<AudioRegion*> (*i);
if (ar && ar->region_list_equivalent (other)) {
results.push_back (ar);
}
}
}
bool
AudioPlaylist::region_changed (Change what_changed, Region* region)
{

View file

@ -1139,24 +1139,22 @@ AudioRegion::master_source_names ()
}
bool
AudioRegion::region_list_equivalent (const AudioRegion& other) const
AudioRegion::source_equivalent (const Region& o) const
{
return size_equivalent (other) && source_equivalent (other) && _name == other._name;
}
const AudioRegion* other = dynamic_cast<const AudioRegion*>(&o);
if (!other)
return false;
bool
AudioRegion::source_equivalent (const AudioRegion& other) const
{
SourceList::const_iterator i;
SourceList::const_iterator io;
for (i = sources.begin(), io = other.sources.begin(); i != sources.end() && io != other.sources.end(); ++i, ++io) {
for (i = sources.begin(), io = other->sources.begin(); i != sources.end() && io != other->sources.end(); ++i, ++io) {
if ((*i)->id() != (*io)->id()) {
return false;
}
}
for (i = master_sources.begin(), io = other.master_sources.begin(); i != master_sources.end() && io != other.master_sources.end(); ++i, ++io) {
for (i = master_sources.begin(), io = other->master_sources.begin(); i != master_sources.end() && io != other->master_sources.end(); ++i, ++io) {
if ((*i)->id() != (*io)->id()) {
return false;
}
@ -1165,27 +1163,6 @@ AudioRegion::source_equivalent (const AudioRegion& other) const
return true;
}
bool
AudioRegion::overlap_equivalent (const AudioRegion& other) const
{
return coverage (other.first_frame(), other.last_frame()) != OverlapNone;
}
bool
AudioRegion::equivalent (const AudioRegion& other) const
{
return _start == other._start &&
_position == other._position &&
_length == other._length;
}
bool
AudioRegion::size_equivalent (const AudioRegion& other) const
{
return _start == other._start &&
_length == other._length;
}
int
AudioRegion::apply (AudioFilter& filter)
{

View file

@ -501,24 +501,22 @@ MidiRegion::master_source_names ()
}
bool
MidiRegion::region_list_equivalent (const MidiRegion& other) const
MidiRegion::source_equivalent (const Region& o) const
{
return size_equivalent (other) && source_equivalent (other) && _name == other._name;
}
const MidiRegion* other = dynamic_cast<const MidiRegion*>(&o);
if (!other)
return false;
bool
MidiRegion::source_equivalent (const MidiRegion& other) const
{
SourceList::const_iterator i;
SourceList::const_iterator io;
for (i = sources.begin(), io = other.sources.begin(); i != sources.end() && io != other.sources.end(); ++i, ++io) {
for (i = sources.begin(), io = other->sources.begin(); i != sources.end() && io != other->sources.end(); ++i, ++io) {
if ((*i)->id() != (*io)->id()) {
return false;
}
}
for (i = master_sources.begin(), io = other.master_sources.begin(); i != master_sources.end() && io != other.master_sources.end(); ++i, ++io) {
for (i = master_sources.begin(), io = other->master_sources.begin(); i != master_sources.end() && io != other->master_sources.end(); ++i, ++io) {
if ((*i)->id() != (*io)->id()) {
return false;
}
@ -527,27 +525,6 @@ MidiRegion::source_equivalent (const MidiRegion& other) const
return true;
}
bool
MidiRegion::overlap_equivalent (const MidiRegion& other) const
{
return coverage (other.first_frame(), other.last_frame()) != OverlapNone;
}
bool
MidiRegion::equivalent (const MidiRegion& other) const
{
return _start == other._start &&
_position == other._position &&
_length == other._length;
}
bool
MidiRegion::size_equivalent (const MidiRegion& other) const
{
return _start == other._start &&
_length == other._length;
}
#if 0
int
MidiRegion::exportme (Session& session, AudioExportSpecification& spec)

View file

@ -598,6 +598,31 @@ Playlist::remove_region_internal (Region *region, bool delay_sort)
return -1;
}
void
Playlist::get_equivalent_regions (const Region& other, vector<Region*>& results)
{
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
if (Config->get_use_overlap_equivalency()) {
if ((*i)->overlap_equivalent (other)) {
results.push_back ((*i));
} else if ((*i)->equivalent (other)) {
results.push_back ((*i));
}
}
}
}
void
Playlist::get_region_list_equivalent_regions (const Region& other, vector<Region*>& results)
{
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
if ((*i) && (*i)->region_list_equivalent (other)) {
results.push_back (*i);
}
}
}
void
Playlist::partition (jack_nframes_t start, jack_nframes_t end, bool just_top_level)
{

View file

@ -990,3 +990,30 @@ Region::set_last_layer_op (uint64_t when)
{
_last_layer_op = when;
}
bool
Region::overlap_equivalent (const Region& other) const
{
return coverage (other.first_frame(), other.last_frame()) != OverlapNone;
}
bool
Region::equivalent (const Region& other) const
{
return _start == other._start &&
_position == other._position &&
_length == other._length;
}
bool
Region::size_equivalent (const Region& other) const
{
return _start == other._start &&
_length == other._length;
}
bool
Region::region_list_equivalent (const Region& other) const
{
return size_equivalent (other) && source_equivalent (other) && _name == other._name;
}

View file

@ -2774,18 +2774,10 @@ Session::find_whole_file_parent (AudioRegion& child)
}
void
Session::find_equivalent_playlist_regions (AudioRegion& region, vector<AudioRegion*>& result)
Session::find_equivalent_playlist_regions (Region& region, vector<Region*>& result)
{
for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
AudioPlaylist* pl;
if ((pl = dynamic_cast<AudioPlaylist*>(*i)) == 0) {
continue;
}
pl->get_region_list_equivalent_regions (region, result);
}
for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i)
(*i)->get_region_list_equivalent_regions (region, result);
}
int