Fix track mode options to appear only once on audio tracks rather than twice. Fix...
authorCarl Hetherington <carl@carlh.net>
Tue, 23 Mar 2010 13:11:14 +0000 (13:11 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 23 Mar 2010 13:11:14 +0000 (13:11 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6787 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/audio_time_axis.cc
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_time_axis.h
libs/ardour/audio_diskstream.cc

index af6cfda927a1ef9b006e03e4fb40e0bdf721f8b3..3617ba22c982544c2dbc559fb94a5717419ed600 100644 (file)
@@ -180,49 +180,11 @@ AudioTimeAxisView::append_extra_display_menu_items ()
 
        // crossfade stuff
        if (!Profile->get_sae()) {
-               items.push_back (MenuElem (_("Hide all crossfades"), sigc::mem_fun(*this, &AudioTimeAxisView::hide_all_xfades)));
-               items.push_back (MenuElem (_("Show all crossfades"), sigc::mem_fun(*this, &AudioTimeAxisView::show_all_xfades)));
+               items.push_back (MenuElem (_("Hide All Crossfades"), sigc::mem_fun(*this, &AudioTimeAxisView::hide_all_xfades)));
+               items.push_back (MenuElem (_("Show All Crossfades"), sigc::mem_fun(*this, &AudioTimeAxisView::show_all_xfades)));
        }
 }
 
-Gtk::Menu*
-AudioTimeAxisView::build_mode_menu()
-{
-       using namespace Menu_Helpers;
-
-       Menu* mode_menu = manage (new Menu);
-       MenuList& items = mode_menu->items();
-       mode_menu->set_name ("ArdourContextMenu");
-
-       RadioMenuItem::Group mode_group;
-
-       items.push_back (RadioMenuElem (mode_group, _("Normal"),
-                               sigc::bind (sigc::mem_fun (*this, &AudioTimeAxisView::set_track_mode), ARDOUR::Normal)));
-       normal_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
-
-       items.push_back (RadioMenuElem (mode_group, _("Non Overlapping"),
-                               sigc::bind (sigc::mem_fun (*this, &AudioTimeAxisView::set_track_mode), ARDOUR::NonLayered)));
-       non_layered_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
-
-       items.push_back (RadioMenuElem (mode_group, _("Tape"),
-                               sigc::bind (sigc::mem_fun (*this, &AudioTimeAxisView::set_track_mode), ARDOUR::Destructive)));
-       destructive_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
-
-       switch (track()->mode()) {
-               case ARDOUR::Destructive:
-                       destructive_track_mode_item->set_active ();
-                       break;
-               case ARDOUR::NonLayered:
-                       non_layered_track_mode_item->set_active ();
-                       break;
-               case ARDOUR::Normal:
-                       normal_track_mode_item->set_active ();
-                       break;
-       }
-
-       return mode_menu;
-}
-
 void
 AudioTimeAxisView::set_show_waveforms_recording (bool yn)
 {
index 887ca93bd0d16ed70dd15fdbac115ebdca8eeca6..1ea9a1126aa37fb23dd495f83f8726e6fbe9a75f 100644 (file)
@@ -114,6 +114,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, boost::sh
        , automation_button (_("a"))
        , visual_button (_("v"))
        , gm (sess, slider, true, 115)
+       , _ignore_track_mode_change (false)
 {
        set_button_names ();
 
@@ -428,13 +429,13 @@ RouteTimeAxisView::build_automation_action_menu ()
 
        automation_action_menu->set_name ("ArdourContextMenu");
        
-       items.push_back (MenuElem (_("Show all automation"),
+       items.push_back (MenuElem (_("Show All Automation"),
                                   sigc::mem_fun(*this, &RouteTimeAxisView::show_all_automation)));
        
-       items.push_back (MenuElem (_("Show existing automation"),
+       items.push_back (MenuElem (_("Show Existing Automation"),
                                   sigc::mem_fun(*this, &RouteTimeAxisView::show_existing_automation)));
        
-       items.push_back (MenuElem (_("Hide all automation"),
+       items.push_back (MenuElem (_("Hide All Automation"),
                                   sigc::mem_fun(*this, &RouteTimeAxisView::hide_all_automation)));
        
        /* attach the plugin submenu. It may have previously been used elsewhere, so we detach it first. */
@@ -501,39 +502,41 @@ RouteTimeAxisView::build_display_menu ()
 
                RadioMenuItem::Group align_group;
 
-               alignment_items.push_back (RadioMenuElem (align_group, _("Align with existing material"),
+               alignment_items.push_back (RadioMenuElem (align_group, _("Align With Existing Material"),
                                        sigc::bind (sigc::mem_fun(*this, &RouteTimeAxisView::set_align_style), ExistingMaterial)));
                align_existing_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
                if (get_diskstream()->alignment_style() == ExistingMaterial)
                        align_existing_item->set_active();
 
-               alignment_items.push_back (RadioMenuElem (align_group, _("Align with capture time"),
+               alignment_items.push_back (RadioMenuElem (align_group, _("Align With Capture Time"),
                                        sigc::bind (sigc::mem_fun(*this, &RouteTimeAxisView::set_align_style), CaptureTime)));
                align_capture_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
                if (get_diskstream()->alignment_style() == CaptureTime)
                        align_capture_item->set_active();
 
                if (!Profile->get_sae()) {
+
                        items.push_back (MenuElem (_("Alignment"), *alignment_menu));
                        get_diskstream()->AlignmentStyleChanged.connect (route_connections, boost::bind (&RouteTimeAxisView::align_style_changed, this), gui_context());
 
                        RadioMenuItem::Group mode_group;
-                       items.push_back (RadioMenuElem (mode_group, _("Normal mode"), sigc::bind (
+                       items.push_back (RadioMenuElem (mode_group, _("Normal Mode"), sigc::bind (
                                        sigc::mem_fun (*this, &RouteTimeAxisView::set_track_mode),
                                        ARDOUR::Normal)));
                        normal_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
 
-                       items.push_back (RadioMenuElem (mode_group, _("Tape mode"), sigc::bind (
+                       items.push_back (RadioMenuElem (mode_group, _("Tape Mode"), sigc::bind (
                                        sigc::mem_fun (*this, &RouteTimeAxisView::set_track_mode),
                                        ARDOUR::Destructive)));
                        destructive_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
 
-                       items.push_back (RadioMenuElem (mode_group, _("No layering mode"),
+                       items.push_back (RadioMenuElem (mode_group, _("Non-Layered Mode"),
                                                        sigc::bind (sigc::mem_fun (*this, &RouteTimeAxisView::set_track_mode), ARDOUR::NonLayered)));
                        non_layered_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
 
 
-
+                       _ignore_track_mode_change = true;
+                       
                        switch (track()->mode()) {
                        case ARDOUR::Destructive:
                                destructive_track_mode_item->set_active ();
@@ -545,17 +548,16 @@ RouteTimeAxisView::build_display_menu ()
                                non_layered_track_mode_item->set_active ();
                                break;
                        }
+                       
+                       _ignore_track_mode_change = false;
                }
 
                get_diskstream()->AlignmentStyleChanged.connect (route_connections, boost::bind (&RouteTimeAxisView::align_style_changed, this), gui_context());
 
-               mode_menu = build_mode_menu();
-               if (mode_menu)
-                       items.push_back (MenuElem (_("Mode"), *mode_menu));
-
                color_mode_menu = build_color_mode_menu();
-               if (color_mode_menu)
+               if (color_mode_menu) {
                        items.push_back (MenuElem (_("Color Mode"), *color_mode_menu));
+               }
 
                items.push_back (SeparatorElem());
        }
@@ -584,6 +586,10 @@ static bool __reset_item (RadioMenuItem* item, RadioMenuItem* item_2)
 void
 RouteTimeAxisView::set_track_mode (TrackMode mode)
 {
+       if (_ignore_track_mode_change) {
+               return;
+       }
+       
        RadioMenuItem* item;
        RadioMenuItem* other_item;
        RadioMenuItem* other_item_2;
@@ -610,7 +616,7 @@ RouteTimeAxisView::set_track_mode (TrackMode mode)
                return;
        }
 
-       if (item && other_item && other_item_2 && item->get_active() && track()->mode() != mode) {
+       if (item && other_item && other_item_2 && track()->mode() != mode) {
                _set_track_mode (track().get(), mode, other_item, other_item_2);
        }
 }
@@ -628,6 +634,7 @@ RouteTimeAxisView::_set_track_mode (Track* track, TrackMode mode, RadioMenuItem*
                        return;
                } else {
                        cerr << "would bounce this one\n";
+                       /* XXX: radio menu item becomes inconsistent with track state in this case */
                        return;
                }
        }
index 1a9909374f08acfa3653574359b6fa82c20274bc..763504e781f755acc402db84e5dcf9c994daf82d 100644 (file)
@@ -291,7 +291,6 @@ protected:
        Gtk::Menu*          mode_menu;
        Gtk::Menu*          color_mode_menu;
 
-       virtual Gtk::Menu* build_mode_menu() { return 0; }
        virtual Gtk::Menu* build_color_mode_menu() { return 0; }
 
        void use_playlist (Gtk::RadioMenuItem *item, boost::weak_ptr<ARDOUR::Playlist> wpl);
@@ -325,6 +324,8 @@ protected:
        UnderlayList _underlay_streams;
        typedef std::list<RouteTimeAxisView*> UnderlayMirrorList;
        UnderlayMirrorList _underlay_mirrors;
+
+       bool _ignore_track_mode_change; ///< true to ignore track mode change signals
 };
 
 #endif /* __ardour_route_time_axis_h__ */
index 03f17c6e760b435a919a6d162d8854b990aa8a56..e5dfb238db9058a8fe1c272cdd182c15238c7dec 100644 (file)
@@ -2299,7 +2299,10 @@ AudioDiskstream::can_become_destructive (bool& requires_bounce) const
        }
 
        boost::shared_ptr<Region> first = _playlist->find_next_region (_session.current_start_frame(), Start, 1);
-       assert (first);
+       if (!first) {
+               requires_bounce = false;
+               return true;
+       }
 
        /* do the source(s) for the region cover the session start position ? */