Correct formatting for if/else statements
[ardour.git] / libs / surfaces / launch_control_xl / launch_control_xl.cc
index 6c71559ac40d6406bcd0f9419730da88b6f1f9de..d8dfb8ee5d70f8127fe91584fe9d43bde8246eee 100644 (file)
@@ -103,8 +103,8 @@ LaunchControlXL::LaunchControlXL (ARDOUR::Session& s)
        /* Launch Control XL ports might already be there */
        port_registration_handler ();
 
-       session->RouteAdded.connect (session_connections, invalidator(*this), boost::bind (&LaunchControlXL::stripables_added, this), lcxl);
-       session->vca_manager().VCAAdded.connect (session_connections, invalidator (*this), boost::bind (&LaunchControlXL::stripables_added, this), lcxl);
+       session->RouteAdded.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::stripables_added, this), lcxl);
+       session->vca_manager().VCAAdded.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::stripables_added, this), lcxl);
 
        switch_bank (bank_start);
 }
@@ -116,6 +116,8 @@ LaunchControlXL::~LaunchControlXL ()
        /* do this before stopping the event loop, so that we don't get any notifications */
        port_reg_connection.disconnect ();
        port_connection.disconnect ();
+       session_connections.drop_connections ();
+       stripable_connections.drop_connections ();
 
        stop_using_device ();
        ports_release ();
@@ -406,8 +408,7 @@ LaunchControlXL::handle_button_message(Button* button, MIDI::EventTwoBytes* ev)
                        NoteButton*     nb = id_note_button_map[*x];
                        if (cb != 0) {
                                cb->timeout_connection.disconnect();
-                       }
-                       else if (nb != 0) {
+                       } else if (nb != 0) {
                                        nb->timeout_connection.disconnect();
                        }
     }
@@ -415,8 +416,7 @@ LaunchControlXL::handle_button_message(Button* button, MIDI::EventTwoBytes* ev)
     buttons_down.insert(button->id());
     DEBUG_TRACE(DEBUG::LaunchControlXL, string_compose("button pressed: %1\n", LaunchControlXL::button_name_by_id(button->id())));
     start_press_timeout(button, button->id());
-  }
-  else {
+  } else {
     DEBUG_TRACE(DEBUG::LaunchControlXL, string_compose("button depressed: %1\n", LaunchControlXL::button_name_by_id(button->id())));
     buttons_down.erase(button->id());
     button->timeout_connection.disconnect();
@@ -427,12 +427,10 @@ LaunchControlXL::handle_button_message(Button* button, MIDI::EventTwoBytes* ev)
   if (c == consumed.end()) {
     if (ev->value == 0) {
       (this->*button->release_method)();
-    }
-    else {
+    } else {
       (this->*button->press_method)();
     }
-  }
-  else {
+  } else {
     DEBUG_TRACE(DEBUG::LaunchControlXL, "button was consumed, ignored\n");
     consumed.erase(c);
   }
@@ -450,11 +448,9 @@ LaunchControlXL::handle_knob_message (Knob* knob)
 
        if (knob->id() < 8) { // sendA
                ac = stripable[chan]->trim_control();
-       }
-       else if (knob->id() >= 8 && knob->id() < 16) { // sendB
+       } else if (knob->id() >= 8 && knob->id() < 16) { // sendB
                ac = stripable[chan]->pan_width_control();
-       }
-       else if (knob->id() >= 16 && knob->id() < 24) { // pan
+       } else if (knob->id() >= 16 && knob->id() < 24) { // pan
                ac = stripable[chan]->pan_azimuth_control();
        }
 
@@ -488,20 +484,18 @@ LaunchControlXL::handle_midi_controller_message (MIDI::Parser& parser, MIDI::Eve
        // DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose ("CC %1 (value %2)\n", (int) ev->controller_number, (int) ev->value));
 
        CCControllerButtonMap::iterator b = cc_controller_button_map.find (ev->controller_number);
-       CCFaderMap::iterator f = cc_fader_map.find (ev->controller_number);
+       CCFaderMap::iterator f = cc_fader_map.find (ev->controller_number);
        CCKnobMap::iterator k = cc_knob_map.find (ev->controller_number);
 
        if (b != cc_controller_button_map.end()) {
                Button* button = b->second;
                handle_button_message(button, ev);
-       }
-       else if (f != cc_fader_map.end()) {
+       } else if (f != cc_fader_map.end()) {
                Fader* fader = f->second;
                fader->set_value(ev->value);
                handle_fader_message(fader);
 
-       }
-       else if (k != cc_knob_map.end()) {
+       } else if (k != cc_knob_map.end()) {
                Knob* knob = k->second;
                knob->set_value(ev->value);
                handle_knob_message(knob);
@@ -522,9 +516,9 @@ LaunchControlXL::handle_midi_note_on_message (MIDI::Parser& parser, MIDI::EventT
         NNNoteButtonMap::iterator b = nn_note_button_map.find (ev->controller_number);
 
         if (b != nn_note_button_map.end()) {
-               Button* button = b->second;
-               handle_button_message(button, ev);
-       }
+               Button* button = b->second;
+               handle_button_message(button, ev);
+       }
 }
 
 void LaunchControlXL::handle_midi_note_off_message(MIDI::Parser & parser, MIDI::EventTwoBytes *ev, MIDI::channel_t chan)
@@ -854,12 +848,12 @@ LaunchControlXL::switch_bank (uint32_t base)
                if (stripable[n]) {
                        /* stripable goes away? refill the bank, starting at the same point */
 
-                       stripable[n]->DropReferences.connect (stripable_connections, invalidator (*this), boost::bind (&LaunchControlXL::switch_bank, this, bank_start), lcxl);
-                       stripable[n]->presentation_info().PropertyChanged.connect (stripable_connections, invalidator (*this), boost::bind (&LaunchControlXL::stripable_property_change, this, _1, n), lcxl);
-                       stripable[n]->solo_control()->Changed.connect (stripable_connections, invalidator (*this), boost::bind (&LaunchControlXL::solo_changed, this, n), lcxl);
-                       stripable[n]->mute_control()->Changed.connect (stripable_connections, invalidator (*this), boost::bind (&LaunchControlXL::mute_changed, this, n), lcxl);
+                       stripable[n]->DropReferences.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::switch_bank, this, bank_start), lcxl);
+                       stripable[n]->presentation_info().PropertyChanged.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::stripable_property_change, this, _1, n), lcxl);
+                       stripable[n]->solo_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::solo_changed, this, n), lcxl);
+                       stripable[n]->mute_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::mute_changed, this, n), lcxl);
                        if (stripable[n]->rec_enable_control()) {
-                               stripable[n]->rec_enable_control()->Changed.connect (stripable_connections, invalidator (*this), boost::bind (&LaunchControlXL::rec_changed, this, n), lcxl);
+                               stripable[n]->rec_enable_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::rec_changed, this, n), lcxl);
                        }