summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorBen Loftis <ben@glw.com>2012-11-20 19:43:43 +0000
committerBen Loftis <ben@glw.com>2012-11-20 19:43:43 +0000
commitbeb3ec2d7a440308bce6e2db793d78f528c9fa85 (patch)
treee673c98d6d5011f78eebd2e4b18975e95773ec6c /gtk2_ardour
parent38c10a4d2367111f3b9c7ac2223a8b633bfeb147 (diff)
Always Play Range is now Follow Edits, and is based on Mixbus implementation. Added menu item. Follow Edits button replaces Auto Play; removed the connector between play and play-range. Some Smart Mode changes came along for the ride but will be cleaned up shortly
git-svn-id: svn://localhost/ardour2/branches/3.0@13537 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardour.menus.in2
-rw-r--r--gtk2_ardour/ardour_ui.cc25
-rw-r--r--gtk2_ardour/ardour_ui.h9
-rw-r--r--gtk2_ardour/ardour_ui2.cc36
-rw-r--r--gtk2_ardour/ardour_ui_ed.cc11
-rw-r--r--gtk2_ardour/ardour_ui_options.cc2
-rw-r--r--gtk2_ardour/audio_region_view.cc13
-rw-r--r--gtk2_ardour/audio_region_view.h3
-rw-r--r--gtk2_ardour/editor.cc6
-rw-r--r--gtk2_ardour/editor.h6
-rw-r--r--gtk2_ardour/editor_canvas_events.cc2
-rw-r--r--gtk2_ardour/editor_drag.cc12
-rw-r--r--gtk2_ardour/editor_imageframe.cc7
-rw-r--r--gtk2_ardour/editor_mouse.cc53
-rw-r--r--gtk2_ardour/editor_ops.cc54
-rw-r--r--gtk2_ardour/public_editor.h4
16 files changed, 193 insertions, 52 deletions
diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in
index 59e3c996a3..27a94cae3d 100644
--- a/gtk2_ardour/ardour.menus.in
+++ b/gtk2_ardour/ardour.menus.in
@@ -60,6 +60,7 @@
<menuitem action='main-menu-play-selected-regions'/>
<menuitem action='play-edit-range'/>
<menuitem action='PlaySelection'/>
+ <menuitem action='PlayPreroll'/>
<menuitem action='play-from-edit-point-and-return'/>
<menuitem action='Loop'/>
</menu>
@@ -144,6 +145,7 @@
<menuitem action='TogglePunchIn'/>
<menuitem action='TogglePunchOut'/>
<menuitem action='ToggleAutoInput'/>
+ <menuitem action='ToggleFollowEdits'/>
<menuitem action='ToggleAutoPlay'/>
<menuitem action='ToggleAutoReturn'/>
<menuitem action='ToggleClick'/>
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index a9e6a7d1b5..a5eb449739 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -151,7 +151,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
, rec_controllable (new TransportControllable ("transport rec-enable", *this, TransportControllable::RecordEnable))
, auto_return_button (ArdourButton::led_default_elements)
- , auto_play_button (ArdourButton::led_default_elements)
+ , follow_edits_button (ArdourButton::led_default_elements)
, auto_input_button (ArdourButton::led_default_elements)
, auditioning_alert_button (_("audition"))
@@ -204,9 +204,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
original_big_clock_height = -1;
original_big_clock_font_size = 0;
- roll_button.set_elements (ArdourButton::Element (ArdourButton::Body|ArdourButton::Text));
- play_selection_button.set_elements (ArdourButton::Element (ArdourButton::Body|ArdourButton::Text));
-
roll_button.set_controllable (roll_controllable);
stop_button.set_controllable (stop_controllable);
goto_start_button.set_controllable (goto_start_controllable);
@@ -1625,7 +1622,7 @@ ARDOUR_UI::transport_roll ()
_session->request_play_range (0, true);
}
- if (Config->get_always_play_range()) {
+ if ( ((editor->current_mouse_mode() == Editing::MouseRange) || get_smart_mode()) && Config->get_always_play_range()) {
_session->request_play_range (&editor->get_selection().time, true);
}
@@ -1634,6 +1631,13 @@ ARDOUR_UI::transport_roll ()
}
}
+bool
+ARDOUR_UI::get_smart_mode() const
+{
+ return ( editor->get_smart_mode() );
+}
+
+
void
ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode)
{
@@ -1684,7 +1688,7 @@ ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode)
if (rolling) {
_session->request_stop (with_abort, true);
} else {
- if (Config->get_always_play_range ()) {
+ if ( ((editor->current_mouse_mode() == Editing::MouseRange) || editor->get_smart_mode()) && Config->get_always_play_range()) {
_session->request_play_range (&editor->get_selection().time, true);
}
@@ -1731,6 +1735,15 @@ ARDOUR_UI::transport_play_selection ()
}
void
+ARDOUR_UI::transport_play_preroll ()
+{
+ if (!_session) {
+ return;
+ }
+ editor->play_with_preroll ();
+}
+
+void
ARDOUR_UI::transport_rewind (int option)
{
float current_transport_speed;
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index 1c95232479..0af4cd6d2a 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -140,6 +140,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
ARDOUR::Session* the_session() { return _session; }
+ bool get_smart_mode () const;
+
int get_session_parameters (bool quit_on_cancel, bool should_be_new = false, std::string load_template = "");
int build_session_from_nsd (const std::string& session_name, const std::string& session_path);
bool ask_about_loading_existing_session (const std::string& session_path);
@@ -418,8 +420,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
ArdourButton play_selection_button;
ArdourButton rec_button;
- ButtonJoiner* transport_joiner;
-
void toggle_external_sync ();
void toggle_time_master ();
void toggle_video_sync ();
@@ -427,7 +427,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
ShuttleControl* shuttle_box;
ArdourButton auto_return_button;
- ArdourButton auto_play_button;
+ ArdourButton follow_edits_button;
ArdourButton auto_input_button;
ArdourButton click_button;
ArdourButton sync_button;
@@ -446,7 +446,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void soloing_changed (bool);
void auditioning_changed (bool);
void _auditioning_changed (bool);
-
+
bool solo_alert_press (GdkEventButton* ev);
bool audition_alert_press (GdkEventButton* ev);
bool feedback_alert_press (GdkEventButton *);
@@ -546,6 +546,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void transport_record (bool roll);
void transport_roll ();
void transport_play_selection();
+ void transport_play_preroll();
void transport_forward (int option);
void transport_rewind (int option);
void transport_loop ();
diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc
index 83d68875d1..3b060a73ea 100644
--- a/gtk2_ardour/ardour_ui2.cc
+++ b/gtk2_ardour/ardour_ui2.cc
@@ -133,9 +133,8 @@ ARDOUR_UI::setup_tooltips ()
set_tip (goto_end_button, _("Go to end of session"));
set_tip (auto_loop_button, _("Play loop range"));
set_tip (midi_panic_button, _("MIDI Panic\nSend note off and reset controller messages on all MIDI channels"));
- set_tip (*transport_joiner, _("Always Play Range Selection (if any)"));
set_tip (auto_return_button, _("Return to last playback start when stopped"));
- set_tip (auto_play_button, _("Start playback after any locate"));
+ set_tip (follow_edits_button, _("Playhead follows Range Selections and Edits"));
set_tip (auto_input_button, _("Be sensible about input monitoring"));
set_tip (click_button, _("Enable/Disable audio click"));
set_tip (solo_alert_button, _("When active, something is soloed.\nClick to de-solo everything"));
@@ -243,7 +242,7 @@ ARDOUR_UI::setup_transport ()
static_cast<Widget*> (&transport_frame), 1));
auto_return_button.set_text(_("Auto Return"));
- auto_play_button.set_text(_("Auto Play"));
+ follow_edits_button.set_text(_("Follow Edits"));
auto_input_button.set_text (_("Auto Input"));
click_button.set_image (get_icon (X_("metronome")));
@@ -252,7 +251,7 @@ ARDOUR_UI::setup_transport ()
click_button.signal_button_press_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::click_button_clicked), false);
auto_return_button.set_name ("transport option button");
- auto_play_button.set_name ("transport option button");
+ follow_edits_button.set_name ("transport option button");
auto_input_button.set_name ("transport option button");
/* these have to provide a clear indication of active state */
@@ -293,11 +292,6 @@ ARDOUR_UI::setup_transport ()
act = ActionManager::get_action (X_("Transport"), X_("ToggleExternalSync"));
sync_button.set_related_action (act);
- transport_joiner = manage (new ButtonJoiner ("transport button", play_selection_button, roll_button));
-
- act = ActionManager::get_action (X_("Transport"), X_("AlwaysPlayRange"));
- transport_joiner->set_related_action (act);
-
/* clocks, etc. */
ARDOUR_UI::Clock.connect (sigc::mem_fun (primary_clock, &AudioClock::set));
@@ -309,8 +303,8 @@ ARDOUR_UI::setup_transport ()
act = ActionManager::get_action ("Transport", "ToggleAutoReturn");
auto_return_button.set_related_action (act);
- act = ActionManager::get_action ("Transport", "ToggleAutoPlay");
- auto_play_button.set_related_action (act);
+ act = ActionManager::get_action (X_("Transport"), X_("ToggleFollowEdits"));
+ follow_edits_button.set_related_action (act);
act = ActionManager::get_action ("Transport", "ToggleAutoInput");
auto_input_button.set_related_action (act);
@@ -344,20 +338,16 @@ ARDOUR_UI::setup_transport ()
HBox* tbox1 = manage (new HBox);
HBox* tbox2 = manage (new HBox);
- HBox* tbox3 = manage (new HBox);
HBox* tbox = manage (new HBox);
VBox* vbox1 = manage (new VBox);
VBox* vbox2 = manage (new VBox);
- VBox* vbox3 = manage (new VBox);
Alignment* a1 = manage (new Alignment);
Alignment* a2 = manage (new Alignment);
- Alignment* a3 = manage (new Alignment);
tbox1->set_spacing (2);
tbox2->set_spacing (2);
- tbox3->set_spacing (2);
tbox->set_spacing (2);
tbox1->pack_start (click_button, false, false, 5);
@@ -369,25 +359,21 @@ ARDOUR_UI::setup_transport ()
play_selection_button.set_rounded_corner_mask (0x1); /* upper left only */
roll_button.set_rounded_corner_mask (0x2); /* upper right only */
- tbox2->pack_start (*transport_joiner, false, false);
-
- tbox3->pack_start (stop_button, false, false);
- tbox3->pack_start (rec_button, false, false, 6);
+ tbox2->pack_start (play_selection_button, false, false);
+ tbox2->pack_start (roll_button, false, false);
+ tbox2->pack_start (stop_button, false, false);
+ tbox2->pack_start (rec_button, false, false, 5);
vbox1->pack_start (*tbox1, false, false);
vbox2->pack_start (*tbox2, false, false);
- vbox3->pack_start (*tbox3, false, false);
a1->add (*vbox1);
a1->set (0.5, 1.0, 0.0, 0.0);
a2->add (*vbox2);
a2->set (0.5, 1.0, 0.0, 0.0);
- a3->add (*vbox3);
- a3->set (0.5, 1.0, 0.0, 0.0);
tbox->pack_start (*a1, false, false);
tbox->pack_start (*a2, false, false);
- tbox->pack_start (*a3, false, false);
HBox* clock_box = manage (new HBox);
@@ -415,7 +401,7 @@ ARDOUR_UI::setup_transport ()
auto_box->set_homogeneous (true);
auto_box->set_spacing (2);
auto_box->pack_start (sync_button, false, false);
- auto_box->pack_start (auto_play_button, false, false);
+ auto_box->pack_start (follow_edits_button, false, false);
auto_box->pack_start (auto_return_button, false, false);
transport_tearoff_hbox.pack_start (*auto_box, false, false);
@@ -649,7 +635,7 @@ ARDOUR_UI::click_button_clicked (GdkEventButton* ev)
void
ARDOUR_UI::toggle_always_play_range ()
{
- RefPtr<Action> act = ActionManager::get_action (X_("Transport"), X_("AlwaysPlayRange"));
+ RefPtr<Action> act = ActionManager::get_action (X_("Transport"), X_("ToggleFollowEdits"));
assert (act);
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act);
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc
index 55028bf149..662ab44bfa 100644
--- a/gtk2_ardour/ardour_ui_ed.cc
+++ b/gtk2_ardour/ardour_ui_ed.cc
@@ -287,10 +287,6 @@ ARDOUR_UI::install_actions ()
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
- act = ActionManager::register_toggle_action (transport_actions, X_("AlwaysPlayRange"), _("Always Play Range"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_always_play_range));
- ActionManager::session_sensitive_actions.push_back (act);
- ActionManager::transport_sensitive_actions.push_back (act);
-
act = ActionManager::register_action (transport_actions, X_("ToggleRoll"), _("Start/Stop"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_roll), false, false));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
@@ -321,6 +317,9 @@ ARDOUR_UI::install_actions ()
act = ActionManager::register_action (transport_actions, X_("PlaySelection"), _("Play Selected Range"), sigc::mem_fun(*this, &ARDOUR_UI::transport_play_selection));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
+ act = ActionManager::register_action (transport_actions, X_("PlayPreroll"), _("Play Selection 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 = ActionManager::register_action (transport_actions, X_("Record"), _("Enable Record"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_record), false));
ActionManager::session_sensitive_actions.push_back (act);
@@ -406,6 +405,10 @@ ARDOUR_UI::install_actions ()
act = ActionManager::register_toggle_action (transport_actions, X_("ToggleAutoReturn"), _("Auto Return"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_auto_return));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
+ act = ActionManager::register_toggle_action (transport_actions, X_("ToggleFollowEdits"), _("Follow Edits"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_always_play_range));
+ ActionManager::session_sensitive_actions.push_back (act);
+ ActionManager::transport_sensitive_actions.push_back (act);
+
act = ActionManager::register_toggle_action (transport_actions, X_("ToggleVideoSync"), _("Sync Startup to Video"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_video_sync));
ActionManager::session_sensitive_actions.push_back (act);
diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc
index 8e0066da0d..8cfc787cee 100644
--- a/gtk2_ardour/ardour_ui_options.cc
+++ b/gtk2_ardour/ardour_ui_options.cc
@@ -330,7 +330,7 @@ ARDOUR_UI::parameter_changed (std::string p)
} else if (p == "always-play-range") {
- ActionManager::map_some_state ("Transport", "AlwaysPlayRange", &RCConfiguration::get_always_play_range);
+ ActionManager::map_some_state ("Transport", "ToggleFollowEdits", &RCConfiguration::get_always_play_range);
} else if (p == "send-mtc") {
diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc
index 8f3c87b00d..7e51d28997 100644
--- a/gtk2_ardour/audio_region_view.cc
+++ b/gtk2_ardour/audio_region_view.cc
@@ -768,6 +768,19 @@ AudioRegionView::reset_fade_out_shape_width (framecnt_t width)
}
}
+framepos_t
+AudioRegionView::get_fade_in_shape_width ()
+{
+ return audio_region()->fade_in()->back()->when;
+}
+
+framepos_t
+AudioRegionView::get_fade_out_shape_width ()
+{
+ return audio_region()->fade_out()->back()->when;
+}
+
+
void
AudioRegionView::set_samples_per_unit (gdouble spu)
{
diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h
index 5e3240670d..85a1b1d869 100644
--- a/gtk2_ardour/audio_region_view.h
+++ b/gtk2_ardour/audio_region_view.h
@@ -94,6 +94,9 @@ class AudioRegionView : public RegionView
void reset_fade_in_shape_width (framecnt_t);
void reset_fade_out_shape_width (framecnt_t);
+ framepos_t get_fade_in_shape_width ();
+ framepos_t get_fade_out_shape_width ();
+
void show_fade_line(framepos_t pos);
void hide_fade_line();
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 792da29170..330646a42d 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -794,6 +794,12 @@ Editor::add_toplevel_controls (Container& cont)
cont.show_all ();
}
+bool
+Editor::get_smart_mode () const
+{
+ return ( (current_mouse_mode() == Editing::MouseObject) && smart_mode_action->get_active() );
+}
+
void
Editor::catch_vanishing_regionview (RegionView *rv)
{
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 2075a53270..ca4a3ec87a 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -286,6 +286,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
bool extend_selection_to_track (TimeAxisView&);
void play_selection ();
+ framepos_t get_preroll ();
+ void maybe_locate_with_edit_preroll (framepos_t);
+ void play_with_preroll ();
void select_all_in_track (Selection::Operation op);
void select_all (Selection::Operation op);
void invert_selection_in_track ();
@@ -1673,6 +1676,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void marker_selection_changed ();
void cancel_selection ();
+ void cancel_time_selection ();
+
+ bool get_smart_mode() const;
bool audio_region_selection_covers (framepos_t where);
diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc
index 4b7d40cdce..40d6be0ba1 100644
--- a/gtk2_ardour/editor_canvas_events.cc
+++ b/gtk2_ardour/editor_canvas_events.cc
@@ -468,6 +468,7 @@ Editor::canvas_fade_in_handle_event (GdkEvent *event, ArdourCanvas::Item* item,
case GDK_BUTTON_RELEASE:
ret = button_release_handler (item, event, FadeInHandleItem);
+ maybe_locate_with_edit_preroll ( rv->region()->position() );
break;
case GDK_MOTION_NOTIFY:
@@ -549,6 +550,7 @@ Editor::canvas_fade_out_handle_event (GdkEvent *event, ArdourCanvas::Item* item,
case GDK_BUTTON_RELEASE:
ret = button_release_handler (item, event, FadeOutHandleItem);
+ maybe_locate_with_edit_preroll ( rv->region()->last_frame() - rv->get_fade_out_shape_width() );
break;
case GDK_MOTION_NOTIFY:
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index d06191d368..07971e4d22 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -1792,6 +1792,13 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred)
}
}
+ if (_operation == StartTrim) {
+ _editor->maybe_locate_with_edit_preroll ( _views.begin()->view->region()->position() );
+ }
+ if (_operation == EndTrim) {
+ _editor->maybe_locate_with_edit_preroll ( _views.begin()->view->region()->position() + _views.begin()->view->region()->length() );
+ }
+
if (!_editor->selection->selected (_primary)) {
_primary->thaw_after_trim ();
} else {
@@ -3641,11 +3648,6 @@ SelectionDrag::finished (GdkEvent* event, bool movement_occurred)
s->request_stop (false, false);
}
- if (Config->get_always_play_range()) {
- if (_editor->doing_range_stuff()) {
- s->request_locate (_editor->get_selection().time.start());
- }
- }
}
_editor->stop_canvas_autoscroll ();
diff --git a/gtk2_ardour/editor_imageframe.cc b/gtk2_ardour/editor_imageframe.cc
index 752e43a585..f4c8f1bb0b 100644
--- a/gtk2_ardour/editor_imageframe.cc
+++ b/gtk2_ardour/editor_imageframe.cc
@@ -603,7 +603,12 @@ Editor::timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent* even
//where = tavi->get_position() ;
}
-
+/*
+ //locate so user can audition the edit
+ if ( !session->transport_rolling() && Config->get_always_play_range()) {
+ locate_with_edit_preroll ( arv->region()->position() );
+ }
+*/
}
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 61e8b5d035..1096afad87 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -361,6 +361,25 @@ Editor::set_mouse_mode (MouseMode m, bool force)
tact->set_active (true);
MouseModeChanged (); /* EMIT SIGNAL */
+
+ if ( (mouse_mode != MouseRange) && (mouse_mode != MouseGain) ) {
+
+ cancel_time_selection(); //disable the range, because an invisible operating range can cause confusing operation
+
+ } else {
+
+ /*
+ in range mode,show the range selection.
+ */
+
+ cancel_selection();
+
+ for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
+ if ((*i)->get_selected()) {
+ (*i)->show_selection (selection->time);
+ }
+ }
+ }
}
void
@@ -1290,8 +1309,6 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
return true;
}
-
-
if (internal_editing()) {
bool leave_internal_edit_mode = false;
@@ -1344,6 +1361,13 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
return true;
}
+ //not rolling, range mode click + join_play_range : locate the PH here
+ if ( !_drags->active () && !_session->transport_rolling() && ( (mouse_mode == MouseRange) || _join_object_range_state == JOIN_OBJECT_RANGE_RANGE ) && Config->get_always_play_range() ) {
+ framepos_t where = event_frame (event, 0, 0);
+ snap_to(where);
+ _session->request_locate (where, false);
+ }
+
switch (event->button.button) {
case 1:
return button_press_handler_1 (item, event, item_type);
@@ -1415,7 +1439,17 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
were_dragging = true;
}
- update_region_layering_order_editor ();
+ //a mouse click (no drag) in the range area of an audio track. maybe locate the playhead here
+ if ( !_drags->active () && (effective_mouse_mode() == MouseRange) && Config->get_always_play_range() && (item_type != AutomationTrackItem) && !Keyboard::is_context_menu_event (&event->button)) {
+ if ( _join_object_range_state == JOIN_OBJECT_RANGE_RANGE ) {
+ framepos_t pos = event_frame (event, 0, 0);
+ snap_to(pos);
+ _session->request_locate (pos, false);
+ return true;
+ }
+ }
+
+ update_region_layering_order_editor ();
/* edit events get handled here */
@@ -2412,6 +2446,15 @@ Editor::cancel_selection ()
clicked_selection = 0;
}
+void
+Editor::cancel_time_selection ()
+{
+ for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
+ (*i)->hide_selection ();
+ }
+ selection->time.clear ();
+ clicked_selection = 0;
+}
void
Editor::point_trim (GdkEvent* event, framepos_t new_bound)
@@ -2795,10 +2838,8 @@ Editor::update_join_object_range_location (double /*x*/, double y)
rtv->canvas_display()->w2i (cx, cy);
double const c = cy / (rtv->view()->child_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE);
- double d;
- double const f = modf (c, &d);
- _join_object_range_state = f < 0.5 ? JOIN_OBJECT_RANGE_RANGE : JOIN_OBJECT_RANGE_OBJECT;
+ _join_object_range_state = c <= 0.5 ? JOIN_OBJECT_RANGE_RANGE : JOIN_OBJECT_RANGE_OBJECT;
}
}
}
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 5e2e2081b4..92b986d0d1 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -2169,6 +2169,55 @@ Editor::play_selection ()
_session->request_play_range (&selection->time, true);
}
+framepos_t
+Editor::get_preroll ()
+{
+ return 1.0 /*Config->get_edit_preroll_seconds()*/ * _session->frame_rate();
+}
+
+
+void
+Editor::maybe_locate_with_edit_preroll ( framepos_t location )
+{
+ if ( _session->transport_rolling() || !Config->get_always_play_range() )
+ return;
+
+ location -= get_preroll();
+
+ //don't try to locate before the beginning of time
+ if ( location < 0 )
+ location = 0;
+
+ //if follow_playhead is on, keep the playhead on the screen
+ if ( _follow_playhead )
+ if ( location < leftmost_frame )
+ location = leftmost_frame;
+
+ _session->request_locate( location );
+}
+
+void
+Editor::play_with_preroll ()
+{
+ if (selection->time.empty()) {
+ return;
+ } else {
+ framepos_t preroll = get_preroll();
+
+ framepos_t start = 0;
+ if (selection->time[clicked_selection].start > preroll)
+ start = selection->time[clicked_selection].start - preroll;
+
+ framepos_t end = selection->time[clicked_selection].end + preroll;
+
+ AudioRange ar (start, end, 0);
+ list<AudioRange> lar;
+ lar.push_back (ar);
+
+ _session->request_play_range (&lar, true);
+ }
+}
+
void
Editor::play_location (Location& location)
{
@@ -3237,8 +3286,10 @@ Editor::trim_region (bool front)
if (front) {
(*i)->region()->trim_front (where);
+ maybe_locate_with_edit_preroll ( where );
} else {
(*i)->region()->trim_end (where);
+ maybe_locate_with_edit_preroll ( where );
}
_session->add_command (new StatefulDiffCommand ((*i)->region()));
@@ -5384,6 +5435,9 @@ Editor::set_playhead_cursor ()
_session->request_locate (where, _session->transport_rolling());
}
}
+
+ if ( Config->get_always_play_range() )
+ cancel_time_selection();
}
void
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index b5d2cd7b6e..84256aa130 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -210,6 +210,8 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
virtual void track_mixer_selection () = 0;
virtual bool extend_selection_to_track (TimeAxisView&) = 0;
virtual void play_selection () = 0;
+ virtual void play_with_preroll () = 0;
+ virtual void maybe_locate_with_edit_preroll (framepos_t location) = 0;
virtual void set_show_measures (bool yn) = 0;
virtual bool show_measures () const = 0;
virtual bool redraw_measures () = 0;
@@ -390,6 +392,8 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
virtual MouseCursors const * cursors () const = 0;
virtual VerboseCursor * verbose_cursor () const = 0;
+ virtual bool get_smart_mode () const = 0;
+
virtual void get_pointer_position (double &, double &) const = 0;
virtual ARDOUR::Location* find_location_from_marker (Marker *, bool &) const = 0;