use TimeThing when constructing RegionViews/TimeAxisViewItem
This commit is contained in:
parent
0537243540
commit
0b2ab07c61
|
@ -69,6 +69,7 @@
|
|||
#include "audio_time_axis.h"
|
||||
#include "rgb_macros.h"
|
||||
#include "gui_thread.h"
|
||||
#include "time_thing.h"
|
||||
#include "ui_config.h"
|
||||
|
||||
#include "pbd/i18n.h"
|
||||
|
@ -111,9 +112,9 @@ static Cairo::RefPtr<Cairo::Pattern> create_pending_peak_pattern() {
|
|||
return p;
|
||||
}
|
||||
|
||||
AudioRegionView::AudioRegionView (ArdourCanvas::Container *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
|
||||
AudioRegionView::AudioRegionView (ArdourCanvas::Container *parent, TimeThing const & tt, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
|
||||
uint32_t basic_color)
|
||||
: RegionView (parent, tv, r, spu, basic_color)
|
||||
: RegionView (parent, tt, tv, r, spu, basic_color)
|
||||
, sync_mark(0)
|
||||
, fade_in_handle(0)
|
||||
, fade_out_handle(0)
|
||||
|
@ -132,9 +133,9 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Container *parent, RouteTimeAxis
|
|||
{
|
||||
}
|
||||
|
||||
AudioRegionView::AudioRegionView (ArdourCanvas::Container *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
|
||||
AudioRegionView::AudioRegionView (ArdourCanvas::Container *parent, TimeThing const & tt, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
|
||||
uint32_t basic_color, bool recording, TimeAxisViewItem::Visibility visibility)
|
||||
: RegionView (parent, tv, r, spu, basic_color, recording, visibility)
|
||||
: RegionView (parent, tt, tv, r, spu, basic_color, recording, visibility)
|
||||
, sync_mark(0)
|
||||
, fade_in_handle(0)
|
||||
, fade_out_handle(0)
|
||||
|
|
|
@ -58,12 +58,14 @@ class AudioRegionView : public RegionView
|
|||
{
|
||||
public:
|
||||
AudioRegionView (ArdourCanvas::Container *,
|
||||
TimeThing const &,
|
||||
RouteTimeAxisView&,
|
||||
boost::shared_ptr<ARDOUR::AudioRegion>,
|
||||
double initial_samples_per_pixel,
|
||||
uint32_t base_color);
|
||||
|
||||
AudioRegionView (ArdourCanvas::Container *,
|
||||
TimeThing const &,
|
||||
RouteTimeAxisView&,
|
||||
boost::shared_ptr<ARDOUR::AudioRegion>,
|
||||
double samples_per_pixel,
|
||||
|
|
|
@ -100,14 +100,14 @@ AudioStreamView::create_region_view (boost::shared_ptr<Region> r, bool wait_for_
|
|||
case NonLayered:
|
||||
case Normal:
|
||||
if (recording) {
|
||||
region_view = new AudioRegionView (_canvas_group, _trackview, region,
|
||||
region_view = new AudioRegionView (_canvas_group, PublicEditor::instance(), _trackview, region,
|
||||
_samples_per_pixel, region_color, recording, TimeAxisViewItem::Visibility(
|
||||
TimeAxisViewItem::ShowFrame |
|
||||
TimeAxisViewItem::HideFrameRight |
|
||||
TimeAxisViewItem::HideFrameLeft |
|
||||
TimeAxisViewItem::HideFrameTB));
|
||||
} else {
|
||||
region_view = new AudioRegionView (_canvas_group, _trackview, region,
|
||||
region_view = new AudioRegionView (_canvas_group, PublicEditor::instance(), _trackview, region,
|
||||
_samples_per_pixel, region_color);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -47,13 +47,14 @@
|
|||
using namespace Temporal;
|
||||
|
||||
AutomationRegionView::AutomationRegionView (ArdourCanvas::Container* parent,
|
||||
TimeThing const & tt,
|
||||
AutomationTimeAxisView& time_axis,
|
||||
boost::shared_ptr<ARDOUR::Region> region,
|
||||
const Evoral::Parameter& param,
|
||||
boost::shared_ptr<ARDOUR::AutomationList> list,
|
||||
double spu,
|
||||
uint32_t basic_color)
|
||||
: RegionView(parent, time_axis, region, spu, basic_color, true)
|
||||
: RegionView(parent, tt, time_axis, region, spu, basic_color, true)
|
||||
, _parameter(param)
|
||||
{
|
||||
TimeAxisViewItem::set_position (_region->position(), this);
|
||||
|
|
|
@ -34,11 +34,13 @@ namespace ARDOUR {
|
|||
};
|
||||
|
||||
class TimeAxisView;
|
||||
class TimeThing;
|
||||
|
||||
class AutomationRegionView : public RegionView
|
||||
{
|
||||
public:
|
||||
AutomationRegionView(ArdourCanvas::Container*,
|
||||
TimeThing const &,
|
||||
AutomationTimeAxisView&,
|
||||
boost::shared_ptr<ARDOUR::Region>,
|
||||
const Evoral::Parameter& parameter,
|
||||
|
|
|
@ -121,7 +121,7 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region
|
|||
}
|
||||
|
||||
region_view = new AutomationRegionView (
|
||||
_canvas_group, _automation_view, region,
|
||||
_canvas_group, PublicEditor::instance(), _automation_view, region,
|
||||
_automation_view.parameter (), list,
|
||||
_samples_per_pixel, region_color
|
||||
);
|
||||
|
|
|
@ -90,6 +90,7 @@
|
|||
#include "hit.h"
|
||||
#include "patch_change.h"
|
||||
#include "sys_ex.h"
|
||||
#include "time_thing.h"
|
||||
#include "ui_config.h"
|
||||
|
||||
#include "pbd/i18n.h"
|
||||
|
@ -104,11 +105,12 @@ using Gtkmm2ext::Keyboard;
|
|||
#define MIDI_BP_ZERO ((Config->get_first_midi_bank_is_zero())?0:1)
|
||||
|
||||
MidiRegionView::MidiRegionView (ArdourCanvas::Container* parent,
|
||||
TimeThing const & tt,
|
||||
RouteTimeAxisView& tv,
|
||||
boost::shared_ptr<MidiRegion> r,
|
||||
double spu,
|
||||
uint32_t basic_color)
|
||||
: RegionView (parent, tv, r, spu, basic_color)
|
||||
: RegionView (parent, tt, tv, r, spu, basic_color)
|
||||
, _current_range_min(0)
|
||||
, _current_range_max(0)
|
||||
, _active_notes(0)
|
||||
|
@ -144,13 +146,14 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Container* parent,
|
|||
}
|
||||
|
||||
MidiRegionView::MidiRegionView (ArdourCanvas::Container* parent,
|
||||
TimeThing const & tt,
|
||||
RouteTimeAxisView& tv,
|
||||
boost::shared_ptr<MidiRegion> r,
|
||||
double spu,
|
||||
uint32_t basic_color,
|
||||
bool recording,
|
||||
TimeAxisViewItem::Visibility visibility)
|
||||
: RegionView (parent, tv, r, spu, basic_color, recording, visibility)
|
||||
: RegionView (parent, tt, tv, r, spu, basic_color, recording, visibility)
|
||||
, _current_range_min(0)
|
||||
, _current_range_max(0)
|
||||
, _active_notes(0)
|
||||
|
|
|
@ -75,12 +75,14 @@ public:
|
|||
typedef Evoral::Sequence<Temporal::Beats>::Notes Notes;
|
||||
|
||||
MidiRegionView (ArdourCanvas::Container* parent,
|
||||
TimeThing const & tt,
|
||||
RouteTimeAxisView& tv,
|
||||
boost::shared_ptr<ARDOUR::MidiRegion> r,
|
||||
double samples_per_pixel,
|
||||
uint32_t basic_color);
|
||||
|
||||
MidiRegionView (ArdourCanvas::Container* parent,
|
||||
TimeThing const & tt,
|
||||
RouteTimeAxisView& tv,
|
||||
boost::shared_ptr<ARDOUR::MidiRegion> r,
|
||||
double samples_per_pixel,
|
||||
|
|
|
@ -117,11 +117,11 @@ MidiStreamView::create_region_view (boost::shared_ptr<Region> r, bool /*wfd*/, b
|
|||
RegionView* region_view = NULL;
|
||||
if (recording) {
|
||||
region_view = new MidiRegionView (
|
||||
_canvas_group, _trackview, region,
|
||||
_canvas_group, PublicEditor::instance(), _trackview, region,
|
||||
_samples_per_pixel, region_color, recording,
|
||||
TimeAxisViewItem::Visibility(TimeAxisViewItem::ShowFrame));
|
||||
} else {
|
||||
region_view = new MidiRegionView (_canvas_group, _trackview, region,
|
||||
region_view = new MidiRegionView (_canvas_group, PublicEditor::instance(), _trackview, region,
|
||||
_samples_per_pixel, region_color);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,12 +74,13 @@ static const int32_t sync_mark_width = 9;
|
|||
PBD::Signal1<void,RegionView*> RegionView::RegionViewGoingAway;
|
||||
|
||||
RegionView::RegionView (ArdourCanvas::Container* parent,
|
||||
TimeThing const & tt,
|
||||
TimeAxisView& tv,
|
||||
boost::shared_ptr<ARDOUR::Region> r,
|
||||
double spu,
|
||||
uint32_t basic_color,
|
||||
bool automation)
|
||||
: TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->position(), r->length(), false, automation,
|
||||
: TimeAxisViewItem (r->name(), *parent, tt, tv, spu, basic_color, r->position(), r->length(), false, automation,
|
||||
(automation ? TimeAxisViewItem::ShowFrame :
|
||||
TimeAxisViewItem::Visibility ((UIConfiguration::instance().get_show_region_name() ? TimeAxisViewItem::ShowNameText : 0) |
|
||||
TimeAxisViewItem::ShowNameHighlight| TimeAxisViewItem::ShowFrame)))
|
||||
|
@ -153,13 +154,14 @@ RegionView::RegionView (const RegionView& other, boost::shared_ptr<Region> other
|
|||
|
||||
|
||||
RegionView::RegionView (ArdourCanvas::Container* parent,
|
||||
TimeThing const & tt,
|
||||
TimeAxisView& tv,
|
||||
boost::shared_ptr<ARDOUR::Region> r,
|
||||
double spu,
|
||||
uint32_t basic_color,
|
||||
bool recording,
|
||||
TimeAxisViewItem::Visibility visibility)
|
||||
: TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->position(), r->length(), recording, false, visibility)
|
||||
: TimeAxisViewItem (r->name(), *parent, tt, tv, spu, basic_color, r->position(), r->length(), recording, false, visibility)
|
||||
, _region (r)
|
||||
, sync_mark(0)
|
||||
, sync_line(0)
|
||||
|
@ -310,8 +312,8 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
|
|||
|
||||
/* coordinates for the rect are relative to the regionview origin */
|
||||
|
||||
cr->set_x0 (trackview.editor().sample_to_pixel (i->first - _region->start_sample()));
|
||||
cr->set_x1 (trackview.editor().sample_to_pixel (i->second - _region->start_sample()));
|
||||
cr->set_x0 (time_thing.sample_to_pixel (i->first - _region->start_sample()));
|
||||
cr->set_x1 (time_thing.sample_to_pixel (i->second - _region->start_sample()));
|
||||
cr->set_y0 (1);
|
||||
cr->set_y1 (_height - 2);
|
||||
cr->set_outline (false);
|
||||
|
@ -345,7 +347,7 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
|
|||
|
||||
/* both positions are relative to the region start offset in source */
|
||||
|
||||
_silence_text->set_x_position (trackview.editor().sample_to_pixel (silences.front().first - _region->start_sample()) + 10.0);
|
||||
_silence_text->set_x_position (time_thing.sample_to_pixel (silences.front().first - _region->start_sample()) + 10.0);
|
||||
_silence_text->set_y_position (20.0);
|
||||
|
||||
double ms = (float) shortest/_region->session().sample_rate();
|
||||
|
@ -505,7 +507,7 @@ RegionView::reset_width_dependent_items (double pixel_width)
|
|||
if (_xrun_markers_visible) {
|
||||
const samplepos_t start = _region->start_sample();
|
||||
for (list<std::pair<samplepos_t, ArdourCanvas::Arrow*> >::iterator i = _xrun_markers.begin(); i != _xrun_markers.end(); ++i) {
|
||||
float x_pos = trackview.editor().sample_to_pixel (i->first - start);
|
||||
float x_pos = time_thing.sample_to_pixel (i->first - start);
|
||||
i->second->set_x (x_pos);
|
||||
}
|
||||
}
|
||||
|
@ -522,7 +524,7 @@ RegionView::update_xrun_markers ()
|
|||
const samplepos_t start = _region->start_sample();
|
||||
const samplepos_t length = _region->length_samples();
|
||||
for (list<std::pair<samplepos_t, ArdourCanvas::Arrow*> >::iterator i = _xrun_markers.begin(); i != _xrun_markers.end(); ++i) {
|
||||
float x_pos = trackview.editor().sample_to_pixel (i->first - start);
|
||||
float x_pos = time_thing.sample_to_pixel (i->first - start);
|
||||
i->second->set_x (x_pos);
|
||||
if (show_xruns_markers && (i->first >= start && i->first < start + length)) {
|
||||
i->second->show ();
|
||||
|
@ -881,7 +883,7 @@ RegionView::region_sync_changed ()
|
|||
|
||||
//points = sync_mark->property_points().get_value();
|
||||
|
||||
double offset = trackview.editor().duration_to_pixels (sync_offset);
|
||||
double offset = time_thing.duration_to_pixels (sync_offset);
|
||||
points.push_back (ArdourCanvas::Duple (offset - ((sync_mark_width-1)/2), 1));
|
||||
points.push_back (ArdourCanvas::Duple (offset + ((sync_mark_width-1)/2), 1));
|
||||
points.push_back (ArdourCanvas::Duple (offset, sync_mark_width - 1));
|
||||
|
@ -958,7 +960,7 @@ RegionView::set_height (double h)
|
|||
int sync_dir;
|
||||
timecnt_t sync_offset;
|
||||
sync_offset = _region->sync_offset (sync_dir);
|
||||
double offset = trackview.editor().duration_to_pixels (sync_offset);
|
||||
double offset = time_thing.duration_to_pixels (sync_offset);
|
||||
|
||||
sync_line->set (
|
||||
ArdourCanvas::Duple (offset, 0),
|
||||
|
@ -1020,14 +1022,14 @@ RegionView::update_coverage_frame (LayerDisplay d)
|
|||
bool const new_me = (pl->top_unmuted_region_at (t) == _region);
|
||||
/* finish off any old rect, if required */
|
||||
if (cr && me != new_me) {
|
||||
cr->set_x1 (trackview.editor().duration_to_pixels (position.distance (t)));
|
||||
cr->set_x1 (time_thing.duration_to_pixels (position.distance (t)));
|
||||
}
|
||||
|
||||
/* start off any new rect, if required */
|
||||
if (cr == 0 || me != new_me) {
|
||||
cr = new ArdourCanvas::Rectangle (group);
|
||||
_coverage_frame.push_back (cr);
|
||||
cr->set_x0 (trackview.editor().duration_to_pixels (position.distance (t)));
|
||||
cr->set_x0 (time_thing.duration_to_pixels (position.distance (t)));
|
||||
cr->set_y0 (1);
|
||||
cr->set_y1 (_height + 1);
|
||||
cr->set_outline (false);
|
||||
|
@ -1049,7 +1051,7 @@ RegionView::update_coverage_frame (LayerDisplay d)
|
|||
|
||||
if (cr) {
|
||||
/* finish off the last rectangle */
|
||||
cr->set_x1 (trackview.editor().duration_to_pixels (position.distance (end)));
|
||||
cr->set_x1 (time_thing.duration_to_pixels (position.distance (end)));
|
||||
}
|
||||
|
||||
if (frame_handle_start) {
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "marker.h"
|
||||
|
||||
class TimeAxisView;
|
||||
class TimeThing;
|
||||
class RegionEditor;
|
||||
class GhostRegion;
|
||||
class AutomationTimeAxisView;
|
||||
|
@ -55,6 +56,7 @@ class RegionView : public TimeAxisViewItem
|
|||
{
|
||||
public:
|
||||
RegionView (ArdourCanvas::Container* parent,
|
||||
TimeThing const & time_thing,
|
||||
TimeAxisView& time_view,
|
||||
boost::shared_ptr<ARDOUR::Region> region,
|
||||
double samples_per_pixel,
|
||||
|
@ -141,6 +143,7 @@ protected:
|
|||
* to the TimeAxisViewItem parent class
|
||||
*/
|
||||
RegionView (ArdourCanvas::Container *,
|
||||
TimeThing const &,
|
||||
TimeAxisView&,
|
||||
boost::shared_ptr<ARDOUR::Region>,
|
||||
double samples_per_pixel,
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "ui_config.h"
|
||||
#include "utils.h"
|
||||
#include "rgb_macros.h"
|
||||
#include "time_thing.h"
|
||||
|
||||
#include "pbd/i18n.h"
|
||||
|
||||
|
@ -120,10 +121,11 @@ TimeAxisViewItem::set_constant_heights ()
|
|||
* @param automation true if this is an automation region view
|
||||
*/
|
||||
TimeAxisViewItem::TimeAxisViewItem(
|
||||
const string & it_name, ArdourCanvas::Item& parent, TimeAxisView& tv, double spu, uint32_t base_color,
|
||||
const string & it_name, ArdourCanvas::Item& parent, TimeThing const & tt, TimeAxisView& tv, double spu, uint32_t base_color,
|
||||
timepos_t const & start, timecnt_t const & duration, bool recording, bool automation, Visibility vis
|
||||
)
|
||||
: trackview (tv)
|
||||
, time_thing (tt)
|
||||
, item_name (it_name)
|
||||
, selection_frame (0)
|
||||
, _height (1.0)
|
||||
|
@ -140,6 +142,7 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
|
|||
, Selectable (other)
|
||||
, PBD::ScopedConnectionList()
|
||||
, trackview (other.trackview)
|
||||
, time_thing (other.time_thing)
|
||||
, item_name (other.item_name)
|
||||
, selection_frame (0)
|
||||
, _height (1.0)
|
||||
|
@ -189,7 +192,7 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co
|
|||
if (visibility & ShowFrame) {
|
||||
frame = new ArdourCanvas::Rectangle (group,
|
||||
ArdourCanvas::Rect (0.0, 0.0,
|
||||
trackview.editor().duration_to_pixels (duration),
|
||||
time_thing.duration_to_pixels (duration),
|
||||
trackview.current_height()));
|
||||
|
||||
frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT));
|
||||
|
@ -289,7 +292,7 @@ TimeAxisViewItem::set_position(timepos_t const & pos, void* src, double* delta)
|
|||
|
||||
time_position = pos;
|
||||
|
||||
double new_unit_pos = trackview.editor().time_to_pixel (time_position);
|
||||
double new_unit_pos = time_thing.time_to_pixel (time_position);
|
||||
|
||||
if (delta) {
|
||||
(*delta) = new_unit_pos - group->position().x;
|
||||
|
@ -342,8 +345,8 @@ TimeAxisViewItem::set_duration (timecnt_t const & dur, void* src)
|
|||
|
||||
item_duration = dur;
|
||||
|
||||
double end_pixel = trackview.editor().time_to_pixel (time_position + dur);
|
||||
double first_pixel = trackview.editor().time_to_pixel (time_position);
|
||||
double end_pixel = time_thing.time_to_pixel (time_position + dur);
|
||||
double first_pixel = time_thing.time_to_pixel (time_position);
|
||||
|
||||
reset_width_dependent_items (end_pixel - first_pixel);
|
||||
|
||||
|
@ -806,8 +809,8 @@ TimeAxisViewItem::set_samples_per_pixel (double fpp)
|
|||
samples_per_pixel = fpp;
|
||||
set_position (this->get_position(), this);
|
||||
|
||||
double end_pixel = trackview.editor().time_to_pixel (time_position + get_duration());
|
||||
double first_pixel = trackview.editor().time_to_pixel (time_position);
|
||||
double end_pixel = time_thing.time_to_pixel (time_position + get_duration());
|
||||
double first_pixel = time_thing.time_to_pixel (time_position);
|
||||
|
||||
reset_width_dependent_items (end_pixel - first_pixel);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "selectable.h"
|
||||
|
||||
class TimeAxisView;
|
||||
class TimeThing;
|
||||
|
||||
namespace ArdourCanvas {
|
||||
class Pixbuf;
|
||||
|
@ -160,7 +161,7 @@ public:
|
|||
virtual void update_visibility () {}
|
||||
|
||||
protected:
|
||||
TimeAxisViewItem (const std::string &, ArdourCanvas::Item&, TimeAxisView&, double, uint32_t fill_color,
|
||||
TimeAxisViewItem (const std::string &, ArdourCanvas::Item&, TimeThing const &, TimeAxisView&, double, uint32_t fill_color,
|
||||
Temporal::timepos_t const &, Temporal::timecnt_t const &, bool recording = false, bool automation = false, Visibility v = Visibility (0));
|
||||
|
||||
TimeAxisViewItem (const TimeAxisViewItem&);
|
||||
|
@ -182,6 +183,9 @@ protected:
|
|||
/** time axis that this item is on */
|
||||
TimeAxisView& trackview;
|
||||
|
||||
/** TimeThing used to provide pixel<->time conversions */
|
||||
TimeThing const & time_thing;
|
||||
|
||||
/** indicates whether this item is locked to its current position */
|
||||
bool position_locked;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#define __gtk2_ardour_time_thing_h__
|
||||
|
||||
struct TimeThing {
|
||||
virtual ~TimeThing() {}
|
||||
virtual samplepos_t pixel_to_sample (double pixel) const = 0;
|
||||
virtual samplepos_t playhead_cursor_sample () const = 0;
|
||||
virtual double sample_to_pixel (samplepos_t sample) const = 0;
|
||||
|
|
Loading…
Reference in New Issue