ActionManager::register_action (common_actions, X_("Forums"), _("User Forums"), mem_fun(*this, &ARDOUR_UI::launch_forums));
ActionManager::register_action (common_actions, X_("Howto_Report"), _("How to report a bug"), mem_fun(*this, &ARDOUR_UI::launch_howto_report));
- act = ActionManager::register_action (common_actions, X_("Save"), _("Save"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::save_state), string(""), false));
+ act = ActionManager::register_action (common_actions, X_("Save"), _("Save"), sigc::hide_return (sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::save_state), string(""), false)));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::write_sensitive_actions.push_back (act);
if (press)
goto out;
else {
- get_equivalent_regions(clicked_regionview, all_equivalent_regions, ARDOUR::Properties::select.property_id);
- selection->set(all_equivalent_regions);
- commit = true;
+ if (selection->regions.size() > 1) {
+ /* collapse region selection down to just this one region (and its equivalents) */
+ get_equivalent_regions(clicked_regionview, all_equivalent_regions, ARDOUR::Properties::select.property_id);
+ selection->set(all_equivalent_regions);
+ commit = true;
+ }
}
}
break;
} else {
ActionManager::set_sensitive (ActionManager::time_selection_sensitive_actions, true);
}
+
+ /* propagate into backend */
+
+ if (_session) {
+ if (selection->time.length() != 0) {
+ _session->set_range_selection (selection->time.start(), selection->time.end_frame());
+ } else {
+ _session->clear_range_selection ();
+ }
+ }
}
/** Set all region actions to have a given sensitivity */
if (_session && !_session->transport_rolling() && !selection->regions.empty()) {
maybe_locate_with_edit_preroll (selection->regions.start());
}
+
+ /* propagate into backend */
+
+ if (_session) {
+ if (!selection->regions.empty()) {
+ _session->set_object_selection (selection->regions.start(), selection->regions.end_frame());
+ } else {
+ _session->clear_object_selection ();
+ }
+ }
+
}
void
CONFIG_VARIABLE (float, shuttle_max_speed, "shuttle-max-speed", 8.0f)
CONFIG_VARIABLE (bool, locate_while_waiting_for_sync, "locate-while-waiting-for-sync", false)
CONFIG_VARIABLE (bool, disable_disarm_during_roll, "disable-disarm-during-roll", false)
+CONFIG_VARIABLE (AutoReturnTarget, auto_return_target_list, "auto-return-target-list", AutoReturnTarget(LastLocate|RangeSelectionStart|Loop|RegionSelectionStart))
/* metering */
void maybe_update_session_range (framepos_t, framepos_t);
+ /* temporary hacks to allow selection to be pushed from GUI into backend.
+ Whenever we move the selection object into libardour, these will go away.
+ */
+ void set_range_selection (framepos_t start, framepos_t end);
+ void set_object_selection (framepos_t start, framepos_t end);
+ void clear_range_selection ();
+ void clear_object_selection ();
+
/* buffers for gain and pan */
gain_t* gain_automation_buffer () const;
void engine_halted ();
void xrun_recovery ();
void set_track_loop (bool);
+ bool select_playhead_priority_target (framepos_t&);
+ void follow_playhead_priority ();
/* These are synchronous and so can only be called from within the process
* cycle
void set_play_range (std::list<AudioRange>&, bool leave_rolling);
void unset_play_range ();
+ /* temporary hacks to allow selection to be pushed from GUI into backend
+ Whenever we move the selection object into libardour, these will go away.
+ */
+ Evoral::Range<framepos_t> _range_selection;
+ Evoral::Range<framepos_t> _object_selection;
+
/* main outs */
uint32_t main_outs;
Custom,
};
+ enum AutoReturnTarget {
+ LastLocate = 0x1,
+ RangeSelectionStart = 0x2,
+ Loop = 0x4,
+ RegionSelectionStart = 0x8,
+ };
+
} // namespace ARDOUR
std::istream& operator>>(std::istream& o, ARDOUR::FadeShape& sf);
std::istream& operator>>(std::istream& o, ARDOUR::RegionSelectionAfterSplit& sf);
std::istream& operator>>(std::istream& o, ARDOUR::BufferingPreset& var);
+std::istream& operator>>(std::istream& o, ARDOUR::AutoReturnTarget& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::SampleFormat& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::HeaderFormat& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::FadeShape& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::RegionSelectionAfterSplit& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::BufferingPreset& var);
-
+std::ostream& operator<<(std::ostream& o, const ARDOUR::AutoReturnTarget& sf);
/* because these operators work on types which can be used when making
a UI_CONFIG_VARIABLE (in gtk2_ardour) we need them to be exported.
MTC_Status _MIDI_MTC_Status;
Evoral::OverlapType _OverlapType;
BufferingPreset _BufferingPreset;
-
+ AutoReturnTarget _AutoReturnTarget;
+
#define REGISTER(e) enum_writer.register_distinct (typeid(e).name(), i, s); i.clear(); s.clear()
#define REGISTER_BITS(e) enum_writer.register_bits (typeid(e).name(), i, s); i.clear(); s.clear()
#define REGISTER_ENUM(e) i.push_back (e); s.push_back (#e)
REGISTER_ENUM (Large);
REGISTER_ENUM (Custom);
REGISTER(_BufferingPreset);
+
+ REGISTER_ENUM (LastLocate);
+ REGISTER_ENUM (RangeSelectionStart);
+ REGISTER_ENUM (Loop);
+ REGISTER_ENUM (RegionSelectionStart);
+ REGISTER_BITS (_AutoReturnTarget);
}
} /* namespace ARDOUR */
std::string s = enum_2_string (var);
return o << s;
}
+
+std::istream& operator>>(std::istream& o, AutoReturnTarget& var)
+{
+ std::string s;
+ o >> s;
+ var = (AutoReturnTarget) string_2_enum (s, var);
+ return o;
+}
+
+std::ostream& operator<<(std::ostream& o, const AutoReturnTarget& var)
+{
+ std::string s = enum_2_string (var);
+ return o << s;
+}
+
+
, click_emphasis_length (0)
, _clicks_cleared (0)
, _play_range (false)
+ , _range_selection (-1,-1)
+ , _object_selection (-1,-1)
, main_outs (0)
, first_file_data_format_reset (true)
, first_file_header_format_reset (true)
#endif
}
}
+
+void
+Session::set_range_selection (framepos_t start, framepos_t end)
+{
+ cerr << "set range selection " << start << " .. " << end << endl;
+ _range_selection = Evoral::Range<framepos_t> (start, end);
+ follow_playhead_priority ();
+}
+
+void
+Session::set_object_selection (framepos_t start, framepos_t end)
+{
+ _object_selection = Evoral::Range<framepos_t> (start, end);
+ follow_playhead_priority ();
+}
+
+void
+Session::clear_range_selection ()
+{
+ _range_selection = Evoral::Range<framepos_t> (-1,-1);
+ follow_playhead_priority ();
+}
+
+void
+Session::clear_object_selection ()
+{
+ _object_selection = Evoral::Range<framepos_t> (-1,-1);
+ follow_playhead_priority ();
+}
clear_clicks ();
}
+bool
+Session::select_playhead_priority_target (framepos_t& jump_to)
+{
+ jump_to = -1;
+
+ AutoReturnTarget autoreturn = Config->get_auto_return_target_list ();
+
+ if (!autoreturn) {
+ return false;
+ }
+
+ /* Note that the order of checking each AutoReturnTarget flag defines
+ the priority each flag.
+ */
+
+ if (autoreturn & LastLocate) {
+ jump_to = _last_roll_location;
+ }
+
+ if (jump_to < 0 && (autoreturn & RangeSelectionStart)) {
+ if (!_range_selection.empty()) {
+ jump_to = _range_selection.from;
+ }
+ }
+
+ if (jump_to < 0 && (autoreturn & Loop)) {
+ /* don't try to handle loop play when synced to JACK */
+
+ if (!synced_to_engine()) {
+ Location *location = _locations->auto_loop_location();
+
+ if (location) {
+ jump_to = location->start();
+ }
+ }
+ }
+
+ if (jump_to < 0 && (autoreturn & RegionSelectionStart)) {
+ if (!_object_selection.empty()) {
+ jump_to = _object_selection.from;
+ }
+ }
+
+ return jump_to >= 0;
+}
+
+void
+Session::follow_playhead_priority ()
+{
+ framepos_t target;
+
+ if (select_playhead_priority_target (target)) {
+ request_locate (target);
+ }
+}
+
void
Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
{
update_latency_compensation ();
}
- bool const auto_return_enabled =
- (!config.get_external_sync() && (config.get_auto_return() || abort));
+ bool const auto_return_enabled = (!config.get_external_sync() && (Config->get_auto_return_target_list() || abort));
if (auto_return_enabled ||
(ptw & PostTransportLocate) ||
do_locate = true;
} else {
- if (config.get_auto_return()) {
-
- if (play_loop) {
-
- /* don't try to handle loop play when synced to JACK */
+ framepos_t jump_to;
- if (!synced_to_engine()) {
+ if (select_playhead_priority_target (jump_to)) {
- Location *location = _locations->auto_loop_location();
-
- if (location != 0) {
- _transport_frame = location->start();
- } else {
- _transport_frame = _last_roll_location;
- }
- do_locate = true;
- }
-
- } else if (_play_range) {
-
- /* return to start of range */
-
- if (!current_audio_range.empty()) {
- _transport_frame = current_audio_range.front().start;
- do_locate = true;
- }
-
- } else {
-
- /* regular auto-return */
+ _transport_frame = jump_to;
+ do_locate = true;
- _transport_frame = _last_roll_location;
- do_locate = true;
- }
} else if (abort) {
_transport_frame = _last_roll_location;
}
_engine.transport_stop ();
} else {
- bool const auto_return_enabled = (!config.get_external_sync() && (config.get_auto_return() || abort));
+ bool const auto_return_enabled = (!config.get_external_sync() && (Config->get_auto_return_target_list() || abort));
if (!auto_return_enabled) {
_requested_return_frame = destination_frame;
<Option name="video-server-docroot" value="/"/>
<Option name="show-video-export-info" value="1"/>
<Option name="show-video-server-dialog" value="0"/>
+ <Option name="auto-return-target-list" value="RangeSelectionStart,Loop,RegionSelectionStart"/>
</Config>
<Metadata/>
<ControlProtocols/>