diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-03-11 16:01:06 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-03-11 16:01:06 +0000 |
commit | ddfc8d2185ec9cef7afe74091ea544ec286f13a8 (patch) | |
tree | 03cd195a2624e7389c2ed1e3f1fa40e43bf68345 | |
parent | b6f309bb85307d36b6fa1eaea2e7178066cb3f38 (diff) |
start marker implemented, along with GotoZero command for old behaviour; R binding for global rec-enable now works (menu item added)
git-svn-id: svn://localhost/trunk/ardour2@376 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/ardour.bindings | 1 | ||||
-rw-r--r-- | gtk2_ardour/ardour.menus | 3 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 17 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 8 | ||||
-rw-r--r-- | libs/ardour/ardour/location.h | 6 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 4 | ||||
-rw-r--r-- | libs/ardour/location.cc | 19 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 16 |
10 files changed, 70 insertions, 8 deletions
diff --git a/gtk2_ardour/ardour.bindings b/gtk2_ardour/ardour.bindings index 7992e4db1d..556fdb1311 100644 --- a/gtk2_ardour/ardour.bindings +++ b/gtk2_ardour/ardour.bindings @@ -4,6 +4,7 @@ (gtk_accel_path "<Actions>/Transport/ToggleRollForgetCapture" "<control>space") (gtk_accel_path "<Actions>/Transport/Forward" "<control>Right") (gtk_accel_path "<Actions>/Transport/Rewind" "<control>Left") +(gtk_accel_path "<Actions>/Transport/GotoZero" "KP_Insert") (gtk_accel_path "<Actions>/Transport/GotoStart" "Home") (gtk_accel_path "<Actions>/Transport/GotoEnd" "End") diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index 372b4fcee2..c4603f060e 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -33,8 +33,11 @@ <menuitem action='PlaySelection'/> <menuitem action='Forward'/> <menuitem action='Rewind'/> + <menuitem action='GotoZero'/> <menuitem action='GotoStart'/> <menuitem action='GotoEnd'/> + <separator/> + <menuitem action='Record'/> <separator/> <menuitem action='jump-forward-to-mark'/> <menuitem action='jump-backward-to-mark'/> diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index b9f00340db..72bc9948ee 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -975,6 +975,23 @@ void ARDOUR_UI::transport_goto_start () { if (session) { + session->goto_start(); + + + /* force displayed area in editor to start no matter + what "follow playhead" setting is. + */ + + if (editor) { + editor->reposition_x_origin (session->current_start_frame()); + } + } +} + +void +ARDOUR_UI::transport_goto_zero () +{ + if (session) { session->request_locate (0); diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 7dc7226c7a..03a8433634 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -540,6 +540,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI void remove_last_capture (); + void transport_goto_zero (); void transport_goto_start (); void transport_goto_end (); void transport_stop (); diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 2a7c4acf93..e835c8c2ea 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -245,6 +245,9 @@ ARDOUR_UI::install_actions () act = ActionManager::register_action (transport_actions, X_("ForwardFast"), _("Forward (Fast)"), bind (mem_fun(*this, &ARDOUR_UI::transport_forward), 1)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); + act = ActionManager::register_action (transport_actions, X_("GotoZero"), _("Goto Zero"), mem_fun(*this, &ARDOUR_UI::transport_goto_zero)); + ActionManager::session_sensitive_actions.push_back (act); + ActionManager::transport_sensitive_actions.push_back (act); act = ActionManager::register_action (transport_actions, X_("GotoStart"), _("Goto Start"), mem_fun(*this, &ARDOUR_UI::transport_goto_start)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 1e79086804..ea24f3cae7 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -398,7 +398,7 @@ Editor::nudge_backward (bool next) if (playhead_cursor->current_frame > distance) { session->request_locate (playhead_cursor->current_frame - distance); } else { - session->request_locate (0); + session->goto_start(); } } } @@ -464,7 +464,7 @@ Editor::nudge_backward_capture_offset () void Editor::move_to_start () { - session->request_locate (0); + session->goto_start (); } void @@ -1528,7 +1528,7 @@ Editor::jump_backward_to_mark () if (location) { session->request_locate (location->start(), session->transport_rolling()); } else { - session->request_locate (0); + session->goto_start (); } } @@ -1732,7 +1732,7 @@ Editor::toggle_playback (bool with_abort) void Editor::play_from_start () { - session->request_locate (0, true); + session->request_locate (session->current_start_frame(), true); } void diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index 3728d0b346..ee55adb600 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -51,7 +51,8 @@ class Location : public Stateful, public sigc::trackable IsHidden = 0x8, IsCDMarker = 0x10, IsEnd = 0x20, - IsRangeMarker = 0x40 + IsRangeMarker = 0x40, + IsStart = 0x80 }; Location (jack_nframes_t sample_start, @@ -89,6 +90,7 @@ class Location : public Stateful, public sigc::trackable void set_hidden (bool yn, void *src); void set_cd (bool yn, void *src); void set_is_end (bool yn, void* src); + void set_is_start (bool yn, void* src); bool is_auto_punch () { return _flags & IsAutoPunch; } bool is_auto_loop () { return _flags & IsAutoLoop; } @@ -96,6 +98,7 @@ class Location : public Stateful, public sigc::trackable bool is_hidden () { return _flags & IsHidden; } bool is_cd_marker () { return _flags & IsCDMarker; } bool is_end() { return _flags & IsEnd; } + bool is_start() { return _flags & IsStart; } bool is_range_marker() { return _flags & IsRangeMarker; } sigc::signal<void,Location*> name_changed; @@ -146,6 +149,7 @@ class Locations : public Stateful, public StateManager Location* auto_loop_location () const; Location* auto_punch_location () const; Location* end_location() const; + Location* start_location() const; uint32_t num_range_markers() const; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 6756bbe992..d0da2fef26 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -353,7 +353,7 @@ class Session : public sigc::trackable, public Stateful void request_auto_loop (bool yn); jack_nframes_t last_transport_start() const { return _last_roll_location; } void goto_end () { request_locate (end_location->start(), false);} - void goto_start () { request_locate (0, false); } + void goto_start () { request_locate (start_location->start(), false); } void use_rf_shuttle_speed (); void request_transport_speed (float speed); void request_overwrite_buffer (DiskStream*); @@ -366,6 +366,7 @@ class Session : public sigc::trackable, public Stateful int remove_region_from_region_list (Region&); jack_nframes_t current_end_frame() const { return end_location->start(); } + jack_nframes_t current_start_frame() const { return start_location->start(); } jack_nframes_t frame_rate() const { return _current_frame_rate; } double frames_per_smpte_frame() const { return _frames_per_smpte_frame; } jack_nframes_t frames_per_hour() const { return _frames_per_hour; } @@ -1002,6 +1003,7 @@ class Session : public sigc::trackable, public Stateful atomic_t _record_status; jack_nframes_t _transport_frame; Location* end_location; + Location* start_location; Slave *_slave; SlaveSource _slave_type; volatile float _transport_speed; diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 972384cc32..f4eea2cfc5 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -155,6 +155,14 @@ Location::set_is_end (bool yn, void *src) } void +Location::set_is_start (bool yn, void *src) +{ + if (set_flag_internal (yn, IsStart)) { + FlagsChanged (this, src); /* EMIT SIGNAL */ + } +} + +void Location::set_auto_punch (bool yn, void *src) { if (is_mark() || _start == _end) { @@ -660,6 +668,17 @@ Locations::end_location () const } Location* +Locations::start_location () const +{ + for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) { + if ((*i)->is_start()) { + return const_cast<Location*> (*i); + } + } + return 0; +} + +Location* Locations::auto_loop_location () const { for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) { diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 42614d15d0..241d54c8b6 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -126,6 +126,7 @@ Session::first_stage_init (string fullpath, string snapshot_name) _transport_frame = 0; last_stop_frame = 0; end_location = new Location (0, 0, _("end"), Location::Flags ((Location::IsMark|Location::IsEnd))); + start_location = new Location (0, 0, _("start"), Location::Flags ((Location::IsMark|Location::IsStart))); _end_location_is_free = true; atomic_set (&_record_status, Disabled); auto_play = false; @@ -560,11 +561,14 @@ Session::create (bool& new_session, string* mix_template, jack_nframes_t initial if (new_session) { - /* set an initial end point */ + /* set initial start + end point */ + + start_location->set_end (0); + _locations.add (start_location); end_location->set_end (initial_length); _locations.add (end_location); - + _state_of_the_state = Clean; if (save_state (_current_snapshot_name)) { @@ -1551,9 +1555,17 @@ Session::set_state (const XMLNode& node) if ((location = _locations.end_location()) == 0) { _locations.add (end_location); } else { + delete end_location; end_location = location; } + if ((location = _locations.start_location()) == 0) { + _locations.add (start_location); + } else { + delete start_location; + start_location = location; + } + _locations.save_state (_("initial state")); if ((child = find_named_node (node, "EditGroups")) == 0) { |