a couple of extra tooltips for editor preferences
[ardour.git] / gtk2_ardour / audio_region_view.cc
index a5688b9fc1872807914ccf142b476ad5a526f1a7..7e51d28997b3f15b6d515261853af47c739884e4 100644 (file)
@@ -20,6 +20,7 @@
 #include <cassert>
 #include <algorithm>
 
+#include <boost/scoped_array.hpp>
 #include <boost/scoped_ptr.hpp>
 
 #include <gtkmm.h>
@@ -66,6 +67,7 @@ using namespace Editing;
 using namespace ArdourCanvas;
 
 static const int32_t sync_mark_width = 9;
+static double const handle_size = 6; /* height of fade handles */
 
 AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
                                  Gdk::Color const & basic_color)
@@ -167,13 +169,13 @@ AudioRegionView::init (Gdk::Color const & basic_color, bool wfd)
        if (!_recregion) {
                fade_in_handle = new ArdourCanvas::SimpleRect (*group);
                fade_in_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fill_color, 0);
-               fade_in_handle->property_outline_pixels() = 0;
+               fade_in_handle->property_outline_color_rgba() = RGBA_TO_UINT (0, 0, 0, 0);
 
                fade_in_handle->set_data ("regionview", this);
 
                fade_out_handle = new ArdourCanvas::SimpleRect (*group);
                fade_out_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fill_color, 0);
-               fade_out_handle->property_outline_pixels() = 0;
+               fade_out_handle->property_outline_color_rgba() = RGBA_TO_UINT (0, 0, 0, 0);
 
                fade_out_handle->set_data ("regionview", this);
 
@@ -266,7 +268,6 @@ void
 AudioRegionView::region_changed (const PropertyChange& what_changed)
 {
        ENSURE_GUI_THREAD (*this, &AudioRegionView::region_changed, what_changed);
-       // cerr << "AudioRegionView::region_changed() called" << endl;
 
        RegionView::region_changed (what_changed);
 
@@ -285,6 +286,12 @@ AudioRegionView::region_changed (const PropertyChange& what_changed)
        if (what_changed.contains (ARDOUR::Properties::fade_out_active)) {
                fade_out_active_changed ();
        }
+       if (what_changed.contains (ARDOUR::Properties::fade_in_is_xfade)) {
+               fade_in_changed ();
+       }
+       if (what_changed.contains (ARDOUR::Properties::fade_out_is_xfade)) {
+               fade_out_changed ();
+       }
        if (what_changed.contains (ARDOUR::Properties::envelope_active)) {
                envelope_active_changed ();
        }
@@ -454,17 +461,15 @@ AudioRegionView::setup_fade_handle_positions()
 {
        /* position of fade handle offset from the top of the region view */
        double const handle_pos = 2;
-       /* height of fade handles */
-       double const handle_height = 5;
 
        if (fade_in_handle) {
                fade_in_handle->property_y1() = handle_pos;
-               fade_in_handle->property_y2() = handle_pos + handle_height;
+               fade_in_handle->property_y2() = handle_pos + handle_size;
        }
 
        if (fade_out_handle) {
                fade_out_handle->property_y1() = handle_pos;
-               fade_out_handle->property_y2() = handle_pos + handle_height;
+               fade_out_handle->property_y2() = handle_pos + handle_size;
        }
 }
 
@@ -596,7 +601,7 @@ AudioRegionView::reset_fade_in_shape_width (framecnt_t width)
 
        /* Put the fade in handle so that its left side is at the end-of-fade line */
        fade_in_handle->property_x1() = handle_center;
-       fade_in_handle->property_x2() = handle_center + 6;
+       fade_in_handle->property_x2() = handle_center + handle_size;
 
        if (pwidth < 5) {
                fade_in_shape->hide();
@@ -763,6 +768,19 @@ AudioRegionView::reset_fade_out_shape_width (framecnt_t width)
        }
 }
 
+framepos_t
+AudioRegionView::get_fade_in_shape_width ()
+{
+       return audio_region()->fade_in()->back()->when;
+}
+
+framepos_t
+AudioRegionView::get_fade_out_shape_width ()
+{
+       return audio_region()->fade_out()->back()->when;
+}
+
+
 void
 AudioRegionView::set_samples_per_unit (gdouble spu)
 {
@@ -1148,7 +1166,9 @@ AudioRegionView::entered (bool internal_editing)
        }
 
        if (fade_in_handle && !internal_editing) {
+               fade_in_handle->property_outline_color_rgba() = RGBA_TO_UINT (0, 0, 0, 255);
                fade_in_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 255);
+               fade_out_handle->property_outline_color_rgba() = RGBA_TO_UINT (0, 0, 0, 255);
                fade_out_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 255);
        }
 }
@@ -1164,7 +1184,9 @@ AudioRegionView::exited ()
        }
 
        if (fade_in_handle) {
+               fade_in_handle->property_outline_color_rgba() = RGBA_TO_UINT (0, 0, 0, 0);
                fade_in_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 0);
+               fade_out_handle->property_outline_color_rgba() = RGBA_TO_UINT (0, 0, 0, 0);
                fade_out_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 0);
        }
 }
@@ -1504,7 +1526,7 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
        }
 
        Points* points = get_canvas_points ("xfade edit redraw", npoints);
-       boost::scoped_ptr<float> vec (new float[npoints]);
+       boost::scoped_array<float> vec (new float[npoints]);
        double effective_height = _height - NAME_HIGHLIGHT_SIZE - 1.0;
 
        ar->fade_in()->curve().get_vector (0, ar->fade_in()->back()->when, vec.get(), npoints);