Fix mixer left/right scroll, snap to strip boundary.
authorRobin Gareus <robin@gareus.org>
Tue, 13 Feb 2018 10:18:03 +0000 (11:18 +0100)
committerRobin Gareus <robin@gareus.org>
Tue, 13 Feb 2018 10:18:03 +0000 (11:18 +0100)
Ignore add-button (packed at end, start of list) when iterating
over strip_packer.children.

gtk2_ardour/mixer_ui.cc
gtk2_ardour/mixer_ui.h

index 179acf8426fab0a02042bb79a4e95ea28c8a8a77..18963fb9e9a63bcb0279cb471a61abdad425626d 100644 (file)
@@ -135,17 +135,16 @@ Mixer_UI::Mixer_UI ()
        scroller_base.drag_dest_set (target_table);
        scroller_base.signal_drag_data_received().connect (sigc::mem_fun(*this, &Mixer_UI::scroller_drag_data_received));
 
-       //create a button to add mixer strips ( replaces the old buttons in the mixer list )
-       Button* add_button = manage (new Button);
-       add_button->show ();
+       /* create a button to add mixer strips */
+       add_button.show ();
        Widget* w = manage (new Image (Stock::ADD, ICON_SIZE_BUTTON));
        w->show ();
-       add_button->add (*w);
-       add_button->signal_clicked().connect (sigc::mem_fun (*this, &Mixer_UI::new_track_or_bus));
+       add_button.add (*w);
+       add_button.signal_clicked().connect (sigc::mem_fun (*this, &Mixer_UI::new_track_or_bus));
 
-       // add as last item of strip packer
+       /* add as last item of strip packer */
        strip_packer.pack_end (scroller_base, true, true);
-       strip_packer.pack_end (*add_button, false, false);
+       strip_packer.pack_end (add_button, false, false);
 
        _group_tabs = new MixerGroupTabs (this);
        VBox* b = manage (new VBox);
@@ -1436,7 +1435,7 @@ Mixer_UI::redisplay_track_list ()
 
        container_clear (vca_hpacker);
 
-       //create a button to add mixer strips ( replaces the old buttons in the mixer list )
+       /* create a button to add mixer strips */
        Button* add_vca_button = manage (new Button);
        Widget* w = manage (new Image (Stock::ADD, ICON_SIZE_BUTTON));
        w->show ();
@@ -2230,6 +2229,9 @@ Mixer_UI::scroll_left ()
        using namespace Gtk::Box_Helpers;
        const BoxList& strips = strip_packer.children();
        for (BoxList::const_iterator i = strips.begin(); i != strips.end(); ++i) {
+               if (i->get_widget() == & add_button) {
+                       continue;
+               }
                lm += i->get_widget()->get_width ();
                if (lm >= lp) {
                        lm -= i->get_widget()->get_width ();
@@ -2254,6 +2256,9 @@ Mixer_UI::scroll_right ()
        using namespace Gtk::Box_Helpers;
        const BoxList& strips = strip_packer.children();
        for (BoxList::const_iterator i = strips.begin(); i != strips.end(); ++i) {
+               if (i->get_widget() == & add_button) {
+                       continue;
+               }
                lm += i->get_widget()->get_width ();
                if (lm > lp + 1) {
                        break;
index 6319f93154a2955252b073df22bc0efc88ad1fbb..3fa4214213ed1bd485d0ae3224e55bc792b0e141 100644 (file)
@@ -167,6 +167,7 @@ private:
        Gtk::Label            vca_label;
        Gtk::EventBox         vca_scroller_base;
        Gtk::HBox             out_packer;
+       Gtk::Button           add_button; // should really be an ArdourButton
        ArdourWidgets::HPane  list_hpane;
 
        MixerGroupTabs* _group_tabs;