Import Dialog is Window. Dialog Esc behavior needs to be emulated.
[ardour.git] / gtk2_ardour / automation_line.cc
index cf7e10dd8a49efc202e065217bcdc813bc3bd81d..98b87ee6e6c28d38858637d4d3665d1e26adab3c 100644 (file)
@@ -63,7 +63,7 @@
 #include "ardour/session.h"
 #include "ardour/value_as_string.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
@@ -86,6 +86,7 @@ AutomationLine::AutomationLine (const string&                              name,
        , _parent_group (parent)
        , _offset (0)
        , _maximum_time (max_framepos)
+       , _fill (false)
        , _desc (desc)
 {
        if (converter) {
@@ -171,7 +172,7 @@ AutomationLine::update_visibility ()
                        }
                } else if (_visible & SelectedControlPoints) {
                        for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
-                               if ((*i)->get_selected()) {
+                               if ((*i)->selected()) {
                                        (*i)->show ();
                                } else {
                                        (*i)->hide ();
@@ -229,6 +230,11 @@ AutomationLine::set_height (guint32 h)
                        (*i)->set_size (bsz);
                }
 
+               if (_fill) {
+                       line->set_fill_y1 (_height);
+               } else {
+                       line->set_fill_y1 (0);
+               }
                reset ();
        }
 }
@@ -238,6 +244,10 @@ AutomationLine::set_line_color (uint32_t color)
 {
        _line_color = color;
        line->set_outline_color (color);
+
+       ArdourCanvas::SVAModifier mod = UIConfiguration::instance().modifier ("automation line fill");
+
+       line->set_fill_color ((color & 0xffffff00) + mod.a()*255);
 }
 
 void
@@ -470,9 +480,9 @@ AutomationLine::start_drag_single (ControlPoint* cp, double x, float fraction)
        _drag_points.clear ();
        _drag_points.push_back (cp);
 
-       if (cp->get_selected ()) {
+       if (cp->selected ()) {
                for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
-                       if (*i != cp && (*i)->get_selected()) {
+                       if (*i != cp && (*i)->selected()) {
                                _drag_points.push_back (*i);
                        }
                }
@@ -1191,6 +1201,7 @@ AutomationLine::view_to_model_coord_y (double& y) const
        /* TODO: This should be more generic (use ParameterDescriptor)
         * or better yet:  Controllable -> set_interface();
         */
+
        if (   alist->parameter().type() == GainAutomation
            || alist->parameter().type() == EnvelopeAutomation
            || (_desc.logarithmic && _desc.lower == 0. && _desc.upper > _desc.lower)) {
@@ -1207,8 +1218,12 @@ AutomationLine::view_to_model_coord_y (double& y) const
        } else if (alist->parameter().type() == PanAzimuthAutomation ||
                   alist->parameter().type() == PanElevationAutomation) {
                y = 1.0 - y;
+               y = max ((double) _desc.lower, y);
+               y = min ((double) _desc.upper, y);
        } else if (alist->parameter().type() == PanWidthAutomation) {
                y = 2.0 * y - 1.0;
+               y = max ((double) _desc.lower, y);
+               y = min ((double) _desc.upper, y);
        } else {
                y = y * (double)(alist->get_max_y() - alist->get_min_y()) + alist->get_min_y();
                if (_desc.integer_step) {
@@ -1216,6 +1231,8 @@ AutomationLine::view_to_model_coord_y (double& y) const
                } else if (_desc.toggled) {
                        y = (y > 0.5) ? 1.0 : 0.0;
                }
+               y = max ((double) _desc.lower, y);
+               y = min ((double) _desc.upper, y);
        }
 }