13
0

tweaks to GhostRegion to prepare for possible inheritance

This commit is contained in:
Paul Davis 2022-12-27 14:25:03 -07:00
parent ba2f9411e2
commit e54e8f3f4c
2 changed files with 21 additions and 16 deletions

View File

@ -56,23 +56,22 @@ GhostRegion::GhostRegion (RegionView& rv,
TimeAxisView& tv, TimeAxisView& tv,
TimeAxisView& source_tv, TimeAxisView& source_tv,
double initial_pos) double initial_pos)
: parent_rv(rv) : parent_rv (rv)
, trackview(tv) , trackview (tv)
, source_trackview(source_tv) , source_trackview (source_tv)
, base_rect (0)
{ {
group = new ArdourCanvas::Container (parent); group = new ArdourCanvas::Container (parent);
CANVAS_DEBUG_NAME (group, "ghost region"); CANVAS_DEBUG_NAME (group, "ghost region");
group->set_position (ArdourCanvas::Duple (initial_pos, 0)); group->set_position (ArdourCanvas::Duple (initial_pos, 0));
base_rect = new ArdourCanvas::Rectangle (group); if (is_automation_ghost()) {
CANVAS_DEBUG_NAME (base_rect, "ghost region rect"); base_rect = new ArdourCanvas::Rectangle (group);
base_rect->set_x0 (0); CANVAS_DEBUG_NAME (base_rect, "ghost region rect");
base_rect->set_y0 (1.0); base_rect->set_x0 (0);
base_rect->set_y1 (trackview.current_height()); base_rect->set_y0 (1.0);
base_rect->set_outline (false); base_rect->set_y1 (trackview.current_height());
base_rect->set_outline (false);
if (!is_automation_ghost()) {
base_rect->hide();
} }
GhostRegion::set_colors(); GhostRegion::set_colors();
@ -93,13 +92,17 @@ GhostRegion::~GhostRegion ()
void void
GhostRegion::set_duration (double units) GhostRegion::set_duration (double units)
{ {
base_rect->set_x1 (units); if (base_rect) {
base_rect->set_x1 (units);
}
} }
void void
GhostRegion::set_height () GhostRegion::set_height ()
{ {
base_rect->set_y1 (trackview.current_height()); if (base_rect) {
base_rect->set_y1 (trackview.current_height());
}
} }
void void
@ -194,7 +197,9 @@ MidiGhostRegion::MidiGhostRegion(MidiRegionView& rv,
{ {
_outline = UIConfiguration::instance().color ("ghost track midi outline"); _outline = UIConfiguration::instance().color ("ghost track midi outline");
base_rect->lower_to_bottom(); if (base_rect) {
base_rect->lower_to_bottom();
}
} }
MidiGhostRegion::~MidiGhostRegion() MidiGhostRegion::~MidiGhostRegion()

View File

@ -41,7 +41,7 @@ class TimeAxisView;
class RegionView; class RegionView;
class MidiRegionView; class MidiRegionView;
class GhostRegion : public sigc::trackable class GhostRegion : virtual public sigc::trackable
{ {
public: public:
GhostRegion(RegionView& rv, GhostRegion(RegionView& rv,