Fix erroneous parameter passed to Editor::motion_handler. Makes autoscroll work...
[ardour.git] / gtk2_ardour / panner_ui.cc
index 7f1475fabc7b95a8f26c9d3e58d9e67bf650330b..c04ca055b26f1d599bcd78bab761c3911ed1d6de 100644 (file)
@@ -51,6 +51,7 @@ const int PannerUI::pan_bar_height = 30;
 
 PannerUI::PannerUI (Session& s)
        : _session (s),
+         _current_nouts (-1),
          hAdjustment(0.0, 0.0, 0.0),
          vAdjustment(0.0, 0.0, 0.0),
          panning_viewport(hAdjustment, vAdjustment),
@@ -154,7 +155,7 @@ PannerUI::set_panner (boost::shared_ptr<Panner> p)
        connections.push_back (_panner->Changed.connect (mem_fun(*this, &PannerUI::panner_changed)));
        connections.push_back (_panner->LinkStateChanged.connect (mem_fun(*this, &PannerUI::update_pan_linkage)));
        connections.push_back (_panner->StateChanged.connect (mem_fun(*this, &PannerUI::update_pan_state)));
+
        setup_pan ();
 
        pan_changed (0);
@@ -229,13 +230,13 @@ PannerUI::get_controllable()
 }
 
 bool
-PannerUI::panning_link_button_press (GdkEventButton* ev)
+PannerUI::panning_link_button_press (GdkEventButton*)
 {
        return true;
 }
 
 bool
-PannerUI::panning_link_button_release (GdkEventButton* ev)
+PannerUI::panning_link_button_release (GdkEventButton*)
 {
        if (!ignore_toggle) {
                _panner->set_linked (!_panner->linked());
@@ -335,14 +336,20 @@ PannerUI::update_pan_state ()
 void
 PannerUI::setup_pan ()
 {
-       cerr << "Setup pan for " << _panner->name() << endl;
-
        if (!_panner) {
                return;
        }
 
        uint32_t nouts = _panner->nouts();
 
+       if (nouts == _current_nouts) {
+               return;
+       }
+
+       _current_nouts = nouts;
+
+       cout << "Setup pan for " << _panner->name() << endl;
+
        if (nouts == 0 || nouts == 1) {
 
                while (!pan_adjustments.empty()) {