Revert my rev. 7140 and fix it better.
authorCarl Hetherington <carl@carlh.net>
Sun, 23 May 2010 02:42:37 +0000 (02:42 +0000)
committerCarl Hetherington <carl@carlh.net>
Sun, 23 May 2010 02:42:37 +0000 (02:42 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7145 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/audio_streamview.cc
gtk2_ardour/automation_streamview.cc
gtk2_ardour/midi_streamview.cc
gtk2_ardour/streamview.cc
gtk2_ardour/streamview.h

index 7c76cd787655d57832952a79a1dc86dbb5058dc5..65efd9654c39cce1199bcda758c37e973f7429dc 100644 (file)
@@ -119,16 +119,16 @@ 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, _trackview, region,
                                        _samples_per_unit, region_color, recording, TimeAxisViewItem::Visibility(
                                                        TimeAxisViewItem::ShowFrame | TimeAxisViewItem::HideFrameRight));
                } else {
-                       region_view = new AudioRegionView (canvas_group, _trackview, region,
+                       region_view = new AudioRegionView (_canvas_group, _trackview, region,
                                        _samples_per_unit, region_color);
                }
                break;
        case Destructive:
-               region_view = new TapeAudioRegionView (canvas_group, _trackview, region,
+               region_view = new TapeAudioRegionView (_canvas_group, _trackview, region,
                                _samples_per_unit, region_color);
                break;
        default:
@@ -516,7 +516,7 @@ AudioStreamView::setup_rec_box ()
                                break;
                        }
 
-                       ArdourCanvas::SimpleRect * rec_rect = new Gnome::Canvas::SimpleRect (*canvas_group);
+                       ArdourCanvas::SimpleRect * rec_rect = new Gnome::Canvas::SimpleRect (*_canvas_group);
                        rec_rect->property_x1() = xstart;
                        rec_rect->property_y1() = 1.0;
                        rec_rect->property_x2() = xend;
index 4177e729fe139750cdc8f65f94ef0d70931287e8..60c2e440766b87fc51dad7b454c17c05072ac4eb 100644 (file)
@@ -110,7 +110,7 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region
                }
        }
 
-       region_view = new AutomationRegionView (canvas_group, _automation_view, region,
+       region_view = new AutomationRegionView (_canvas_group, _automation_view, region,
                        _controller->controllable()->parameter(), list,
                        _samples_per_unit, region_color);
 
index 6fe2f01a902a23fdd84f034c07c7da8e172eacac..826538dc50ae9c70e650e1f0fc0caf2c6e0524da 100644 (file)
@@ -71,12 +71,12 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv)
        }
 
        /* use a group dedicated to MIDI underlays. Audio underlays are not in this group. */
-       midi_underlay_group = new ArdourCanvas::Group (*canvas_group);
+       midi_underlay_group = new ArdourCanvas::Group (*_canvas_group);
        midi_underlay_group->lower_to_bottom();
 
        /* put the note lines in the timeaxisview's group, so it
           can be put below ghost regions from MIDI underlays*/
-       _note_lines = new ArdourCanvas::LineSet(*canvas_group, ArdourCanvas::LineSet::Horizontal);
+       _note_lines = new ArdourCanvas::LineSet(*_canvas_group, ArdourCanvas::LineSet::Horizontal);
 
        _note_lines->property_x1() = 0;
        _note_lines->property_y1() = 0;
@@ -137,7 +137,7 @@ MidiStreamView::create_region_view (boost::shared_ptr<Region> r, bool /*wfd*/, b
                return 0;
        }
 
-       RegionView* region_view = new MidiRegionView (canvas_group, _trackview, region,
+       RegionView* region_view = new MidiRegionView (_canvas_group, _trackview, region,
                                                      _samples_per_unit, region_color);
 
        region_view->init (region_color, false);
@@ -444,7 +444,7 @@ MidiStreamView::setup_rec_box ()
                        xend = xstart;
                        fill_color = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
 
-                       ArdourCanvas::SimpleRect * rec_rect = new Gnome::Canvas::SimpleRect (*canvas_group);
+                       ArdourCanvas::SimpleRect * rec_rect = new Gnome::Canvas::SimpleRect (*_canvas_group);
                        rec_rect->property_x1() = xstart;
                        rec_rect->property_y1() = 1.0;
                        rec_rect->property_x2() = xend;
index 048a3d23db0928747051dead2b250d7d9e2a997b..eadaa29af8a345400318638964a5b7d7695ccd08 100644 (file)
@@ -46,11 +46,12 @@ using namespace ARDOUR;
 using namespace PBD;
 using namespace Editing;
 
-StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* group)
+StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* background_group, ArdourCanvas::Group* canvas_group)
        : _trackview (tv)
-       , owns_canvas_group(group == 0)
-       , _background_group (new ArdourCanvas::Group (*_trackview.canvas_background()))
-       , canvas_group(group ? group : new ArdourCanvas::Group(*_trackview.canvas_display()))
+       , owns_background_group (background_group == 0)
+       , owns_canvas_group (canvas_group == 0)
+       , _background_group (background_group ? background_group : new ArdourCanvas::Group (*_trackview.canvas_background()))
+       , _canvas_group (canvas_group ? canvas_group : new ArdourCanvas::Group(*_trackview.canvas_display()))
        , _samples_per_unit (_trackview.editor().get_current_zoom ())
        , rec_updating(false)
        , rec_active(false)
@@ -63,7 +64,7 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* group)
 {
        /* set_position() will position the group */
 
-       canvas_rect = new ArdourCanvas::SimpleRect (*canvas_group);
+       canvas_rect = new ArdourCanvas::SimpleRect (*_background_group);
        canvas_rect->property_x1() = 0.0;
        canvas_rect->property_y1() = 0.0;
        canvas_rect->property_x2() = _trackview.editor().get_physical_screen_width ();
@@ -94,8 +95,12 @@ StreamView::~StreamView ()
 
        delete canvas_rect;
 
+       if (owns_background_group) {
+               delete _background_group;
+       }
+       
        if (owns_canvas_group) {
-               delete canvas_group;
+               delete _canvas_group;
        }
 }
 
@@ -110,8 +115,8 @@ StreamView::attach ()
 int
 StreamView::set_position (gdouble x, gdouble y)
 {
-       canvas_group->property_x() = x;
-       canvas_group->property_y() = y;
+       _canvas_group->property_x() = x;
+       _canvas_group->property_y() = y;
        return 0;
 }
 
index 14b30a42fcb99f9875c7f96e521d60c5f3fdba2d..0bf770837fd7f8f3a6b22abb2bbb20e8893fa1c7 100644 (file)
@@ -77,7 +77,7 @@ public:
        LayerDisplay layer_display () const { return _layer_display; }
 
        ArdourCanvas::Group* background_group() { return _background_group; }
-       ArdourCanvas::Group* canvas_item() { return canvas_group; }
+       ArdourCanvas::Group* canvas_item() { return _canvas_group; }
 
        enum ColorTarget {
                RegionColor,
@@ -116,7 +116,7 @@ public:
        sigc::signal<void> HeightChanged;
 
 protected:
-       StreamView (RouteTimeAxisView&, ArdourCanvas::Group* group = NULL);
+       StreamView (RouteTimeAxisView&, ArdourCanvas::Group* background_group = 0, ArdourCanvas::Group* canvas_group = 0);
 
        void         transport_changed();
        void         transport_looped();
@@ -140,9 +140,10 @@ protected:
        virtual void color_handler () = 0;
 
        RouteTimeAxisView&        _trackview;
+       bool                      owns_background_group;
        bool                      owns_canvas_group;
        ArdourCanvas::Group*      _background_group;
-       ArdourCanvas::Group*      canvas_group;
+       ArdourCanvas::Group*      _canvas_group;
        ArdourCanvas::SimpleRect* canvas_rect; /* frame around the whole thing */
 
        typedef std::list<RegionView* > RegionViewList;