fix bork-age of the fade in/out context menu introduced by mistake yesterday
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 16 May 2012 14:20:12 +0000 (14:20 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 16 May 2012 14:20:12 +0000 (14:20 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@12311 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor.cc

index a6746b265dece7ce59094e38330d4ea3d1e604ab..26de6fe3837214bf6c7b83c12395625f75af5ed6 100644 (file)
@@ -1449,141 +1449,140 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i
        }
 
        MenuList& items (fade_context_menu.items());
+       items.clear ();
 
-       if (items.empty()) {
-               switch (item_type) {
-               case FadeInItem:
-               case FadeInHandleItem:
-                       if (arv->audio_region()->fade_in_active()) {
-                               items.push_back (MenuElem (_("Deactivate"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_active), false)));
-                       } else {
-                               items.push_back (MenuElem (_("Activate"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_active), true)));
-                       }
+       switch (item_type) {
+       case FadeInItem:
+       case FadeInHandleItem:
+               if (arv->audio_region()->fade_in_active()) {
+                       items.push_back (MenuElem (_("Deactivate"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_active), false)));
+               } else {
+                       items.push_back (MenuElem (_("Activate"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_active), true)));
+               }
+               
+               items.push_back (SeparatorElem());
+               
+               if (Profile->get_sae()) {
                        
-                       items.push_back (SeparatorElem());
+                       items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLinear)));
+                       items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeFast)));
                        
-                       if (Profile->get_sae()) {
-                               
-                               items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLinear)));
-                               items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeFast)));
-                               
-                       } else {
-                               
-                               items.push_back (
-                                       ImageMenuElem (
-                                               _("Linear"),
-                                               *_fade_in_images[FadeLinear],
-                                               sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLinear)
-                                               )
-                                       );
+               } else {
+                       
+                       items.push_back (
+                               ImageMenuElem (
+                                       _("Linear"),
+                                       *_fade_in_images[FadeLinear],
+                                       sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLinear)
+                                       )
+                               );
                                
-                               dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+                       dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
                                
-                               items.push_back (
-                                       ImageMenuElem (
-                                               _("Slow"),
-                                               *_fade_in_images[FadeSlow],
-                                               sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeSlow)
-                                               ));
+                       items.push_back (
+                               ImageMenuElem (
+                                       _("Slow"),
+                                       *_fade_in_images[FadeSlow],
+                                       sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeSlow)
+                                       ));
                                
-                               dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+                       dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
                                
-                               items.push_back (
-                                       ImageMenuElem (
-                                               _("Fast"),
-                                               *_fade_in_images[FadeFast],
-                                               sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeFast)
-                                               ));
+                       items.push_back (
+                               ImageMenuElem (
+                                       _("Fast"),
+                                       *_fade_in_images[FadeFast],
+                                       sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeFast)
+                                       ));
                                
-                               dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+                       dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
                                
-                               items.push_back (
-                                       ImageMenuElem (
-                                               _("Symmetric"),
-                                               *_fade_in_images[FadeSymmetric],
-                                               sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeSymmetric)
-                                               ));
+                       items.push_back (
+                               ImageMenuElem (
+                                       _("Symmetric"),
+                                       *_fade_in_images[FadeSymmetric],
+                                       sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeSymmetric)
+                                       ));
                                
-                               items.push_back (
-                                       ImageMenuElem (
-                                               _("Constant Power"),
-                                               *_fade_in_images[FadeConstantPower],
-                                               sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeConstantPower)
-                                               ));
-
-                               dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
-                       }
+                       items.push_back (
+                               ImageMenuElem (
+                                       _("Constant Power"),
+                                       *_fade_in_images[FadeConstantPower],
+                                       sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeConstantPower)
+                                       ));
+
+                       dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+               }
 
-                       break;
+               break;
 
-               case FadeOutItem:
-               case FadeOutHandleItem:
-                       if (arv->audio_region()->fade_out_active()) {
-                               items.push_back (MenuElem (_("Deactivate"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_active), false)));
-                       } else {
-                               items.push_back (MenuElem (_("Activate"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_active), true)));
-                       }
+       case FadeOutItem:
+       case FadeOutHandleItem:
+               if (arv->audio_region()->fade_out_active()) {
+                       items.push_back (MenuElem (_("Deactivate"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_active), false)));
+               } else {
+                       items.push_back (MenuElem (_("Activate"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_active), true)));
+               }
 
-                       items.push_back (SeparatorElem());
+               items.push_back (SeparatorElem());
 
-                       if (Profile->get_sae()) {
-                               items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeLinear)));
-                               items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeSlow)));
-                       } else {
+               if (Profile->get_sae()) {
+                       items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeLinear)));
+                       items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeSlow)));
+               } else {
 
-                               items.push_back (
-                                       ImageMenuElem (
-                                               _("Linear"),
-                                               *_fade_out_images[FadeLinear],
-                                               sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeLinear)
-                                               )
-                                       );
-
-                               dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
-
-                               items.push_back (
-                                       ImageMenuElem (
-                                               _("Slow"),
-                                               *_fade_out_images[FadeSlow],
-                                               sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeSlow)
-                                               ));
-
-                               dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
-
-                               items.push_back (
-                                       ImageMenuElem (
-                                               _("Fast"),
-                                               *_fade_out_images[FadeFast],
-                                               sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeFast)
-                                               ));
-
-                               dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
-
-                               items.push_back (
-                                       ImageMenuElem (
-                                               _("Symmetric"),
-                                               *_fade_out_images[FadeSymmetric],
-                                               sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeSymmetric)
-                                               ));
-
-                               items.push_back (
-                                       ImageMenuElem (
-                                               _("Constant Power"),
-                                               *_fade_out_images[FadeConstantPower],
-                                               sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeConstantPower)
-                                               ));
-
-                               dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
-                       }
+                       items.push_back (
+                               ImageMenuElem (
+                                       _("Linear"),
+                                       *_fade_out_images[FadeLinear],
+                                       sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeLinear)
+                                       )
+                               );
+
+                       dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+
+                       items.push_back (
+                               ImageMenuElem (
+                                       _("Slow"),
+                                       *_fade_out_images[FadeSlow],
+                                       sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeSlow)
+                                       ));
+
+                       dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+
+                       items.push_back (
+                               ImageMenuElem (
+                                       _("Fast"),
+                                       *_fade_out_images[FadeFast],
+                                       sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeFast)
+                                       ));
+
+                       dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+
+                       items.push_back (
+                               ImageMenuElem (
+                                       _("Symmetric"),
+                                       *_fade_out_images[FadeSymmetric],
+                                       sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeSymmetric)
+                                       ));
+
+                       items.push_back (
+                               ImageMenuElem (
+                                       _("Constant Power"),
+                                       *_fade_out_images[FadeConstantPower],
+                                       sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeConstantPower)
+                                       ));
+
+                       dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+               }
 
-                       break;
+               break;
 
-               default:
-                       fatal << _("programming error: ")
-                             << X_("non-fade canvas item passed to popup_fade_context_menu()")
-                             << endmsg;
-                       /*NOTREACHED*/
-               }
+       default:
+               fatal << _("programming error: ")
+                     << X_("non-fade canvas item passed to popup_fade_context_menu()")
+                     << endmsg;
+               /*NOTREACHED*/
        }
 
        fade_context_menu.popup (button, time);