Use labs() for long instead of abs()
[ardour.git] / gtk2_ardour / stereo_panner_editor.cc
index 0cc856f5007a34a72ba073331fdb91c88107ff73..4132ed82cf4c15d86c4067d418963f565cfb48e7 100644 (file)
@@ -1,21 +1,20 @@
 /*
-    Copyright (C) 2012 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2016 Paul Davis <paul@linuxaudiosystems.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
 
 #include <gtkmm.h>
 #include "gtkmm2ext/utils.h"
 #include "pbd/controllable.h"
 #include "stereo_panner_editor.h"
 #include "stereo_panner.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace Gtk;
 using namespace Gtkmm2ext;
 
+using PBD::Controllable;
+
 StereoPannerEditor::StereoPannerEditor (StereoPanner* p)
        : PannerEditor (_("Stereo Panner"))
        , _panner (p)
@@ -40,12 +41,12 @@ StereoPannerEditor::StereoPannerEditor (StereoPanner* p)
        t->set_spacings (6);
 
        int n = 0;
-       
+
        t->attach (*manage (left_aligned_label (_("Position"))), 0, 1, n, n + 1);
        t->attach (_position, 1, 2, n, n + 1);
        t->attach (*manage (left_aligned_label (_("%"))), 2, 3, n, n + 1);
        ++n;
-       
+
        t->attach (*manage (left_aligned_label (_("Width"))), 0, 1, n, n + 1);
        t->attach (_width, 1, 2, n, n + 1);
        t->attach (*manage (left_aligned_label (_("%"))), 2, 3, n, n + 1);
@@ -66,7 +67,7 @@ StereoPannerEditor::StereoPannerEditor (StereoPanner* p)
        _panner->get_width_controllable()->Changed.connect (
                _connections, invalidator (*this), boost::bind (&StereoPannerEditor::update_editor, this), gui_context ()
                );
-       
+
        _panner->DropReferences.connect (_connections, invalidator (*this), boost::bind (&StereoPannerEditor::panner_going_away, this), gui_context ());
        _position.signal_value_changed().connect (sigc::mem_fun (*this, &StereoPannerEditor::position_changed));
        _width.signal_value_changed().connect (sigc::mem_fun (*this, &StereoPannerEditor::width_changed));
@@ -87,7 +88,7 @@ StereoPannerEditor::update_editor ()
        if (!_panner) {
                return;
        }
-       
+
        _ignore_changes = true;
        _position.set_value (100 * _panner->get_position_controllable()->get_value ());
        _width.set_value (100 * _panner->get_width_controllable()->get_value ());
@@ -103,7 +104,7 @@ StereoPannerEditor::position_changed ()
 
        _ignore_changes = true;
        double const v = _position.get_value() / 100;
-       _panner->get_position_controllable()->set_value (v);
+       _panner->get_position_controllable()->set_value (v, Controllable::NoGroup);
        set_width_range ();
        _ignore_changes = false;
 }
@@ -117,7 +118,7 @@ StereoPannerEditor::width_changed ()
 
        _ignore_changes = true;
        double const v = _width.get_value() / 100;
-       _panner->get_width_controllable()->set_value (v);
+       _panner->get_width_controllable()->set_value (v, Controllable::NoGroup);
        set_position_range ();
        _ignore_changes = false;
 }
@@ -135,4 +136,4 @@ StereoPannerEditor::set_width_range ()
        pair<double, double> const wr = _panner->panner()->width_range ();
        _width.set_range (wr.first * 100, wr.second * 100);
 }
-       
+