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
This commit is contained in:
Ben Loftis 2012-11-20 19:43:43 +00:00
parent 38c10a4d23
commit beb3ec2d7a
16 changed files with 193 additions and 52 deletions

View file

@ -60,6 +60,7 @@
<menuitem action='main-menu-play-selected-regions'/> <menuitem action='main-menu-play-selected-regions'/>
<menuitem action='play-edit-range'/> <menuitem action='play-edit-range'/>
<menuitem action='PlaySelection'/> <menuitem action='PlaySelection'/>
<menuitem action='PlayPreroll'/>
<menuitem action='play-from-edit-point-and-return'/> <menuitem action='play-from-edit-point-and-return'/>
<menuitem action='Loop'/> <menuitem action='Loop'/>
</menu> </menu>
@ -144,6 +145,7 @@
<menuitem action='TogglePunchIn'/> <menuitem action='TogglePunchIn'/>
<menuitem action='TogglePunchOut'/> <menuitem action='TogglePunchOut'/>
<menuitem action='ToggleAutoInput'/> <menuitem action='ToggleAutoInput'/>
<menuitem action='ToggleFollowEdits'/>
<menuitem action='ToggleAutoPlay'/> <menuitem action='ToggleAutoPlay'/>
<menuitem action='ToggleAutoReturn'/> <menuitem action='ToggleAutoReturn'/>
<menuitem action='ToggleClick'/> <menuitem action='ToggleClick'/>

View file

@ -151,7 +151,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
, rec_controllable (new TransportControllable ("transport rec-enable", *this, TransportControllable::RecordEnable)) , rec_controllable (new TransportControllable ("transport rec-enable", *this, TransportControllable::RecordEnable))
, auto_return_button (ArdourButton::led_default_elements) , 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) , auto_input_button (ArdourButton::led_default_elements)
, auditioning_alert_button (_("audition")) , auditioning_alert_button (_("audition"))
@ -204,9 +204,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
original_big_clock_height = -1; original_big_clock_height = -1;
original_big_clock_font_size = 0; 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); roll_button.set_controllable (roll_controllable);
stop_button.set_controllable (stop_controllable); stop_button.set_controllable (stop_controllable);
goto_start_button.set_controllable (goto_start_controllable); goto_start_button.set_controllable (goto_start_controllable);
@ -1625,7 +1622,7 @@ ARDOUR_UI::transport_roll ()
_session->request_play_range (0, true); _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); _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 void
ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode) 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) { if (rolling) {
_session->request_stop (with_abort, true); _session->request_stop (with_abort, true);
} else { } 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); _session->request_play_range (&editor->get_selection().time, true);
} }
@ -1730,6 +1734,15 @@ ARDOUR_UI::transport_play_selection ()
editor->play_selection (); editor->play_selection ();
} }
void
ARDOUR_UI::transport_play_preroll ()
{
if (!_session) {
return;
}
editor->play_with_preroll ();
}
void void
ARDOUR_UI::transport_rewind (int option) ARDOUR_UI::transport_rewind (int option)
{ {

View file

@ -140,6 +140,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
ARDOUR::Session* the_session() { return _session; } 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 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); 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); 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 play_selection_button;
ArdourButton rec_button; ArdourButton rec_button;
ButtonJoiner* transport_joiner;
void toggle_external_sync (); void toggle_external_sync ();
void toggle_time_master (); void toggle_time_master ();
void toggle_video_sync (); void toggle_video_sync ();
@ -427,7 +427,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
ShuttleControl* shuttle_box; ShuttleControl* shuttle_box;
ArdourButton auto_return_button; ArdourButton auto_return_button;
ArdourButton auto_play_button; ArdourButton follow_edits_button;
ArdourButton auto_input_button; ArdourButton auto_input_button;
ArdourButton click_button; ArdourButton click_button;
ArdourButton sync_button; ArdourButton sync_button;
@ -546,6 +546,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void transport_record (bool roll); void transport_record (bool roll);
void transport_roll (); void transport_roll ();
void transport_play_selection(); void transport_play_selection();
void transport_play_preroll();
void transport_forward (int option); void transport_forward (int option);
void transport_rewind (int option); void transport_rewind (int option);
void transport_loop (); void transport_loop ();

View file

@ -133,9 +133,8 @@ ARDOUR_UI::setup_tooltips ()
set_tip (goto_end_button, _("Go to end of session")); set_tip (goto_end_button, _("Go to end of session"));
set_tip (auto_loop_button, _("Play loop range")); 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 (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_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 (auto_input_button, _("Be sensible about input monitoring"));
set_tip (click_button, _("Enable/Disable audio click")); set_tip (click_button, _("Enable/Disable audio click"));
set_tip (solo_alert_button, _("When active, something is soloed.\nClick to de-solo everything")); 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)); static_cast<Widget*> (&transport_frame), 1));
auto_return_button.set_text(_("Auto Return")); 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")); auto_input_button.set_text (_("Auto Input"));
click_button.set_image (get_icon (X_("metronome"))); 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); 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_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"); auto_input_button.set_name ("transport option button");
/* these have to provide a clear indication of active state */ /* 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")); act = ActionManager::get_action (X_("Transport"), X_("ToggleExternalSync"));
sync_button.set_related_action (act); 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. */ /* clocks, etc. */
ARDOUR_UI::Clock.connect (sigc::mem_fun (primary_clock, &AudioClock::set)); 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"); act = ActionManager::get_action ("Transport", "ToggleAutoReturn");
auto_return_button.set_related_action (act); auto_return_button.set_related_action (act);
act = ActionManager::get_action ("Transport", "ToggleAutoPlay"); act = ActionManager::get_action (X_("Transport"), X_("ToggleFollowEdits"));
auto_play_button.set_related_action (act); follow_edits_button.set_related_action (act);
act = ActionManager::get_action ("Transport", "ToggleAutoInput"); act = ActionManager::get_action ("Transport", "ToggleAutoInput");
auto_input_button.set_related_action (act); auto_input_button.set_related_action (act);
@ -344,20 +338,16 @@ ARDOUR_UI::setup_transport ()
HBox* tbox1 = manage (new HBox); HBox* tbox1 = manage (new HBox);
HBox* tbox2 = manage (new HBox); HBox* tbox2 = manage (new HBox);
HBox* tbox3 = manage (new HBox);
HBox* tbox = manage (new HBox); HBox* tbox = manage (new HBox);
VBox* vbox1 = manage (new VBox); VBox* vbox1 = manage (new VBox);
VBox* vbox2 = manage (new VBox); VBox* vbox2 = manage (new VBox);
VBox* vbox3 = manage (new VBox);
Alignment* a1 = manage (new Alignment); Alignment* a1 = manage (new Alignment);
Alignment* a2 = manage (new Alignment); Alignment* a2 = manage (new Alignment);
Alignment* a3 = manage (new Alignment);
tbox1->set_spacing (2); tbox1->set_spacing (2);
tbox2->set_spacing (2); tbox2->set_spacing (2);
tbox3->set_spacing (2);
tbox->set_spacing (2); tbox->set_spacing (2);
tbox1->pack_start (click_button, false, false, 5); 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 */ play_selection_button.set_rounded_corner_mask (0x1); /* upper left only */
roll_button.set_rounded_corner_mask (0x2); /* upper right only */ roll_button.set_rounded_corner_mask (0x2); /* upper right only */
tbox2->pack_start (*transport_joiner, false, false); tbox2->pack_start (play_selection_button, false, false);
tbox2->pack_start (roll_button, false, false);
tbox3->pack_start (stop_button, false, false); tbox2->pack_start (stop_button, false, false);
tbox3->pack_start (rec_button, false, false, 6); tbox2->pack_start (rec_button, false, false, 5);
vbox1->pack_start (*tbox1, false, false); vbox1->pack_start (*tbox1, false, false);
vbox2->pack_start (*tbox2, false, false); vbox2->pack_start (*tbox2, false, false);
vbox3->pack_start (*tbox3, false, false);
a1->add (*vbox1); a1->add (*vbox1);
a1->set (0.5, 1.0, 0.0, 0.0); a1->set (0.5, 1.0, 0.0, 0.0);
a2->add (*vbox2); a2->add (*vbox2);
a2->set (0.5, 1.0, 0.0, 0.0); 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 (*a1, false, false);
tbox->pack_start (*a2, false, false); tbox->pack_start (*a2, false, false);
tbox->pack_start (*a3, false, false);
HBox* clock_box = manage (new HBox); HBox* clock_box = manage (new HBox);
@ -415,7 +401,7 @@ ARDOUR_UI::setup_transport ()
auto_box->set_homogeneous (true); auto_box->set_homogeneous (true);
auto_box->set_spacing (2); auto_box->set_spacing (2);
auto_box->pack_start (sync_button, false, false); 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); auto_box->pack_start (auto_return_button, false, false);
transport_tearoff_hbox.pack_start (*auto_box, false, false); transport_tearoff_hbox.pack_start (*auto_box, false, false);
@ -649,7 +635,7 @@ ARDOUR_UI::click_button_clicked (GdkEventButton* ev)
void void
ARDOUR_UI::toggle_always_play_range () 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); assert (act);
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act); RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act);

View file

@ -287,10 +287,6 @@ ARDOUR_UI::install_actions ()
ActionManager::session_sensitive_actions.push_back (act); ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_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)); 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::session_sensitive_actions.push_back (act);
ActionManager::transport_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)); 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::session_sensitive_actions.push_back (act);
ActionManager::transport_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)); 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); 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)); 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::session_sensitive_actions.push_back (act);
ActionManager::transport_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)); 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); ActionManager::session_sensitive_actions.push_back (act);

View file

@ -330,7 +330,7 @@ ARDOUR_UI::parameter_changed (std::string p)
} else if (p == "always-play-range") { } 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") { } else if (p == "send-mtc") {

View file

@ -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 void
AudioRegionView::set_samples_per_unit (gdouble spu) AudioRegionView::set_samples_per_unit (gdouble spu)
{ {

View file

@ -94,6 +94,9 @@ class AudioRegionView : public RegionView
void reset_fade_in_shape_width (framecnt_t); void reset_fade_in_shape_width (framecnt_t);
void reset_fade_out_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 show_fade_line(framepos_t pos);
void hide_fade_line(); void hide_fade_line();

View file

@ -794,6 +794,12 @@ Editor::add_toplevel_controls (Container& cont)
cont.show_all (); cont.show_all ();
} }
bool
Editor::get_smart_mode () const
{
return ( (current_mouse_mode() == Editing::MouseObject) && smart_mode_action->get_active() );
}
void void
Editor::catch_vanishing_regionview (RegionView *rv) Editor::catch_vanishing_regionview (RegionView *rv)
{ {

View file

@ -286,6 +286,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
bool extend_selection_to_track (TimeAxisView&); bool extend_selection_to_track (TimeAxisView&);
void play_selection (); 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_in_track (Selection::Operation op);
void select_all (Selection::Operation op); void select_all (Selection::Operation op);
void invert_selection_in_track (); void invert_selection_in_track ();
@ -1673,6 +1676,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void marker_selection_changed (); void marker_selection_changed ();
void cancel_selection (); void cancel_selection ();
void cancel_time_selection ();
bool get_smart_mode() const;
bool audio_region_selection_covers (framepos_t where); bool audio_region_selection_covers (framepos_t where);

View file

@ -468,6 +468,7 @@ Editor::canvas_fade_in_handle_event (GdkEvent *event, ArdourCanvas::Item* item,
case GDK_BUTTON_RELEASE: case GDK_BUTTON_RELEASE:
ret = button_release_handler (item, event, FadeInHandleItem); ret = button_release_handler (item, event, FadeInHandleItem);
maybe_locate_with_edit_preroll ( rv->region()->position() );
break; break;
case GDK_MOTION_NOTIFY: case GDK_MOTION_NOTIFY:
@ -549,6 +550,7 @@ Editor::canvas_fade_out_handle_event (GdkEvent *event, ArdourCanvas::Item* item,
case GDK_BUTTON_RELEASE: case GDK_BUTTON_RELEASE:
ret = button_release_handler (item, event, FadeOutHandleItem); ret = button_release_handler (item, event, FadeOutHandleItem);
maybe_locate_with_edit_preroll ( rv->region()->last_frame() - rv->get_fade_out_shape_width() );
break; break;
case GDK_MOTION_NOTIFY: case GDK_MOTION_NOTIFY:

View file

@ -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)) { if (!_editor->selection->selected (_primary)) {
_primary->thaw_after_trim (); _primary->thaw_after_trim ();
} else { } else {
@ -3641,11 +3648,6 @@ SelectionDrag::finished (GdkEvent* event, bool movement_occurred)
s->request_stop (false, false); 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 (); _editor->stop_canvas_autoscroll ();

View file

@ -603,7 +603,12 @@ Editor::timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent* even
//where = tavi->get_position() ; //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() );
}
*/
} }

View file

@ -361,6 +361,25 @@ Editor::set_mouse_mode (MouseMode m, bool force)
tact->set_active (true); tact->set_active (true);
MouseModeChanged (); /* EMIT SIGNAL */ 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 void
@ -1290,8 +1309,6 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
return true; return true;
} }
if (internal_editing()) { if (internal_editing()) {
bool leave_internal_edit_mode = false; bool leave_internal_edit_mode = false;
@ -1344,6 +1361,13 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
return true; 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) { switch (event->button.button) {
case 1: case 1:
return button_press_handler_1 (item, event, item_type); return button_press_handler_1 (item, event, item_type);
@ -1415,6 +1439,16 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
were_dragging = true; were_dragging = true;
} }
//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 (); update_region_layering_order_editor ();
/* edit events get handled here */ /* edit events get handled here */
@ -2412,6 +2446,15 @@ Editor::cancel_selection ()
clicked_selection = 0; 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 void
Editor::point_trim (GdkEvent* event, framepos_t new_bound) 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); rtv->canvas_display()->w2i (cx, cy);
double const c = cy / (rtv->view()->child_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE); 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;
} }
} }
} }

View file

@ -2169,6 +2169,55 @@ Editor::play_selection ()
_session->request_play_range (&selection->time, true); _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 void
Editor::play_location (Location& location) Editor::play_location (Location& location)
{ {
@ -3237,8 +3286,10 @@ Editor::trim_region (bool front)
if (front) { if (front) {
(*i)->region()->trim_front (where); (*i)->region()->trim_front (where);
maybe_locate_with_edit_preroll ( where );
} else { } else {
(*i)->region()->trim_end (where); (*i)->region()->trim_end (where);
maybe_locate_with_edit_preroll ( where );
} }
_session->add_command (new StatefulDiffCommand ((*i)->region())); _session->add_command (new StatefulDiffCommand ((*i)->region()));
@ -5384,6 +5435,9 @@ Editor::set_playhead_cursor ()
_session->request_locate (where, _session->transport_rolling()); _session->request_locate (where, _session->transport_rolling());
} }
} }
if ( Config->get_always_play_range() )
cancel_time_selection();
} }
void void

View file

@ -210,6 +210,8 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
virtual void track_mixer_selection () = 0; virtual void track_mixer_selection () = 0;
virtual bool extend_selection_to_track (TimeAxisView&) = 0; virtual bool extend_selection_to_track (TimeAxisView&) = 0;
virtual void play_selection () = 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 void set_show_measures (bool yn) = 0;
virtual bool show_measures () const = 0; virtual bool show_measures () const = 0;
virtual bool redraw_measures () = 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 MouseCursors const * cursors () const = 0;
virtual VerboseCursor * verbose_cursor () 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 void get_pointer_position (double &, double &) const = 0;
virtual ARDOUR::Location* find_location_from_marker (Marker *, bool &) const = 0; virtual ARDOUR::Location* find_location_from_marker (Marker *, bool &) const = 0;