summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Loftis <ben@harrisonconsoles.com>2018-02-11 09:39:45 -0600
committerBen Loftis <ben@harrisonconsoles.com>2018-02-11 09:39:45 -0600
commit0299229e417ad6b8332ae3c9eafbf67a1c369727 (patch)
tree378fb89cc2c0a775a20fbdc732bbefd3818282aa
parente6da4c4846cd3097e2393f0e43016b870e7cf592 (diff)
SoloSelection: gui part.
-rw-r--r--gtk2_ardour/ardour.keys.in7
-rw-r--r--gtk2_ardour/ardour.menus.in1
-rw-r--r--gtk2_ardour/ardour_ui_ed.cc4
-rw-r--r--gtk2_ardour/editor.cc3
-rw-r--r--gtk2_ardour/editor.h3
-rw-r--r--gtk2_ardour/editor_drag.cc14
-rw-r--r--gtk2_ardour/editor_mouse.cc13
-rw-r--r--gtk2_ardour/editor_ops.cc73
-rw-r--r--gtk2_ardour/editor_selection.cc9
-rw-r--r--gtk2_ardour/public_editor.h1
-rw-r--r--gtk2_ardour/region_view.h5
-rw-r--r--gtk2_ardour/selection.cc2
-rw-r--r--gtk2_ardour/selection.h1
13 files changed, 127 insertions, 9 deletions
diff --git a/gtk2_ardour/ardour.keys.in b/gtk2_ardour/ardour.keys.in
index 62aea52b30..78b34f6e70 100644
--- a/gtk2_ardour/ardour.keys.in
+++ b/gtk2_ardour/ardour.keys.in
@@ -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
diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in
index 03d9d2a663..210c29dbbe 100644
--- a/gtk2_ardour/ardour.menus.in
+++ b/gtk2_ardour/ardour.menus.in
@@ -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'/>
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc
index bf7623a445..a5284fa14c 100644
--- a/gtk2_ardour/ardour_ui_ed.cc
+++ b/gtk2_ardour/ardour_ui_ed.cc
@@ -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);
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index ae0ae9ea1c..c56cd94d1d 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -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);
}
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 1d20fe5958..947985b40e 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -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 ();
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index e80f28171c..39fbdca221 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -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) {
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 930b17a708..1a90513f72 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -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());
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index d94506012b..7173e267e6 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -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 ()
{
diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc
index 11d5310f77..02f44a93fc 100644
--- a/gtk2_ardour/editor_selection.cc
+++ b/gtk2_ardour/editor_selection.cc
@@ -1156,6 +1156,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 ()
{
/* XXX this is superficially inefficient. Hide the selection in all
@@ -1577,6 +1584,8 @@ Editor::region_selection_changed ()
}
}
+ if ( _session->solo_selection_active() )
+ play_solo_selection(false);
}
void
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index 42ec913bc1..3da2be4f40 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -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;
diff --git a/gtk2_ardour/region_view.h b/gtk2_ardour/region_view.h
index e7b1789491..b33d6abf2c 100644
--- a/gtk2_ardour/region_view.h
+++ b/gtk2_ardour/region_view.h
@@ -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; }
diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc
index 05255a13cb..66de08ccb3 100644
--- a/gtk2_ardour/selection.cc
+++ b/gtk2_ardour/selection.cc
@@ -1693,4 +1693,6 @@ Selection::core_selection_changed (PropertyChange const & what_changed)
tracks.push_back (tav);
}
}
+
+ TracksChanged();
}
diff --git a/gtk2_ardour/selection.h b/gtk2_ardour/selection.h
index 869589f285..38e2e77591 100644
--- a/gtk2_ardour/selection.h
+++ b/gtk2_ardour/selection.h
@@ -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;