Merge branch 'waveview_caching_for_upstream' of https://github.com/nmains/ardour...
[ardour.git] / gtk2_ardour / audio_region_view.cc
index 5cbc24eb82c589b85a7f323bd7084233d0d91b6b..966b77af877ae07d5740c51871846725f8aa2233 100644 (file)
@@ -604,12 +604,10 @@ AudioRegionView::reset_fade_in_shape_width (boost::shared_ptr<AudioRegion> ar, f
        /* points *MUST* be in anti-clockwise order */
 
        Points points;
-       Points::size_type npoints;
        Points::size_type pi;
        boost::shared_ptr<const Evoral::ControlList> list (audio_region()->fade_in());
        Evoral::ControlList::const_iterator x;
        double length = list->length();
-       npoints = list->size();
 
        points.assign (list->size(), Duple());
 
@@ -1166,6 +1164,7 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
        wave->set_height (ht);
        wave->set_samples_per_pixel (samples_per_pixel);
        wave->set_show_zero_line (true);
+       wave->set_clip_level (Config->get_waveform_clip_level ());
        
        switch (Config->get_waveform_shape()) {
        case Rectified:
@@ -1410,18 +1409,12 @@ AudioRegionView::color_handler ()
 
 void
 AudioRegionView::set_waveform_colors ()
-{
-        for (vector<ArdourCanvas::WaveView*>::iterator w = waves.begin(); w != waves.end(); ++w) {
-               set_one_waveform_color (*w);
-       }
-}
-
-void
-AudioRegionView::set_one_waveform_color (ArdourCanvas::WaveView* wave)
 {
        ArdourCanvas::Color fill;
        ArdourCanvas::Color outline;
-       
+       ArdourCanvas::Color clip = ARDOUR_UI::config()->get_canvasvar_WaveFormClip();
+       ArdourCanvas::Color zero = ARDOUR_UI::config()->get_canvasvar_ZeroLine();
+
        if (_selected) {
                if (_region->muted()) {
                        /* hide outline with zero alpha */
@@ -1430,6 +1423,13 @@ AudioRegionView::set_one_waveform_color (ArdourCanvas::WaveView* wave)
                } else {
                        outline = ARDOUR_UI::config()->get_canvasvar_SelectedWaveForm();
                        fill = ARDOUR_UI::config()->get_canvasvar_SelectedWaveFormFill();
+
+                       if (ARDOUR_UI::config()->get_color_regions_using_track_color()) {
+                               /* just use a slightly transparent version of the selected
+                                * color so that some of the track color bleeds through
+                                */
+                               fill = UINT_RGBA_CHANGE_A (fill, 217);
+                       }
                }
        } else {
                if (_recregion) {
@@ -1443,32 +1443,23 @@ AudioRegionView::set_one_waveform_color (ArdourCanvas::WaveView* wave)
                        } else {
                                outline = ARDOUR_UI::config()->get_canvasvar_WaveForm();
                                fill = ARDOUR_UI::config()->get_canvasvar_WaveFormFill();
+
+                               if (ARDOUR_UI::config()->get_color_regions_using_track_color()) {
+                                       /* just use a slightly transparent version of the selected
+                                        * color so that some of the track color bleeds through
+                                        */
+                                       fill = UINT_RGBA_CHANGE_A (fill, 217);
+                               }
                        }
                }
        }
 
-       if (ARDOUR_UI::config()->get_color_regions_using_track_color()) {
-
-               /* just use a slightly transparent version of the selected
-                * color so that some of the track color bleeds through
-                */
-
-               double r, g, b, a;
-               ArdourCanvas::color_to_rgba (fill, r, g, b, a);
-               fill = ArdourCanvas::rgba_to_color (r, g, b, 0.85); /* magic number, not user controllable */
-               outline = ARDOUR_UI::config()->get_canvasvar_WaveForm();
-
-               if (!Config->get_show_name_highlight()) {
-                       /* recolor name text because it needs to contrast with
-                          the waveform background, not the name highlight.
-                       */
-               }
+        for (vector<ArdourCanvas::WaveView*>::iterator w = waves.begin(); w != waves.end(); ++w) {
+               (*w)->set_fill_color (fill);
+               (*w)->set_outline_color (outline);
+               (*w)->set_clip_color (clip);
+               (*w)->set_zero_color (zero);
        }
-
-       wave->set_fill_color (fill);
-       wave->set_outline_color (outline);
-       wave->set_clip_color (ARDOUR_UI::config()->get_canvasvar_WaveFormClip());
-       wave->set_zero_color (ARDOUR_UI::config()->get_canvasvar_ZeroLine());
 }
 
 void
@@ -1478,13 +1469,7 @@ AudioRegionView::set_frame_color ()
                return;
        }
 
-       if (_region->opaque()) {
-               fill_opacity = 130;
-       } else {
-               fill_opacity = 0;
-       }
-
-       TimeAxisViewItem::set_frame_color ();
+       RegionView::set_frame_color ();
 
        set_waveform_colors ();
 }