SoloSelection: gui part.
authorBen Loftis <ben@harrisonconsoles.com>
Sun, 11 Feb 2018 15:39:45 +0000 (09:39 -0600)
committerBen Loftis <ben@harrisonconsoles.com>
Sun, 11 Feb 2018 15:39:45 +0000 (09:39 -0600)
13 files changed:
gtk2_ardour/ardour.keys.in
gtk2_ardour/ardour.menus.in
gtk2_ardour/ardour_ui_ed.cc
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_drag.cc
gtk2_ardour/editor_mouse.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/editor_selection.cc
gtk2_ardour/public_editor.h
gtk2_ardour/region_view.h
gtk2_ardour/selection.cc
gtk2_ardour/selection.h

index 62aea52b30118c37cec5941afb5d13f88c407762..78b34f6e706b0fbc613dfb986e1bf67021f28fb4 100644 (file)
@@ -160,7 +160,6 @@ This mode provides many different operations on both regions and control points,
 @trans|Transport/Record|<@TERTIARY@>r|engage record
 @mmode|MouseMode/set-mouse-mode-timefx|t|timefx mode
 @select|Editor/select-all-tracks|<@PRIMARY@>t|select all tracks
-@mmode|MouseMode/set-mouse-mode-object-range|y|link object/range tools
 @edit|Editor/alternate-redo|<@PRIMARY@>y|redo
 @select|Editor/select-all-between-cursors|<@PRIMARY@>u|all enclosed by edit range
 @select|Editor/select-all-within-cursors|u|all present in edit range
@@ -179,7 +178,7 @@ This mode provides many different operations on both regions and control points,
 
 ;; MIDDLE ROW
 
-@aep|Region/align-regions-sync-relative|a|align sync points (relative)
+@trans|Transport/solo-selection|a|solo selection
 @select|Editor/select-all-objects|<@PRIMARY@>a|select all objects
 @aep|Region/align-regions-end|<@SECONDARY@>a|align end(s)
 @aep|Region/align-regions-sync|<@TERTIARY@>a|align sync points
@@ -213,8 +212,9 @@ This mode provides many different operations on both regions and control points,
 @edit|Editor/undo|<@PRIMARY@>z|undo
 @edit|Editor/alternate-alternate-redo|<@PRIMARY@><@TERTIARY@>z|redo
 @vis|Editor/toggle-zoom|<@TERTIARY@>z|toggle last 2 zoom states
-@mmode|MouseMode/set-mouse-mode-cut|c|cut mode
+@aep|Region/align-regions-sync-relative|x|align sync points (relative)
 @edit|Editor/editor-cut|<@PRIMARY@>x|cut
+@mmode|MouseMode/set-mouse-mode-cut|c|cut mode
 @edit|Editor/editor-copy|<@PRIMARY@>c|copy
 @wvis|Window/toggle-big-clock|<@SECONDARY@>c|toggle big clock
 @-edit|Editor/crop|<@PRIMARY@><@TERTIARY@>c|crop
@@ -347,6 +347,7 @@ This mode provides many different operations on both regions and control points,
 @gmode|Transport/ToggleAutoPlay|5|toggle auto play
 @gmode|Transport/ToggleAutoReturn|6|toggle auto return
 @gmode|Transport/ToggleClick|7|toggle click (metronome)
+@mmode|MouseMode/set-mouse-mode-object-range|8|link object/range tools
 @ranges|Region/set-tempo-from-region|9|set tempo (1 bar) from region(s)
 @ranges|Editor/set-tempo-from-edit-range|0|set tempo (1 bar) from edit range
 
index 03d9d2a663de0cdb6d0342d6019531d2da111bf4..210c29dbbe805291b27fb9b873370a077b260366 100644 (file)
@@ -61,6 +61,7 @@
       <menuitem action='ToggleRoll'/>
       <menu action="PlayMenu">
         <menuitem action='PlaySelection'/>
+        <menuitem action='solo-selection'/>
         <menuitem action='PlayPreroll'/>
         <menuitem action='ToggleRollMaybe'/>
         <menuitem action='play-from-edit-point-and-return'/>
index bf7623a445c3899188b2c956ba8691ea4339c1c8..a5284fa14ce9aa51053fa6a22a658034a4209f97 100644 (file)
@@ -466,6 +466,10 @@ ARDOUR_UI::install_actions ()
        act = global_actions.register_action (transport_actions, X_("PlayPreroll"), _("Play w/Preroll"), sigc::mem_fun(*this, &ARDOUR_UI::transport_play_preroll));
        ActionManager::session_sensitive_actions.push_back (act);
        ActionManager::transport_sensitive_actions.push_back (act);
+       act = global_actions.register_action (transport_actions, X_("solo-selection"), _("Solo Selection"), sigc::bind (sigc::mem_fun(*editor, &PublicEditor::play_solo_selection), true));
+       ActionManager::session_sensitive_actions.push_back (act);
+       ActionManager::transport_sensitive_actions.push_back (act);
+
 
        act = global_actions.register_action (transport_actions, X_("RecordPreroll"), _("Record w/Preroll"), sigc::mem_fun(*this, &ARDOUR_UI::transport_rec_preroll));
        ActionManager::session_sensitive_actions.push_back (act);
index ae0ae9ea1cc2f2332758398c348791df4fdb0c09..c56cd94d1d9eeb25548830bf92f8830d5c114c92 100644 (file)
@@ -568,6 +568,7 @@ Editor::Editor ()
        _summary = new EditorSummary (this);
 
        selection->TimeChanged.connect (sigc::mem_fun(*this, &Editor::time_selection_changed));
+       selection->TracksChanged.connect (sigc::mem_fun(*this, &Editor::track_selection_changed));
 
        editor_regions_selection_changed_connection = selection->RegionsChanged.connect (sigc::mem_fun(*this, &Editor::region_selection_changed));
 
@@ -2927,11 +2928,11 @@ Editor::setup_toolbar ()
 
        if (!ARDOUR::Profile->get_mixbus()) {
                mouse_mode_hbox->pack_start (mouse_cut_button, false, false);
+               mouse_mode_hbox->pack_start (mouse_audition_button, false, false);
        }
 
        if (!ARDOUR::Profile->get_trx()) {
                mouse_mode_hbox->pack_start (mouse_timefx_button, false, false);
-               mouse_mode_hbox->pack_start (mouse_audition_button, false, false);
                mouse_mode_hbox->pack_start (mouse_draw_button, false, false);
                mouse_mode_hbox->pack_start (mouse_content_button, false, false);
        }
index 1d20fe5958b60b1eb81184a039d8ee307a2cc4dd..947985b40edf9bb348c1e1874dac721a58f70aca 100644 (file)
@@ -1239,6 +1239,8 @@ private:
        void toggle_mute ();
        void toggle_region_lock_style ();
 
+       void play_solo_selection( bool restart );
+
        enum LayerOperation {
                Raise,
                RaiseToTop,
@@ -1866,6 +1868,7 @@ private:
        SelectionMemento* _selection_memento;
 
        void time_selection_changed ();
+       void track_selection_changed ();
        void update_time_selection_display ();
        void presentation_info_changed (PBD::PropertyChange const &);
        void region_selection_changed ();
index e80f28171c84f47d124fd7064826e48febac7f24..39fbdca221956ddcc3f026b7e47d0fe3bb93f3ba 100644 (file)
@@ -5675,12 +5675,16 @@ SelectionDrag::finished (GdkEvent* event, bool movement_occurred)
 
                /* XXX what if its a music time selection? */
                if (s) {
-                       if (s->get_play_range() && s->transport_rolling()) {
-                               s->request_play_range (&_editor->selection->time, true);
-                       } else if (!s->config.get_external_sync()) {
-                               if (UIConfiguration::instance().get_follow_edits() && !s->transport_rolling()) {
-                                       s->request_locate (_editor->get_selection().time.start());
+
+                       //if Follow Edits is on, maybe try to follow the range selection  ... also consider range-audition mode
+                       if ( !s->config.get_external_sync() && s->transport_rolling() ) {
+                               if ( s->solo_selection_active() ) {
+                                       _editor->play_solo_selection(true);  //play the newly selected range, and move solos to match
+                               } else if ( UIConfiguration::instance().get_follow_edits() && s->get_play_range() ) {  //already rolling a selected range
+                                       s->request_play_range (&_editor->selection->time, true);  //play the newly selected range
                                }
+                       } else if ( !s->transport_rolling() && UIConfiguration::instance().get_follow_edits() ) {
+                               s->request_locate (_editor->get_selection().time.start());
                        }
 
                        if (_editor->get_selection().time.length() != 0) {
index 930b17a708d646536bf8f088a4e773c8ce8aa782..1a90513f72a3a64629b3ce7f88d4a72a7188ccb0 100644 (file)
@@ -272,6 +272,7 @@ Editor::set_mouse_mode (MouseMode m, bool force)
 
        if (ARDOUR::Profile->get_mixbus()) {
                if ( m == MouseCut) m = MouseObject;
+               if ( m == MouseAudition) m = MouseRange;
        }
 
        Glib::RefPtr<Action>       act  = get_mouse_mode_action(m);
@@ -289,6 +290,7 @@ Editor::mouse_mode_toggled (MouseMode m)
 {
        if (ARDOUR::Profile->get_mixbus()) {
                if ( m == MouseCut)  m = MouseObject;
+               if ( m == MouseAudition)  m = MouseRange;
        }
 
        Glib::RefPtr<Action>       act  = get_mouse_mode_action(m);
@@ -2557,6 +2559,17 @@ Editor::escape ()
                _drags->abort ();
        } else {
                selection->clear ();
+               
+               //if session is playing a range, cancel that
+               if (_session->get_play_range()) {
+                       _session->request_cancel_play_range();
+               }
+
+               if ( _session->solo_selection_active() ) {
+                       StripableList sl;
+                       _session->solo_selection( sl, false );
+               }
+               
        }
 
        ARDOUR_UI::instance()->reset_focus (&contents());
index d94506012bf92e41b37d64b82180e621143ee78d..7173e267e65425d2c89c42df53689ccb7a5845a1 100644 (file)
@@ -1962,6 +1962,31 @@ void
 Editor::temporal_zoom_selection (Editing::ZoomAxis axes)
 {
        if (!selection) return;
+       
+       if ( selection->regions.empty() && selection->time.empty() ) {
+               if (axes == Horizontal || axes == Both) {
+                       temporal_zoom_step(true);
+               }
+               if (axes == Vertical || axes == Both) {
+                       if ( !track_views.empty() ) {
+
+                               TrackViewList tvl;
+
+                               //implicit hack: by extending the top & bottom check outside the current view limits, we include the trackviews immediately above & below what is visible
+                               const double top = vertical_adjustment.get_value() - 10;
+                               const double btm = top + _visible_canvas_height + 10;
+
+                               for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
+                                       if ( (*iter)->covered_by_y_range (top, btm) ) {
+                                               tvl.push_back(*iter);
+                                       }
+                               }
+
+                               fit_tracks (tvl);
+                       }
+               }
+               return;
+       }
 
        //ToDo:  if notes are selected, zoom to that
 
@@ -5865,6 +5890,54 @@ Editor::toggle_record_enable ()
        }
 }
 
+StripableList
+tracklist_to_stripables( TrackViewList list )
+{
+       StripableList ret;
+       
+       for (TrackSelection::iterator i = list.begin(); i != list.end(); ++i) {
+               RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> ((*i));
+
+               if (rtv && rtv->is_track()) {
+                       ret.push_back( rtv->track() );
+               }
+       }
+       
+       return ret;
+}
+
+void
+Editor::play_solo_selection (bool restart)
+{
+       //note: session::solo_selection takes care of invalidating the region playlist
+
+       if ( (!selection->tracks.empty()) && selection->time.length() > 0 ) {  //a range is selected; solo the tracks and roll
+       
+               StripableList sl = tracklist_to_stripables (selection->tracks);
+               _session->solo_selection( sl, true );
+
+               if ( restart ) {
+                       samplepos_t start = selection->time.start();
+                       samplepos_t end = selection->time.end_sample();
+                       _session->request_bounded_roll (start, end);
+               }
+       } else if ( ! selection->tracks.empty() ) {  //no range is selected, but tracks are selected; solo the tracks and roll
+               StripableList sl = tracklist_to_stripables (selection->tracks);
+               _session->solo_selection( sl, true );
+               _session->request_cancel_play_range();
+               transition_to_rolling (true);
+       
+       } else if ( ! selection->regions.empty() ) {  //solo any tracks with selected regions, and roll
+               StripableList sl = tracklist_to_stripables ( get_tracks_for_range_action() );
+               _session->solo_selection( sl, true );
+               _session->request_cancel_play_range();
+               transition_to_rolling (true);
+       } else {
+               _session->request_cancel_play_range();
+               transition_to_rolling (true);  //no selection.  just roll.
+       }
+}
+
 void
 Editor::toggle_solo ()
 {
index 11d5310f770b93ab9d884efd1d86889a319d2b87..02f44a93fc1857ac85d2b73f9bf455e63ef1e1be 100644 (file)
@@ -1155,6 +1155,13 @@ Editor::presentation_info_changed (PropertyChange const & what_changed)
        }
 }
 
+void
+Editor::track_selection_changed ()
+{
+       if ( _session->solo_selection_active() )
+               play_solo_selection(false);
+}
+
 void
 Editor::time_selection_changed ()
 {
@@ -1577,6 +1584,8 @@ Editor::region_selection_changed ()
                }
        }
 
+       if ( _session->solo_selection_active() )
+               play_solo_selection(false);
 }
 
 void
index 42ec913bc10339f81de4004978ff21e09578a583..3da2be4f40841c2a7c0b0c9f056b3a37401da755 100644 (file)
@@ -211,6 +211,7 @@ public:
        virtual void set_selection (std::list<Selectable*>, Selection::Operation) = 0;
 
        virtual bool extend_selection_to_track (TimeAxisView&) = 0;
+       virtual void play_solo_selection(bool restart) = 0;
        virtual void play_selection () = 0;
        virtual void play_with_preroll () = 0;
        virtual void rec_with_preroll () = 0;
index e7b1789491ed49349079081cae824b9b7a394ec6..b33d6abf2ca341bac983c752cf072e96b10dbf7a 100644 (file)
@@ -61,6 +61,11 @@ public:
 
        ~RegionView ();
 
+       virtual void set_selected (bool yn) {
+               _region->set_selected_for_solo(yn);
+               TimeAxisViewItem::set_selected(yn);
+       }
+
        virtual void init (bool wait_for_data);
 
        boost::shared_ptr<ARDOUR::Region> region() const { return _region; }
index 05255a13cb561ed16e2a1ad8644da8f0620e8d70..66de08ccb3f5b22985aaba43bece604096b551f9 100644 (file)
@@ -1693,4 +1693,6 @@ Selection::core_selection_changed (PropertyChange const & what_changed)
                        tracks.push_back (tav);
                }
        }
+       
+       TracksChanged();
 }
index 869589f2856ef5ded56981d5bbd32a4a18decd00..38e2e77591b3b57f1d11236acfdde751de3003b0 100644 (file)
@@ -94,6 +94,7 @@ public:
 
        // Selection& operator= (const Selection& other);
 
+       sigc::signal<void> TracksChanged;
        sigc::signal<void> RegionsChanged;
        sigc::signal<void> TimeChanged;
        sigc::signal<void> LinesChanged;