Prevent multiple color-picker dialogs for a single stripable
authorRobin Gareus <robin@gareus.org>
Sun, 12 Mar 2017 15:54:38 +0000 (16:54 +0100)
committerRobin Gareus <robin@gareus.org>
Sun, 12 Mar 2017 15:54:38 +0000 (16:54 +0100)
gtk2_ardour/stripable_colorpicker.cc

index a7db947df8fa5471d19033f83d3d47648dc4a283..2e341f4d7e45ad68f4a3b094ba075d913a6a50ef 100644 (file)
@@ -70,12 +70,19 @@ void
 StripableColorDialog::reset ()
 {
        hide ();
+       if (_stripable && _stripable->active_color_picker() == this) {
+               _stripable->set_active_color_picker (0);
+       }
        _stripable.reset ();
 }
 
 void
 StripableColorDialog::popup (boost::shared_ptr<ARDOUR::Stripable> s)
 {
+       if (s && s->active_color_picker()) {
+               s->active_color_picker()->present ();
+               return;
+       }
        if (_stripable == s) {
                /* keep modified color */
                present ();
@@ -83,6 +90,7 @@ StripableColorDialog::popup (boost::shared_ptr<ARDOUR::Stripable> s)
        }
 
        _stripable = s;
+       _stripable->set_active_color_picker (this);
        set_title (string_compose (_("Color Selection: %1"), s->name()));
 
        get_colorsel()->set_has_opacity_control (false);