a) persist whether the end marker should move at first capture in the session file
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 31 Mar 2006 15:51:03 +0000 (15:51 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 31 Mar 2006 15:51:03 +0000 (15:51 +0000)
b) prevent transport motion if stop-at-session-end is true
c) ensure that (more) menu items that provide control over Configuration object options are in the correct state at startup
d) Configuration options removed from "have a session" sensitivity toggling
e) removed functionally empty default_keys.cc

git-svn-id: svn://localhost/trunk/ardour2@433 d708f5d6-7413-0410-9779-e7cbd77b26cf

12 files changed:
gtk2_ardour/SConscript
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui_dialogs.cc
gtk2_ardour/ardour_ui_ed.cc
gtk2_ardour/ardour_ui_options.cc
gtk2_ardour/default_keys.cc [deleted file]
gtk2_ardour/mtest.cc
gtk2_ardour/taperegionview.cc
libs/ardour/route.cc
libs/ardour/session_state.cc
libs/ardour/session_transport.cc

index e74c390a35864becf3b92abce9922530212d7523..38cac52b40ccea01370b3d41fd8622398ffad3e5 100644 (file)
@@ -89,7 +89,6 @@ color_manager.cc
 crossfade_edit.cc
 crossfade_view.cc
 curvetest.cc
-default_keys.cc
 editing.cc
 editor.cc
 editor_actions.cc
index d0f46dd0df8169429309ffa67a19e5051349bddc..2b7b87f93b2b6b26020d71312ba4b32051035f59 100644 (file)
@@ -228,7 +228,6 @@ ARDOUR_UI::set_engine (AudioEngine& e)
        _tooltips.enable();
 
        keyboard = new Keyboard;
-       install_keybindings ();
 
        string meter_path;
 
index 8e1bfc141411a66b12441965899a20e7fd7b7132..9f4d8de8d94ba52c4d8037008cab0f6514106940 100644 (file)
@@ -576,7 +576,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        void connect_dependents_to_session (ARDOUR::Session *);
        void we_have_dependents ();
        void setup_keybindings ();
-       void setup_options ();
+       void setup_session_options ();
+       void setup_config_options ();
        
        guint32  last_key_press_time;
 
@@ -623,7 +624,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
 
        /* Keymap handling */
 
-       void install_keybindings ();
        Glib::RefPtr<Gtk::ActionGroup> get_common_actions();
        void install_actions ();
        void test_binding_action (const char *);
index 29dc204af946045eadb6f557370822f67ba2a9e2..29a58586034a3423b9699df41f5f9edc300c3b2e 100644 (file)
@@ -99,7 +99,7 @@ ARDOUR_UI::connect_to_session (Session *s)
                sfdb->set_session (s);
        }
 
-       setup_options ();
+       setup_session_options ();
 
        Blink.connect (mem_fun(*this, &ARDOUR_UI::transport_rec_enable_blink));
        Blink.connect (mem_fun(*this, &ARDOUR_UI::solo_blink));
index 8414b8f070408e4a0e0b6e546834f762bfbaaccb..9c1ae4c45fe61215d6cce91370d4bfdd386b5e91 100644 (file)
@@ -399,26 +399,21 @@ ARDOUR_UI::install_actions ()
        RadioAction::Group monitoring_group;
 
        act = ActionManager::register_radio_action (option_actions, monitoring_group, X_("UseHardwareMonitoring"), _("Hardware monitoring"), mem_fun (*this, &ARDOUR_UI::toggle_UseHardwareMonitoring));
-       ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_radio_action (option_actions, monitoring_group, X_("UseSoftwareMonitoring"), _("Software monitoring"), mem_fun (*this, &ARDOUR_UI::toggle_UseSoftwareMonitoring));
-       ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_radio_action (option_actions, monitoring_group, X_("UseExternalMonitoring"), _("External monitoring"), mem_fun (*this, &ARDOUR_UI::toggle_UseExternalMonitoring));
-       ActionManager::session_sensitive_actions.push_back (act);
 
-       act = ActionManager::register_toggle_action (option_actions, X_("StopPluginsWithTransport"), _("Stop plugins with transport"), mem_fun (*this, &ARDOUR_UI::toggle_StopPluginsWithTransport));
-       ActionManager::session_sensitive_actions.push_back (act);
-       act = ActionManager::register_toggle_action (option_actions, X_("DoNotRunPluginsWhileRecording"), _("Do not run plugins while recording"), mem_fun (*this, &ARDOUR_UI::toggle_DoNotRunPluginsWhileRecording));
-       ActionManager::session_sensitive_actions.push_back (act);
+       /* Configuration object options (i.e. not session specific) */
 
+       ActionManager::register_toggle_action (option_actions, X_("StopPluginsWithTransport"), _("Stop plugins with transport"), mem_fun (*this, &ARDOUR_UI::toggle_StopPluginsWithTransport));
+       ActionManager::register_toggle_action (option_actions, X_("VerifyRemoveLastCapture"), _("Verify remove last capture"), mem_fun (*this, &ARDOUR_UI::toggle_VerifyRemoveLastCapture));
+       ActionManager::register_toggle_action (option_actions, X_("StopRecordingOnXrun"), _("Stop recording on xrun"), mem_fun (*this, &ARDOUR_UI::toggle_StopRecordingOnXrun));
+       ActionManager::register_toggle_action (option_actions, X_("StopTransportAtEndOfSession"), _("Stop transport at session end"), mem_fun (*this, &ARDOUR_UI::toggle_StopTransportAtEndOfSession));
+       ActionManager::register_toggle_action (option_actions, X_("GainReduceFastTransport"), _("-12dB gain reduce ffwd/rewind"), mem_fun (*this, &ARDOUR_UI::toggle_GainReduceFastTransport));
        ActionManager::register_toggle_action (option_actions, X_("LatchedRecordEnable"), _("Rec-enable stays engaged at stop"), mem_fun (*this, &ARDOUR_UI::toggle_LatchedRecordEnable));
+
+       /* session options */
        
-       act = ActionManager::register_toggle_action (option_actions, X_("VerifyRemoveLastCapture"), _("Verify remove last capture"), mem_fun (*this, &ARDOUR_UI::toggle_VerifyRemoveLastCapture));
-       ActionManager::session_sensitive_actions.push_back (act);
-       act = ActionManager::register_toggle_action (option_actions, X_("StopRecordingOnXrun"), _("Stop recording on xrun"), mem_fun (*this, &ARDOUR_UI::toggle_StopRecordingOnXrun));
-       ActionManager::session_sensitive_actions.push_back (act);
-       act = ActionManager::register_toggle_action (option_actions, X_("StopTransportAtEndOfSession"), _("Stop transport at session end"), mem_fun (*this, &ARDOUR_UI::toggle_StopTransportAtEndOfSession));
-       ActionManager::session_sensitive_actions.push_back (act);
-       act = ActionManager::register_toggle_action (option_actions, X_("GainReduceFastTransport"), _("-12dB gain reduce ffwd/rewind"), mem_fun (*this, &ARDOUR_UI::toggle_GainReduceFastTransport));
+       act = ActionManager::register_toggle_action (option_actions, X_("DoNotRunPluginsWhileRecording"), _("Do not run plugins while recording"), mem_fun (*this, &ARDOUR_UI::toggle_DoNotRunPluginsWhileRecording));
        ActionManager::session_sensitive_actions.push_back (act);
 
        act = ActionManager::register_toggle_action (option_actions, X_("LatchedSolo"), _("Latched solo"), mem_fun (*this, &ARDOUR_UI::toggle_LatchedSolo));
@@ -427,6 +422,7 @@ ARDOUR_UI::install_actions ()
        RadioAction::Group solo_group;
 
        act = ActionManager::register_radio_action (option_actions, solo_group, X_("SoloInPlace"), _("Solo in-place"), mem_fun (*this, &ARDOUR_UI::toggle_SoloViaBus));
+       ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_radio_action (option_actions, solo_group, X_("SoloViaBus"), _("Solo via bus"), mem_fun (*this, &ARDOUR_UI::toggle_SoloViaBus));
        ActionManager::session_sensitive_actions.push_back (act);
 
@@ -435,21 +431,16 @@ ARDOUR_UI::install_actions ()
        act = ActionManager::register_action (option_actions, X_("UnmuteNewFullCrossfades"), _("Unmute new full crossfades"), mem_fun (*this, &ARDOUR_UI::toggle_UnmuteNewFullCrossfades));
        ActionManager::session_sensitive_actions.push_back (act);
 
-
-#ifdef NEW_ACTIONS
-       act = ActionManager::register_action (option_actions, X_("SetRegionLayerMode", _("SetRegionLayerMode"), mem_fun (*this, &ARDOUR_UI::toggle_SetRegionLayerMode)));
-       ActionManager::session_sensitive_actions.push_back (act);
-       act = ActionManager::register_action (option_actions, X_("SetCrossfadeModel", _("SetCrossfadeModel"), mem_fun (*this, &ARDOUR_UI::toggle_SetCrossfadeModel)));
-       ActionManager::session_sensitive_actions.push_back (act);
-       
-#endif 
-       
        ActionManager::add_action_group (shuttle_actions);
        ActionManager::add_action_group (option_actions);
        ActionManager::add_action_group (jack_actions);
        ActionManager::add_action_group (transport_actions);
        ActionManager::add_action_group (main_actions);
        ActionManager::add_action_group (common_actions);
+
+       /* initialize state of non-session dependent options */
+       
+       setup_config_options ();
 }
 
 void
index f38aeedc8d638a583cb533a945b2a1d4e4f0aafa..b959cc73009e5c04f4e4e2af2f3f8d0158b7d643 100644 (file)
@@ -34,6 +34,31 @@ using namespace Gtk;
 using namespace Gtkmm2ext;
 using namespace ARDOUR;
 
+void
+ARDOUR_UI::setup_config_options ()
+{
+       struct { 
+           char* name;
+           bool (Configuration::*method)(void) const;
+       } options[] = {
+               { "ToggleTimeMaster", &Configuration::get_jack_time_master },
+               { "StopPluginsWithTransport", &Configuration::get_plugins_stop_with_transport },
+               { "LatchedRecordEnable", &Configuration::get_latched_record_enable },
+               { "VerifyRemoveLastCapture", &Configuration::get_verify_remove_last_capture },
+               { "StopRecordingOnXrun", &Configuration::get_stop_recording_on_xrun },
+               { "StopTransportAtEndOfSession", &Configuration::get_stop_at_session_end },
+               { 0, 0 }
+       };
+       
+       for (uint32_t n = 0; options[n].name; ++n) {
+               Glib::RefPtr<Action> act = ActionManager::get_action ("options", options[n].name);
+               if (act) {
+                       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+                       tact->set_active ((Config->*(options[n].method))());
+               }
+       }
+}
+
 void
 ARDOUR_UI::toggle_time_master ()
 {
@@ -370,7 +395,7 @@ ARDOUR_UI::mtc_port_changed ()
 }
 
 void
-ARDOUR_UI::setup_options ()
+ARDOUR_UI::setup_session_options ()
 {
        mtc_port_changed ();
 
diff --git a/gtk2_ardour/default_keys.cc b/gtk2_ardour/default_keys.cc
deleted file mode 100644 (file)
index 5209a4e..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-    Copyright (C) 1999 Paul Davis 
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-    $Id$
-*/
-
-#include <sigc++/bind.h>
-#include <pbd/error.h>
-
-#include "ardour_ui.h"
-#include "keyboard_target.h"
-
-using namespace ARDOUR;
-using namespace Gtkmm2ext;
-using namespace Gtk;
-using namespace sigc;
-
-void
-ARDOUR_UI::install_keybindings ()
-{
-}
index 0ae55c8174912f1682635904e608b307aadc946e..7d62509159ef9d222c18f7943e55d2ba6f817590 100644 (file)
@@ -133,7 +133,7 @@ main (int argc, char* argv[])
        other_uimanager->insert_action_group (copy_actions (shared_actions));
 
        other_window.add_accel_group (accels);
-       window.add_accel_group (accels);
+       // window.add_accel_group (accels);
 
        Gtk::MenuBar* m;
 
index d08b985176672d2a1121b3713c39efcef362933b..19276223ef1f4ebf87a21281d241681ceb468b70 100644 (file)
@@ -117,8 +117,6 @@ TapeAudioRegionView::~TapeAudioRegionView()
 void
 TapeAudioRegionView::update (uint32_t n)
 {
-       cerr << "new peaks ready for channel " << n << endl;
-
        /* check that all waves are build and ready */
 
        if (!tmp_waves.empty()) {
index f8905eb43d3be4a3751ca6eced10748027da4228..d338cee2774580e034977ac43cc22eab1163082a 100644 (file)
@@ -625,7 +625,7 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
                        if (_session.transport_speed() > 1.5f || _session.transport_speed() < -1.5f) {
                                pan (bufs, nbufs, nframes, offset, speed_quietning); 
                        } else {
-                               // cerr << "panner state = " << _panner->automation_state() << endl;
+                               // cerr << _name << " panner state = " << _panner->automation_state() << endl;
                                if (!_panner->empty() &&
                                    (_panner->automation_state() & Play ||
                                     ((_panner->automation_state() & Touch) && !_panner->touching()))) {
index 6523636345a70be7e08ff70a1fadc129b96c2872..5301019fa0338674e0410a4f3c853b7ff08a1ad8 100644 (file)
@@ -155,6 +155,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        _solo_model = InverseMute;
        solo_update_disabled = false;
        currently_soloing = false;
+       _have_captured = false;
        _worst_output_latency = 0;
        _worst_input_latency = 0;
        _worst_track_latency = 0;
@@ -183,7 +184,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        _master_out = 0;
        input_auto_connect = AutoConnectOption (0);
        output_auto_connect = AutoConnectOption (0);
-       _have_captured = false;
        waiting_to_start = false;
        _exporting = false;
        _gain_automation_buffer = 0;
@@ -1023,6 +1023,12 @@ Session::load_options (const XMLNode& node)
                }
        }
 
+       if ((child = find_named_node (node, "end-marker-is-free")) != 0) {
+               if ((prop = child->property ("val")) != 0) {
+                       _end_location_is_free = (prop->value() == "yes");
+               }
+       }
+
        if ((child = find_named_node (node, "layer-model")) != 0) {
                if ((prop = child->property ("val")) != 0) {
                        if (prop->value() == X_("LaterHigher")) {
@@ -1208,6 +1214,8 @@ Session::get_options () const
        child->add_property ("val", get_crossfades_active () ? "yes" : "no");
        child = opthead->add_child ("audible-click");
        child->add_property ("val", get_clicking () ? "yes" : "no");
+       child = opthead->add_child ("end-marker-is-free");
+       child->add_property ("val", _end_location_is_free ? "yes" : "no");
 
        if (click_sound.length()) {
                child = opthead->add_child ("click-sound");
index 2f9f8257f9344d3d8e3f2e38515861ec6e18cfa7..2e12c58f65a68f5d9b078cfa5cf73d203f8672ea 100644 (file)
@@ -165,22 +165,11 @@ Session::realtime_stop (bool abort)
                decrement_transport_position (_worst_output_latency);
 #endif
 
-               if (_transport_frame > current_end_frame()) {
-                       
-                       /* first capture resets end location; later captures can only extend the length */
-
-                       if (_end_location_is_free) {
-                               end_location->set_end (_transport_frame);
-                               _end_location_is_free = false;
-                       } else if (_transport_frame > end_location->start()) {
-                               end_location->set_end (_transport_frame);
-                       }
+               /* the duration change is not guaranteed to have happened, but is likely */
 
-                       post_transport_work = PostTransportWork (post_transport_work | PostTransportDuration);
-               }
+               post_transport_work = PostTransportWork (post_transport_work | PostTransportDuration);
        }
 
-
        if (abort) {
                post_transport_work = PostTransportWork (post_transport_work | PostTransportAbort);
        }
@@ -307,21 +296,34 @@ Session::non_realtime_stop (bool abort)
 
        if (did_record) {
                begin_reversible_command ("capture");
-
+               
                Location* loc = _locations.end_location();
+               bool change_end = false;
 
-               if (loc && !_have_captured) {
-                               
-                       /* first capture.
-                          
-                          note: later captures that extend the session length get
-                          handled because of playlist length changes.
-                       */
+               if (_transport_frame < loc->end()) {
+
+                       /* stopped recording before current end */
+
+                       if (_end_location_is_free) {
+
+                               /* first capture for this session, move end back to where we are */
+
+                               change_end = true;
+                       } 
+
+               } else if (_transport_frame > loc->end()) {
                        
-                 add_undo (sigc::retype_return<void>(sigc::bind (mem_fun (*loc, &Location::set_end), loc->end())));
-                 add_redo (sigc::retype_return<void>(sigc::bind (mem_fun (*loc, &Location::set_end), _transport_frame)));
+                       /* stopped recording after the current end, extend it */
+
+                       change_end = true;
+               }
+               
+               if (change_end) {
+                       add_undo (sigc::retype_return<void>(sigc::bind (mem_fun (*loc, &Location::set_end), loc->end())));
+                       add_redo (sigc::retype_return<void>(sigc::bind (mem_fun (*loc, &Location::set_end), _transport_frame)));
                }
 
+               _end_location_is_free = false;
                _have_captured = true;
        }
 
@@ -718,6 +720,10 @@ Session::set_transport_speed (float speed, bool abort)
 
        } else if (transport_stopped() && speed == 1.0) {
 
+               if (Config->get_stop_at_session_end() && _transport_frame >= current_end_frame()) {
+                       return;
+               }
+
                if (Config->get_use_hardware_monitoring()) {
                        /* Even though this is called from RT context we are using
                           a non-tentative rwlock here,  because the action must occur.
@@ -740,6 +746,10 @@ Session::set_transport_speed (float speed, bool abort)
 
        } else {
 
+               if (Config->get_stop_at_session_end() && _transport_frame >= current_end_frame()) {
+                       return;
+               }
+
                if ((synced_to_jack()) && speed != 0.0 && speed != 1.0) {
                        warning << _("Global varispeed cannot be supported while Ardour is connected to JACK transport control")
                                << endmsg;