2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2005-2019 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2005 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
* Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
|
|
|
|
* Copyright (C) 2006-2014 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2007 Doug McLain <doug@nostar.net>
|
|
|
|
* Copyright (C) 2015-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#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-28 23:41:15 -05:00
|
|
|
namespace Gdk {
|
|
|
|
class Color;
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
namespace ARDOUR {
|
|
|
|
class Crossfade;
|
2006-07-23 08:03:19 -04:00
|
|
|
class Region;
|
2012-05-23 22:54:10 -04:00
|
|
|
class Route;
|
2005-09-25 14:42:24 -04:00
|
|
|
class Source;
|
2010-04-21 16:42:22 -04:00
|
|
|
class Track;
|
2012-05-23 22:54:10 -04:00
|
|
|
struct PeakData;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
namespace ArdourCanvas {
|
|
|
|
class Rectangle;
|
2014-06-22 11:41:05 -04:00
|
|
|
class Container;
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
struct RecBoxInfo {
|
2019-04-08 18:27:05 -04:00
|
|
|
ArdourCanvas::Rectangle* rectangle;
|
|
|
|
samplepos_t start;
|
|
|
|
ARDOUR::samplecnt_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
|
|
|
|
2013-04-12 11:31:50 -04:00
|
|
|
virtual int set_samples_per_pixel (double);
|
|
|
|
gdouble get_samples_per_pixel () const { return _samples_per_pixel; }
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2017-01-29 09:02:07 -05:00
|
|
|
virtual void set_layer_display (LayerDisplay);
|
|
|
|
virtual bool can_change_layer_display() const { return true; }
|
2009-01-05 22:18:09 -05:00
|
|
|
LayerDisplay layer_display () const { return _layer_display; }
|
2007-05-17 06:41:14 -04:00
|
|
|
|
2014-06-22 11:41:05 -04:00
|
|
|
ArdourCanvas::Container* canvas_item() { return _canvas_group; }
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
enum ColorTarget {
|
|
|
|
RegionColor,
|
|
|
|
StreamBaseColor
|
|
|
|
};
|
|
|
|
|
2014-06-09 23:28:32 -04:00
|
|
|
uint32_t get_region_color () const { return region_color; }
|
|
|
|
void apply_color (uint32_t, ColorTarget t);
|
|
|
|
void apply_color (Gdk::Color const &, 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&);
|
2017-09-18 12:39:17 -04:00
|
|
|
void get_selectables (ARDOUR::samplepos_t, ARDOUR::samplepos_t, double, double, std::list<Selectable* >&, bool within = false);
|
2009-05-12 13:03:42 -04:00
|
|
|
void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
|
2021-06-20 18:50:45 -04:00
|
|
|
void get_regionviews_at_or_after (ARDOUR::samplepos_t, RegionSelection&);
|
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
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
void check_record_layers (boost::shared_ptr<ARDOUR::Region>, ARDOUR::samplepos_t);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2011-12-27 16:10:20 -05:00
|
|
|
virtual void playlist_layered (boost::weak_ptr<ARDOUR::Track>);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-01-30 08:24:41 -05:00
|
|
|
sigc::signal<void, RegionView*> RegionViewAdded;
|
|
|
|
sigc::signal<void> RegionViewRemoved;
|
2012-06-13 16:37:34 -04:00
|
|
|
/** Emitted when the height of regions has changed */
|
|
|
|
sigc::signal<void> ContentsHeightChanged;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2019-05-29 19:37:48 -04:00
|
|
|
virtual void parameter_changed (std::string const &);
|
2019-05-29 17:16:00 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
protected:
|
2017-07-01 12:42:24 -04:00
|
|
|
StreamView (RouteTimeAxisView&, ArdourCanvas::Container* 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();
|
2017-09-18 12:39:17 -04:00
|
|
|
void create_rec_box(samplepos_t sample_pos, double width);
|
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 ();
|
2009-02-15 15:31:05 -05:00
|
|
|
void layer_regions ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2012-04-16 12:32:22 -04:00
|
|
|
void playlist_switched (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
|
|
|
|
2019-04-08 18:27:05 -04:00
|
|
|
RouteTimeAxisView& _trackview;
|
|
|
|
ArdourCanvas::Container* _canvas_group;
|
2019-04-08 21:00:31 -04:00
|
|
|
ArdourCanvas::Rectangle* canvas_rect; /* frame around the whole thing */
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
typedef std::list<RegionView* > RegionViewList;
|
2019-04-08 18:27:05 -04:00
|
|
|
RegionViewList region_views;
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2013-04-12 11:31:50 -04:00
|
|
|
double _samples_per_pixel;
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2019-04-08 18:27:05 -04:00
|
|
|
sigc::connection screen_update_connection;
|
|
|
|
std::vector<RecBoxInfo> rec_rects;
|
2009-05-12 13:03:42 -04:00
|
|
|
std::list< std::pair<boost::shared_ptr<ARDOUR::Region>,RegionView* > > rec_regions;
|
2019-04-08 18:27:05 -04:00
|
|
|
bool rec_updating;
|
|
|
|
bool rec_active;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2014-06-09 23:28:32 -04:00
|
|
|
uint32_t 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;
|
2019-04-08 18:27:05 -04:00
|
|
|
samplepos_t last_rec_data_sample;
|
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
|
2017-09-18 12:39:17 -04:00
|
|
|
being recorded, or max_samplepos if not applicable.
|
2010-11-14 10:01:53 -05:00
|
|
|
*/
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t _new_rec_layer_time;
|
2010-11-14 10:01:53 -05:00
|
|
|
void setup_new_rec_layer_time (boost::shared_ptr<ARDOUR::Region>);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2008-12-31 13:44:32 -05:00
|
|
|
private:
|
2019-04-08 15:40:33 -04:00
|
|
|
void update_coverage_frame ();
|
2005-09-25 14:42:24 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __ardour_streamview_h__ */
|
2006-07-23 08:03:19 -04:00
|
|
|
|