2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2001, 2006 Paul Davis
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ardour_streamview_h__
|
|
|
|
#define __ardour_streamview_h__
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
#include <cmath>
|
|
|
|
|
2009-12-19 15:26:31 -05:00
|
|
|
#include "pbd/signals.h"
|
2009-12-17 13:24:23 -05:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/location.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "enums.h"
|
2005-11-12 22:53:51 -05:00
|
|
|
#include "simplerect.h"
|
2005-11-23 12:21:12 -05:00
|
|
|
#include "canvas.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-11-28 23:41:15 -05:00
|
|
|
namespace Gdk {
|
|
|
|
class Color;
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
namespace ARDOUR {
|
|
|
|
class Route;
|
|
|
|
class Crossfade;
|
|
|
|
class PeakData;
|
2006-07-23 08:03:19 -04:00
|
|
|
class Region;
|
2005-09-25 14:42:24 -04:00
|
|
|
class Source;
|
2010-04-21 16:42:22 -04:00
|
|
|
class Track;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
struct RecBoxInfo {
|
2006-07-23 08:03:19 -04:00
|
|
|
ArdourCanvas::SimpleRect* rectangle;
|
2009-02-16 02:04:27 -05:00
|
|
|
nframes_t start;
|
|
|
|
nframes_t length;
|
2005-09-25 14:42:24 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class Selectable;
|
2006-07-23 08:03:19 -04:00
|
|
|
class RouteTimeAxisView;
|
|
|
|
class RegionView;
|
|
|
|
class RegionSelection;
|
2005-09-25 14:42:24 -04:00
|
|
|
class CrossfadeView;
|
|
|
|
class Selection;
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
class StreamView : public sigc::trackable, public PBD::ScopedConnectionList
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-07-23 08:03:19 -04:00
|
|
|
public:
|
|
|
|
virtual ~StreamView ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
RouteTimeAxisView& trackview() { return _trackview; }
|
|
|
|
const RouteTimeAxisView& trackview() const { return _trackview; }
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
void attach ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
void set_zoom_all();
|
|
|
|
|
|
|
|
int set_position (gdouble x, gdouble y);
|
2007-05-17 06:41:14 -04:00
|
|
|
virtual int set_height (double);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
virtual int set_samples_per_unit (gdouble spp);
|
|
|
|
gdouble get_samples_per_unit () { return _samples_per_unit; }
|
2010-10-17 19:35:05 -04:00
|
|
|
virtual void horizontal_position_changed () {}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-12-22 23:11:24 -05:00
|
|
|
void set_layer_display (LayerDisplay);
|
2009-01-05 22:18:09 -05:00
|
|
|
LayerDisplay layer_display () const { return _layer_display; }
|
2007-05-17 06:41:14 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
ArdourCanvas::Group* background_group() { return _background_group; }
|
2010-05-22 22:42:37 -04:00
|
|
|
ArdourCanvas::Group* canvas_item() { return _canvas_group; }
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
enum ColorTarget {
|
|
|
|
RegionColor,
|
|
|
|
StreamBaseColor
|
|
|
|
};
|
|
|
|
|
2005-10-06 00:59:20 -04:00
|
|
|
Gdk::Color get_region_color () const { return region_color; }
|
2006-07-23 08:03:19 -04:00
|
|
|
void apply_color (Gdk::Color&, ColorTarget t);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-01-07 14:15:33 -05:00
|
|
|
uint32_t num_selected_regionviews () const;
|
|
|
|
|
2006-08-29 17:21:48 -04:00
|
|
|
RegionView* find_view (boost::shared_ptr<const ARDOUR::Region>);
|
2006-07-23 08:03:19 -04:00
|
|
|
void foreach_regionview (sigc::slot<void,RegionView*> slot);
|
2010-01-07 14:15:33 -05:00
|
|
|
void foreach_selected_regionview (sigc::slot<void,RegionView*> slot);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
void set_selected_regionviews (RegionSelection&);
|
2010-08-06 19:28:44 -04:00
|
|
|
void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable* >&);
|
2009-05-12 13:03:42 -04:00
|
|
|
void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-07-21 11:55:17 -04:00
|
|
|
virtual void update_contents_metrics(boost::shared_ptr<ARDOUR::Region>) {}
|
2009-05-13 17:34:09 -04:00
|
|
|
|
2010-01-25 15:34:09 -05:00
|
|
|
void add_region_view (boost::weak_ptr<ARDOUR::Region>);
|
2009-05-13 17:34:09 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
void region_layered (RegionView*);
|
2008-09-19 15:32:10 -04:00
|
|
|
virtual void update_contents_height ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-04-21 16:42:22 -04:00
|
|
|
virtual void redisplay_track () = 0;
|
2009-01-05 22:18:09 -05:00
|
|
|
double child_height () const;
|
|
|
|
ARDOUR::layer_t layers () const { return _layers; }
|
2009-06-08 15:28:51 -04:00
|
|
|
|
|
|
|
virtual RegionView* create_region_view (boost::shared_ptr<ARDOUR::Region>, bool, bool) {
|
|
|
|
return 0;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-11-14 10:01:53 -05:00
|
|
|
void check_record_layers (boost::shared_ptr<ARDOUR::Region>, ARDOUR::framepos_t);
|
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
sigc::signal<void,RegionView*> RegionViewAdded;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
protected:
|
2010-05-22 22:42:37 -04:00
|
|
|
StreamView (RouteTimeAxisView&, ArdourCanvas::Group* background_group = 0, ArdourCanvas::Group* canvas_group = 0);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-07-29 23:25:38 -04:00
|
|
|
void transport_changed();
|
2007-06-25 22:16:54 -04:00
|
|
|
void transport_looped();
|
2006-08-01 13:19:38 -04:00
|
|
|
void rec_enable_changed();
|
2006-07-29 23:25:38 -04:00
|
|
|
void sess_rec_enable_changed();
|
2006-07-23 08:03:19 -04:00
|
|
|
virtual void setup_rec_box () = 0;
|
2010-10-08 10:54:16 -04:00
|
|
|
virtual void update_rec_box ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-02-16 02:04:27 -05:00
|
|
|
virtual RegionView* add_region_view_internal (boost::shared_ptr<ARDOUR::Region>,
|
2009-05-13 17:34:09 -04:00
|
|
|
bool wait_for_waves, bool recording = false) = 0;
|
2006-10-21 15:01:50 -04:00
|
|
|
virtual void remove_region_view (boost::weak_ptr<ARDOUR::Region> );
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-04-21 16:42:22 -04:00
|
|
|
void display_track (boost::shared_ptr<ARDOUR::Track>);
|
|
|
|
virtual void undisplay_track ();
|
2006-08-01 13:19:38 -04:00
|
|
|
void diskstream_changed ();
|
2009-02-15 15:31:05 -05:00
|
|
|
void layer_regions ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-04-21 16:42:22 -04:00
|
|
|
virtual void playlist_switched (boost::weak_ptr<ARDOUR::Track>);
|
|
|
|
virtual void playlist_layered (boost::weak_ptr<ARDOUR::Track>);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-06-15 18:08:27 -04:00
|
|
|
virtual void color_handler () = 0;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
RouteTimeAxisView& _trackview;
|
2010-05-22 22:42:37 -04:00
|
|
|
bool owns_background_group;
|
2008-02-21 20:45:29 -05:00
|
|
|
bool owns_canvas_group;
|
2008-12-12 09:43:24 -05:00
|
|
|
ArdourCanvas::Group* _background_group;
|
2010-05-22 22:42:37 -04:00
|
|
|
ArdourCanvas::Group* _canvas_group;
|
2006-07-23 08:03:19 -04:00
|
|
|
ArdourCanvas::SimpleRect* canvas_rect; /* frame around the whole thing */
|
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
typedef std::list<RegionView* > RegionViewList;
|
2006-07-29 23:25:38 -04:00
|
|
|
RegionViewList region_views;
|
2006-07-23 08:03:19 -04:00
|
|
|
|
|
|
|
double _samples_per_unit;
|
|
|
|
|
|
|
|
sigc::connection screen_update_connection;
|
2009-05-12 13:03:42 -04:00
|
|
|
std::vector<RecBoxInfo> rec_rects;
|
|
|
|
std::list< std::pair<boost::shared_ptr<ARDOUR::Region>,RegionView* > > rec_regions;
|
2006-07-23 08:03:19 -04:00
|
|
|
bool rec_updating;
|
|
|
|
bool rec_active;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-08-01 20:22:16 -04:00
|
|
|
Gdk::Color region_color; ///< Contained region color
|
|
|
|
uint32_t stream_base_color; ///< Background color
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
PBD::ScopedConnectionList playlist_connections;
|
2010-01-25 15:34:09 -05:00
|
|
|
PBD::ScopedConnection playlist_switched_connection;
|
2007-05-17 06:41:14 -04:00
|
|
|
|
2009-01-05 22:18:09 -05:00
|
|
|
ARDOUR::layer_t _layers;
|
2009-02-16 02:04:27 -05:00
|
|
|
LayerDisplay _layer_display;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-05-17 06:41:14 -04:00
|
|
|
double height;
|
2007-05-31 17:37:20 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
PBD::ScopedConnectionList rec_data_ready_connections;
|
|
|
|
nframes_t last_rec_data_frame;
|
2008-12-31 13:44:32 -05:00
|
|
|
|
2010-11-14 10:01:53 -05:00
|
|
|
/* When recording, the session time at which a new layer must be created for the region
|
|
|
|
being recorded, or max_framepos if not applicable.
|
|
|
|
*/
|
|
|
|
framepos_t _new_rec_layer_time;
|
|
|
|
void setup_new_rec_layer_time (boost::shared_ptr<ARDOUR::Region>);
|
|
|
|
|
2008-12-31 13:44:32 -05:00
|
|
|
private:
|
|
|
|
void update_coverage_frames ();
|
2005-09-25 14:42:24 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __ardour_streamview_h__ */
|
2006-07-23 08:03:19 -04:00
|
|
|
|