a metric ton of changes
authorPaul Davis <paul@linuxaudiosystems.com>
Sun, 8 Jan 2006 02:56:49 +0000 (02:56 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Sun, 8 Jan 2006 02:56:49 +0000 (02:56 +0000)
git-svn-id: svn://localhost/trunk/ardour2@246 d708f5d6-7413-0410-9779-e7cbd77b26cf

36 files changed:
gtk2_ardour/ardour-menus.xml
gtk2_ardour/ardour.bindings
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui2.cc
gtk2_ardour/ardour_ui_dialogs.cc
gtk2_ardour/ardour_ui_ed.cc
gtk2_ardour/ardour_ui_options.cc
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_actions.cc
gtk2_ardour/editor_mouse.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/mixer_strip.cc
gtk2_ardour/mixer_strip.h
gtk2_ardour/option_editor.cc
gtk2_ardour/option_editor.h
gtk2_ardour/route_ui.cc
gtk2_ardour/route_ui.h
gtk2_ardour/streamview.cc
libs/ardour/ardour/configuration.h
libs/ardour/ardour/route.h
libs/ardour/ardour/session.h
libs/ardour/ardour/state_manager.h
libs/ardour/audio_playlist.cc
libs/ardour/audio_track.cc
libs/ardour/audioregion.cc
libs/ardour/configuration.cc
libs/ardour/playlist.cc
libs/ardour/route.cc
libs/ardour/session.cc
libs/ardour/session_feedback.cc
libs/ardour/session_midi.cc
libs/ardour/session_state.cc
libs/ardour/state_manager.cc
libs/pbd3/undo.cc

index efceee22b2c3c86abbc94d4528ea02f549a946f2..6521753bea8d2339b5141ca2f00ca851823aa2e4 100644 (file)
                <separator/>       
                <menuitem action='edit-cursor-to-range-start'/>
                <menuitem action='edit-cursor-to-range-end'/>
+               <separator/>
+               <menuitem action='crop'/>
+               <menuitem action='duplicate-region'/>
+               <menuitem action='insert-region'/>
+               <menuitem action='normalize-region'/>
         </menu>         
         <menu name='View' action = 'View'>
-               <menuitem action='temporal-zoom-in'/>
-               <menuitem action='temporal-zoom-out'/>
-               <menuitem action='zoom-to-session'/>
                <menu name='ZoomFocus' action='ZoomFocus'>
                    <menuitem action='zoom-focus-left'/>
                    <menuitem action='zoom-focus-right'/>
                    <menuitem action='snap-to-beat'/>
                    <menuitem action='snap-to-bar'/>
                </menu>
+               <menu name='MeterFalloff' action='MeterFalloff'>
+                    <menuitem action='MeterFalloffOff'/>
+                    <menuitem action='MeterFalloffSlowest'/>
+                    <menuitem action='MeterFalloffSlow'/>
+                    <menuitem action='MeterFalloffMedium'/>
+                    <menuitem action='MeterFalloffFast'/>
+                    <menuitem action='MeterFalloffFaster'/>
+                    <menuitem action='MeterFalloffFastest'/>
+               </menu>
+               <menu name='MeterHold' action='MeterHold'>
+                   <menuitem action='MeterHoldOff'/>
+                   <menuitem action='MeterHoldShort'/>
+                   <menuitem action='MeterHoldMedium'/>
+                   <menuitem action='MeterHoldLong'/>
+               </menu>
+
+               <separator/>
+
+               <menuitem action='temporal-zoom-in'/>
+               <menuitem action='temporal-zoom-out'/>
+               <menuitem action='zoom-to-session'/>
                <menuitem action='scroll-tracks-down'/>
                <menuitem action='scroll-tracks-up'/>
                <menuitem action='scroll-tracks-down'/>
                <menuitem action='step-tracks-up'/>
                <menuitem action='step-tracks-down'/>
+              <separator/>
+               <menuitem action='ToggleWaveformVisibility'/>
+               <menuitem action='ToggleWaveformsWhileRecording'/>
+               <menuitem action='ToggleMeasureVisibility'/>
          </menu>
         <menu name='JACK' action='JACK'>
                <menuitem action='JACKDisconnect'/>
                           <menuitem action='About'/>
         </menu>
         <menu name='Options' action='Options'>
+               <menu action='Autoconnect'>
+                   <menuitem action='AutoConnectNewTrackInputsToHardware'/>
+                   <menuitem action='AutoConnectNewTrackOutputsToHardware'/>
+                   <menuitem action='AutoConnectNewTrackOutputsToHardware'/>
+                   <menuitem action='ManuallyConnectNewTrackOutputs'/>
+               </menu>
+               <menu action='Monitoring'>
+                   <menuitem action='UseHardwareMonitoring'/>
+                   <menuitem action='UseSoftwareMonitoring'/>
+                   <menuitem action='UseExternalMonitoring'/>
+               </menu>
+               <menu action='Solo'>
+                   <menuitem action='LatchedSolo'/>
+                   <menuitem action='SoloInPlace'/>
+                   <menuitem action='SoloViaBus'/>
+               </menu>
+               <separator/>
                <menuitem action='SendMTC'/>
                <menuitem action='SendMMC'/>
                <menuitem action='UseMMC'/>
                <menuitem action='SendMIDIfeedback'/>
                <menuitem action='UseMIDIcontrol'/>
                <separator/>
-               <menuitem action='AutoConnectNewTrackInputsToHardware'/>
-               <menuitem action='AutoConnectNewTrackOutputsToHardware'/>
-               <menuitem action='AutoConnectNewTrackOutputsToHardware'/>
-               <menuitem action='ManuallyConnectNewTrackOutputs'/>
-               <separator/>
-               <menuitem action='UseHardwareMonitoring'/>
-               <menuitem action='UseSoftwareMonitoring'/>
-               <menuitem action='UseExternalMonitoring'/>
-               <separator/>
                <menuitem action='StopPluginsWithTransport'/>
                <menuitem action='RunPluginsWhileRecording'/>
                <separator/>
                <menuitem action='StopTransportAtEndOfSession'/>
                <menuitem action='GainReduceFastTransport'/>
                <separator/>
-               <menuitem action='LatchedSolo'/>
-               <menuitem action='SoloInPlace'/>
-               <menuitem action='SoloViaBus'/>
-               <separator/>
                <menuitem action='AutomaticallyCreateCrossfades'/>
                <menuitem action='UnmuteNewFullCrossfades'/>
          </menu>
index 089baa9f1d7c8c4ecd82a227c091ef60b0c256a1..58b923fd7ab7a05bcbb9dd616401b559c99450e3 100644 (file)
@@ -8,19 +8,24 @@
 (gtk_accel_path "<Actions>/Transport/GotoEnd" "End")
 
 (gtk_accel_path "<Actions>/Editor/align-regions-sync-relative" "a")
+(gtk_accel_path "<Actions>/Editor/crop" "c")
+(gtk_accel_path "<Actions>/Editor/duplicate-region" "d")
 (gtk_accel_path "<Actions>/Editor/set-edit-cursor" "e")
+(gtk_accel_path "<Actions>/Editor/insert-region" "i")
+(gtk_accel_path "<Actions>/Editor/normalize-region" "n")
 (gtk_accel_path "<Actions>/Transport/loop" "l")
 (gtk_accel_path "<Actions>/Editor/set-playhead" "p")
-(gtk_accel_path "<Actions>/Transport/Record" "R")
+(gtk_accel_path "<Actions>/Transport/Record" "<shift>r")
 
-(gtk_accel_path "<Actions>/Editor/copy" "<Control>c")
+(gtk_accel_path "<Actions>/Editor/editor-copy" "<Control>c")
 (gtk_accel_path "<Actions>/Common/Quit" "<Control>q")
 (gtk_accel_path "<Actions>/Editor/redo" "<Control>r")
 (gtk_accel_path "<Actions>/Common/Save" "<Control>s")
-(gtk_accel_path "<Actions>/Editor/paste" "<Control>v")
-(gtk_accel_path "<Actions>/Editor/cut" "<Control>x")
+(gtk_accel_path "<Actions>/Editor/editor-paste" "<Control>v")
+(gtk_accel_path "<Actions>/Editor/editor-cut" "<Control>x")
 (gtk_accel_path "<Actions>/Editor/undo" "<Control>z")
 
+
 (gtk_accel_path "<Actions>/Editor/scroll-tracks-down" "Page_Down")
 (gtk_accel_path "<Actions>/Editor/scroll-tracks-up" "Page_Up")
 (gtk_accel_path "<Actions>/Editor/step-tracks-down" "Down")
index 67323ac07b55ea7abce2170e720fed1611658a85..30f57a9d139863681742ca452ccde451892e1344 100644 (file)
@@ -653,18 +653,6 @@ ARDOUR_UI::update_wall_clock ()
        return TRUE;
 }
 
-void
-ARDOUR_UI::toggle_recording_plugins ()
-{
-       /* XXX use toggle_some_session_state */
-
-       if (session == 0) {
-               return;
-       }
-
-       session->set_recording_plugins (!session->get_recording_plugins());
-}
-       
 void
 ARDOUR_UI::toggle_auto_play ()
 
@@ -735,7 +723,6 @@ ARDOUR_UI::toggle_punch_in ()
 
 void
 ARDOUR_UI::map_button_state ()
-
 {
        map_some_session_state (auto_return_button,
                                &Session::get_auto_return);
@@ -751,91 +738,6 @@ ARDOUR_UI::map_button_state ()
                                &Session::get_clicking);
 }
 
-void
-ARDOUR_UI::queue_map_control_change (Session::ControlType t)
-{
-       ENSURE_GUI_THREAD (bind (mem_fun(*this, &ARDOUR_UI::map_control_change), t));
-}
-
-void
-ARDOUR_UI::map_control_change (Session::ControlType t)
-{
-       switch (t) {
-       case Session::AutoPlay:
-               map_some_session_state (auto_play_button, &Session::get_auto_play);
-               break;
-
-       case Session::AutoLoop:
-               break;
-
-       case Session::AutoReturn:
-               map_some_session_state (auto_return_button, &Session::get_auto_return);
-               break;
-
-       case Session::AutoInput:
-               map_some_session_state (auto_input_button, &Session::get_auto_input);
-               break;
-
-       case Session::PunchOut:
-               map_some_session_state (punch_in_button, &Session::get_punch_out);
-               break;
-
-       case Session::PunchIn:
-               map_some_session_state (punch_in_button, &Session::get_punch_in);
-               break;
-
-       case Session::Clicking:
-               map_some_session_state (click_button, &Session::get_clicking);
-               break;
-
-       case Session::SlaveType:
-//             map_some_session_state (mtc_slave_button, &Session::get_mtc_slave);
-               break;
-
-       case Session::SendMTC:
-//             map_some_session_state (send_mtc_button, &Session::get_send_mtc);
-               break;
-
-       case Session::SendMMC:
-//             map_some_session_state (send_mmc_button, &Session::get_send_mmc);
-               break;
-
-       case Session::MMCControl:       
-//             map_some_session_state (mmc_control_button, &Session::get_mmc_control);
-               break;
-
-       case Session::MidiFeedback:       
-//             map_some_session_state (mmc_control_button, &Session::get_mmc_control);
-               break;
-       case Session::MidiControl:       
-//             map_some_session_state (mmc_control_button, &Session::get_mmc_control);
-               break;
-               
-       case Session::Live:
-               break;
-
-       case Session::RecordingPlugins:
-               break;
-
-       case Session::CrossFadesActive:
-               break;
-               
-       case Session::EditingMode:
-               break;
-
-       case Session::PlayRange:
-               break;
-
-       case Session::AlignChoice:
-               /* don't care, this is handled by the options editor */
-               break;
-       case Session::SeamlessLoop:
-               /* don't care, this is handled by the options editor */
-               break;
-              
-       }
-}
-
 void
 ARDOUR_UI::control_methods_adjusted ()
 
index 907307bd3ff6e5ecff8d19a6fa4c2215f01ecd77..284a89ab213845e3688a7927e4446d7f6a75c2dd 100644 (file)
@@ -566,13 +566,12 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        void connect_dependents_to_session (ARDOUR::Session *);
        void we_have_dependents ();
        void setup_keybindings ();
-
+       void setup_options ();
+       
        guint32  last_key_press_time;
 
        void snapshot_session ();
 
-       void map_control_change (ARDOUR::Session::ControlType);
-       void queue_map_control_change (ARDOUR::Session::ControlType);
        void map_record_state ();
        void queue_map_record_state ();
 
@@ -591,10 +590,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        LocationUI *location_ui;
        int         create_location_ui ();
 
-       /* Various options */
-
-       void toggle_recording_plugins ();
-
        /* Options window */
        
        OptionEditor *option_editor;
@@ -675,7 +670,11 @@ class ARDOUR_UI : public Gtkmm2ext::UI
 
        void editor_realized ();
 
-       void toggle_session_state (const char* group, const char* action, void (ARDOUR::Session::*set)(bool));
+       std::vector<std::string> positional_sync_strings;
+
+       void toggle_config_state (const char* group, const char* action, void (ARDOUR::Configuration::*set)(bool));
+       void toggle_session_state (const char* group, const char* action, void (ARDOUR::Session::*set)(bool), bool (ARDOUR::Session::*get)(void) const);
+       void toggle_session_state (const char* group, const char* action, sigc::slot<void> theSlot);
        void toggle_send_midi_feedback ();
        void toggle_use_mmc ();
        void toggle_send_mmc ();
@@ -699,6 +698,11 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        void toggle_SoloViaBus();
        void toggle_AutomaticallyCreateCrossfades();
        void toggle_UnmuteNewFullCrossfades();
+
+       void mtc_port_changed ();
+       void map_some_session_state (const char* group, const char* action, bool (ARDOUR::Session::*get)() const);
+       void queue_session_control_changed (ARDOUR::Session::ControlType t);
+       void session_control_changed (ARDOUR::Session::ControlType t);
 };
 
 
index 173f6c30a3718e902815072ccdf5963866bd42aa..ab4a0e9b532e0db79b10e2a53581e6a4e545fec1 100644 (file)
@@ -53,16 +53,6 @@ using namespace Gtk;
 using namespace Glib;
 using namespace sigc;
 
-
-static const gchar *psync_strings[] = {
-       N_("Internal"),
-       N_("Slave to MTC"),
-       N_("Sync with JACK"),
-       0
-};
-
-static vector<string> positional_sync_strings;
-
 int    
 ARDOUR_UI::setup_windows ()
 {
@@ -391,7 +381,7 @@ ARDOUR_UI::setup_transport ()
        ARDOUR_UI::instance()->tooltips().set_tip (primary_clock, _("Primary clock"));
        ARDOUR_UI::instance()->tooltips().set_tip (secondary_clock, _("secondary clock"));
 
-       /* options */
+       /* options: XXX these should all be actions with the buttons as proxies */
 
        auto_return_button.signal_toggled().connect (mem_fun(*this,&ARDOUR_UI::toggle_auto_return));
        auto_play_button.signal_toggled().connect (mem_fun(*this,&ARDOUR_UI::toggle_auto_play));
@@ -458,9 +448,7 @@ ARDOUR_UI::setup_transport ()
        sdframe->set_shadow_type (SHADOW_IN);
        sdframe->add (speed_display_box);
 
-       positional_sync_strings = internationalize (psync_strings);
-
-       set_popdown_strings (sync_option_combo, positional_sync_strings);
+       mtc_port_changed ();
        sync_option_combo.set_active_text (positional_sync_strings.front());
        sync_option_combo.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::sync_option_changed));
 
index 22fa1d384f2df62dde24482c210a2e67c6aec473..6c8b5b540ec605897866df0c4cb618d84d826724 100644 (file)
@@ -80,6 +80,8 @@ ARDOUR_UI::connect_to_session (Session *s)
                sfdb->set_session (s);
        }
 
+       setup_options ();
+
        Blink.connect (mem_fun(*this, &ARDOUR_UI::transport_rec_enable_blink));
        Blink.connect (mem_fun(*this, &ARDOUR_UI::solo_blink));
        Blink.connect (mem_fun(*this, &ARDOUR_UI::audition_blink));
@@ -89,7 +91,6 @@ ARDOUR_UI::connect_to_session (Session *s)
        */
 
        session->TransportStateChange.connect (mem_fun(*this, &ARDOUR_UI::queue_transport_change));
-       session->ControlChanged.connect (mem_fun(*this, &ARDOUR_UI::queue_map_control_change));
 
        /* alert the user to these things happening */
 
index 669eb3a65d2f1f9b2a4272361baebf5f46c393a7..753aa6a667b64aac4bd3e3f69038bdfe91d490d8 100644 (file)
@@ -335,7 +335,7 @@ ARDOUR_UI::install_actions ()
        ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_toggle_action (option_actions, X_("SendMMC"), _("Send MMC"), mem_fun (*this, &ARDOUR_UI::toggle_send_mtc));
        ActionManager::session_sensitive_actions.push_back (act);
-       act = ActionManager::register_toggle_action (option_actions, X_("UseMMC"), _("Send MMC"), mem_fun (*this, &ARDOUR_UI::toggle_use_mmc));
+       act = ActionManager::register_toggle_action (option_actions, X_("UseMMC"), _("Use MMC"), mem_fun (*this, &ARDOUR_UI::toggle_use_mmc));
        ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_toggle_action (option_actions, X_("SendMIDIfeedback"), _("Send MIDI feedback"), mem_fun (*this, &ARDOUR_UI::toggle_send_midi_feedback));
        ActionManager::session_sensitive_actions.push_back (act);
index 7bcd9e2dcb78a676b5f63b4849d614e953f61e95..2fbec5d9a107b67a901889feaa87564974ec4950 100644 (file)
     $Id$
 */
 
+#include <gtkmm2ext/utils.h>
+
 #include <ardour/configuration.h>
 #include <ardour/session.h>
 #include <ardour/audioengine.h>
 
 #include "ardour_ui.h"
 #include "actions.h"
+#include "gui_thread.h"
+
+#include "i18n.h"
 
 using namespace Gtk;
+using namespace Gtkmm2ext;
 using namespace ARDOUR;
 
 void
 ARDOUR_UI::toggle_time_master ()
 {
-       bool yn = time_master_button.get_active();
+       toggle_config_state ("Transport", "ToggleTimeMaster", &Configuration::set_jack_time_master);
+       if (session) {
+               session->engine().reset_timebase ();
+       }
+}
 
-       Config->set_jack_time_master (yn);
+void
+ARDOUR_UI::toggle_config_state (const char* group, const char* action, void (Configuration::*set)(bool))
+{
+       Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
+       if (act) {
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+               (Config->*set) (tact->get_active());
+       }
+}
 
+void
+ARDOUR_UI::toggle_session_state (const char* group, const char* action, void (Session::*set)(bool), bool (Session::*get)(void) const)
+{
        if (session) {
-               session->engine().reset_timebase ();
+               Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
+               if (act) {
+                       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+                       bool x = (session->*get)();
+
+                       if (x != tact->get_active()) {
+                               (session->*set) (!x);
+                       }
+               }
        }
 }
 
 void
-ARDOUR_UI::toggle_session_state (const char* group, const char* action, void (Session::*set)(bool))
+ARDOUR_UI::toggle_session_state (const char* group, const char* action, sigc::slot<void> theSlot)
 {
        if (session) {
                Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
                if (act) {
                        Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
-                       (session->*set) (tact->get_active());
+                       if (tact->get_active()) {
+                               theSlot ();
+                       }
                }
        }
 }
@@ -55,93 +86,170 @@ ARDOUR_UI::toggle_session_state (const char* group, const char* action, void (Se
 void
 ARDOUR_UI::toggle_send_mtc ()
 {
-       toggle_session_state ("options", "SendMTC", &Session::set_send_mtc);
+       toggle_session_state ("options", "SendMTC", &Session::set_send_mtc, &Session::get_send_mtc);
 }
 
 void
 ARDOUR_UI::toggle_send_mmc ()
 {
-       toggle_session_state ("options", "SendMMC", &Session::set_send_mmc);
+       toggle_session_state ("options", "SendMMC", &Session::set_send_mmc, &Session::get_send_mmc);
 }
 
 void
 ARDOUR_UI::toggle_use_mmc ()
 {
-       toggle_session_state ("options", "UseMMC", &Session::set_mmc_control);
+       toggle_session_state ("options", "UseMMC", &Session::set_mmc_control, &Session::get_mmc_control);
 }
 
 void
 ARDOUR_UI::toggle_use_midi_control ()
 {
-       toggle_session_state ("options", "UseMIDIcontrol", &Session::set_midi_control);
+       toggle_session_state ("options", "UseMIDIcontrol", &Session::set_midi_control, &Session::get_midi_control);
 }
 
 void
 ARDOUR_UI::toggle_send_midi_feedback ()
 {
-       toggle_session_state ("options", "SendMIDIfeedback", &Session::set_midi_feedback);
+       toggle_session_state ("options", "SendMIDIfeedback", &Session::set_midi_feedback, &Session::get_midi_feedback);
 }
 
 void
 ARDOUR_UI::toggle_AutoConnectNewTrackInputsToHardware()
 {
+       toggle_session_state ("options", "AutoConnectNewTrackInputsToHardware", &Session::set_input_auto_connect, &Session::get_input_auto_connect);
 }
 void
 ARDOUR_UI::toggle_AutoConnectNewTrackOutputsToHardware()
 {
+       toggle_session_state ("options", "AutoConnectNewTrackOutputsToHardware", bind (mem_fun (session, &Session::set_output_auto_connect), Session::AutoConnectPhysical));
 }
 void
 ARDOUR_UI::toggle_AutoConnectNewTrackOutputsToMaster()
 {
+       toggle_session_state ("options", "AutoConnectNewTrackOutputsToHardware", bind (mem_fun (session, &Session::set_output_auto_connect), Session::AutoConnectMaster));
 }
 void
 ARDOUR_UI::toggle_ManuallyConnectNewTrackOutputs()
 {
+       toggle_session_state ("options", "AutoConnectNewTrackOutputsToHardware", bind (mem_fun (session, &Session::set_output_auto_connect), Session::AutoConnectOption (0)));
 }
+
 void
 ARDOUR_UI::toggle_UseHardwareMonitoring()
 {
+       Glib::RefPtr<Action> act = ActionManager::get_action ("options", "UseSoftwareMonitoring");
+       if (act) {
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+               if (tact->get_active()) {
+                       Config->set_use_hardware_monitoring (true);
+                       Config->set_use_sw_monitoring (false);
+                       if (session) {
+                               session->reset_input_monitor_state();
+                       }
+               }
+       }
 }
+
 void
 ARDOUR_UI::toggle_UseSoftwareMonitoring()
 {
+       Glib::RefPtr<Action> act = ActionManager::get_action ("options", "UseSoftwareMonitoring");
+       if (act) {
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+               if (tact->get_active()) {
+                       Config->set_use_hardware_monitoring (false);
+                       Config->set_use_sw_monitoring (true);
+                       if (session) {
+                               session->reset_input_monitor_state();
+                       }
+               }
+       }
 }
+
 void
 ARDOUR_UI::toggle_UseExternalMonitoring()
 {
+       Glib::RefPtr<Action> act = ActionManager::get_action ("options", "UseExternalMonitoring");
+       if (act) {
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+               if (tact->get_active()) {
+                       Config->set_use_hardware_monitoring (false);
+                       Config->set_use_sw_monitoring (false);
+                       if (session) {
+                               session->reset_input_monitor_state();
+                       }
+               }
+       }
 }
+
 void
 ARDOUR_UI::toggle_StopPluginsWithTransport()
 {
+       toggle_config_state ("options", "StopPluginsWithTransport", &Configuration::set_plugins_stop_with_transport);
 }
 void
 ARDOUR_UI::toggle_RunPluginsWhileRecording()
 {
+       toggle_session_state ("options", "RunPluginsWhileRecording", &Session::set_recording_plugins, &Session::get_recording_plugins);
 }
+
 void
 ARDOUR_UI::toggle_VerifyRemoveLastCapture()
 {
+       toggle_config_state ("options", "VerifyRemoveLastCapture", &Configuration::set_verify_remove_last_capture);
 }
+
 void
 ARDOUR_UI::toggle_StopRecordingOnXrun()
 {
+       toggle_config_state ("options", "StopRecordingOnXrun", &Configuration::set_stop_recording_on_xrun);
 }
+
 void
 ARDOUR_UI::toggle_StopTransportAtEndOfSession()
 {
+       toggle_config_state ("options", "StopTransportAtEndOfSession", &Configuration::set_stop_at_session_end);
 }
+
 void
 ARDOUR_UI::toggle_GainReduceFastTransport()
 {
+       Glib::RefPtr<Action> act = ActionManager::get_action ("options", "GainReduceFastTransport");
+       if (act) {
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+               if (tact->get_active()) {
+                       Config->set_quieten_at_speed (0.251189); // -12dB reduction for ffwd or rewind
+               } else {
+                       Config->set_quieten_at_speed (1.0); /* no change */
+               }
+       }
 }
+
 void
 ARDOUR_UI::toggle_LatchedSolo()
 {
+       toggle_session_state ("options", "LatchedSolo", &Session::set_solo_latched, &Session::solo_latched);
 }
+
 void
 ARDOUR_UI::toggle_SoloViaBus()
 {
+       if (!session) {
+               return;
+       }
+
+       Glib::RefPtr<Action> act = ActionManager::get_action ("options", "SoloViaBus");
+       if (act) {
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+
+               if (tact->get_active()) {
+                       session->set_solo_model (Session::SoloBus);
+               } else {
+                       session->set_solo_model (Session::InverseMute);
+               }
+       }
 }
+
 void
 ARDOUR_UI::toggle_AutomaticallyCreateCrossfades()
 {
@@ -150,3 +258,187 @@ void
 ARDOUR_UI::toggle_UnmuteNewFullCrossfades()
 {
 }
+
+void
+ARDOUR_UI::mtc_port_changed ()
+{
+       bool have_mtc;
+
+       if (session) {
+               if (session->mtc_port()) {
+                       have_mtc = true;
+               } else {
+                       have_mtc = false;
+               }
+       } else {
+               have_mtc = false;
+       }
+
+       if (have_mtc) {
+               const gchar *psync_strings[] = {
+                       N_("Internal"),
+                       N_("MTC"),
+                       N_("JACK"),
+                       0
+               };
+               
+               positional_sync_strings = internationalize (psync_strings);
+               
+       } else {
+               const gchar *psync_strings[] = {
+                       N_("Internal"),
+                       N_("JACK"),
+                       0
+               };
+               positional_sync_strings = internationalize (psync_strings);
+       }
+       
+       set_popdown_strings (sync_option_combo, positional_sync_strings);
+}
+
+void
+ARDOUR_UI::setup_options ()
+{
+       mtc_port_changed ();
+
+       session_control_changed (Session::SlaveType);
+       session_control_changed (Session::SendMTC);
+       session_control_changed (Session::SendMMC);
+       session_control_changed (Session::MMCControl);
+       session_control_changed (Session::MidiFeedback);
+       session_control_changed (Session::MidiControl);
+       session_control_changed (Session::RecordingPlugins);
+       session_control_changed (Session::CrossFadesActive);
+       session_control_changed (Session::SoloLatch);
+       session_control_changed (Session::SoloingModel);
+       session_control_changed (Session::LayeringModel);
+       session_control_changed (Session::CrossfadingModel);
+
+       session->ControlChanged.connect (mem_fun (*this, &ARDOUR_UI::queue_session_control_changed));
+}
+
+void
+ARDOUR_UI::map_some_session_state (const char* group, const char* action, bool (Session::*get)() const)
+{
+       if (!session) {
+               return;
+       }
+
+       Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
+       if (act) {
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+               bool x = (session->*get)();
+               if (tact->get_active() != x) {
+                       tact->set_active (x);
+               }
+       }
+}
+
+void
+ARDOUR_UI::queue_session_control_changed (Session::ControlType t)
+{
+       ENSURE_GUI_THREAD (bind (mem_fun (*this, &ARDOUR_UI::session_control_changed), t));
+}
+
+void
+ARDOUR_UI::session_control_changed (Session::ControlType t)
+{
+       switch (t) {
+       case Session::SlaveType:
+               switch (session->slave_source()) {
+               case Session::None:
+                       sync_option_combo.set_active_text (_("Internal"));
+                       break;
+               case Session::MTC:
+                       sync_option_combo.set_active_text (_("MTC"));
+                       break;
+               case Session::JACK:
+                       sync_option_combo.set_active_text (_("JACK"));
+                       break;
+               }
+               
+               break;
+
+       case Session::SendMTC:
+               map_some_session_state ("options", "SendMTC", &Session::get_send_mtc);
+               break;
+
+       case Session::SendMMC:
+               map_some_session_state ("options", "SendMMC", &Session::get_send_mmc);
+               break;
+
+       case Session::MMCControl:       
+               map_some_session_state ("options", "UseMMC", &Session::get_mmc_control);
+               break;
+
+       case Session::MidiFeedback:       
+               map_some_session_state ("options", "SendMIDIfeedback", &Session::get_midi_feedback);
+               break;
+
+       case Session::MidiControl:       
+               map_some_session_state ("options", "UseMIDIcontrol", &Session::get_midi_control);
+               break;
+
+       case Session::RecordingPlugins:
+               map_some_session_state ("options", "RunPluginsWhileRecording", &Session::get_recording_plugins);
+               break;
+
+       case Session::CrossFadesActive:
+               map_some_session_state ("options", "CrossfadesActive", &Session::get_crossfades_active);
+               break;
+
+       case Session::SoloLatch:
+               break;
+
+       case Session::SoloingModel:
+               switch (session->solo_model()) {
+               case Session::InverseMute:
+                       break;
+               case Session::SoloBus:
+                       break;
+               }
+               break;
+
+       case Session::LayeringModel:
+               break;
+
+       case Session::CrossfadingModel:
+               break;
+
+               
+        // BUTTON STATE: fix me in the future to use actions
+
+
+       case Session::AutoPlay:
+               map_some_session_state (auto_play_button, &Session::get_auto_play);
+               break;
+
+       case Session::AutoLoop:
+               break;
+
+       case Session::AutoReturn:
+               map_some_session_state (auto_return_button, &Session::get_auto_return);
+               break;
+
+       case Session::AutoInput:
+               map_some_session_state (auto_input_button, &Session::get_auto_input);
+               break;
+
+       case Session::PunchOut:
+               map_some_session_state (punch_in_button, &Session::get_punch_out);
+               break;
+
+       case Session::PunchIn:
+               map_some_session_state (punch_in_button, &Session::get_punch_in);
+               break;
+
+       case Session::Clicking:
+               map_some_session_state (click_button, &Session::get_clicking);
+               break;
+
+       default:
+               // somebody else handles this 
+               break;
+
+       }
+}
index 5bc2590446f715402347dc231eab2cfecdf742c3..a44eba37544994c64241a983f5ecd0092d82decf 100644 (file)
@@ -669,7 +669,7 @@ Editor::Editor (AudioEngine& eng)
 
        edit_pane.pack1 (edit_frame, true, true);
        edit_pane.pack2 (*notebook_tearoff, true, true);
-
+       
        edit_pane.signal_size_allocate().connect_notify (bind (mem_fun(*this, &Editor::pane_allocation_handler), static_cast<Paned*> (&edit_pane)));
 
        top_hbox.pack_start (toolbar_frame, true, true);
@@ -2605,23 +2605,35 @@ Editor::setup_toolbar ()
 
        selection_start_clock_label.set_text (_("Start:"));
        selection_end_clock_label.set_text (_("End:"));
-       edit_cursor_clock_label.set_text (_("Edit:"));
+       edit_cursor_clock_label.set_text (_("Edit"));
 
-       toolbar_selection_clock_table.set_border_width (5);
-       toolbar_selection_clock_table.set_col_spacings (2);
-       toolbar_selection_clock_table.set_homogeneous (false);
+       /* the zoom in/out buttons are generally taller than the clocks, so
+          put all the toolbar clocks into a size group with one of the 
+          buttons to make them all equal height.
+
+          this also applies to the various toolbar combos
+       */
 
-//     toolbar_selection_clock_table.attach (selection_start_clock_label, 0, 1, 0, 1, 0, 0, 0, 0);
-//     toolbar_selection_clock_table.attach (selection_end_clock_label, 1, 2, 0, 1, 0, 0, 0, 0);
-       toolbar_selection_clock_table.attach (edit_cursor_clock_label, 2, 3, 0, 1, FILL, FILL, 0, 0);
+       RefPtr<SizeGroup> toolbar_clock_size_group = SizeGroup::create (SIZE_GROUP_VERTICAL);
+       toolbar_clock_size_group->add_widget (zoom_out_button);
+       toolbar_clock_size_group->add_widget (edit_cursor_clock);
+       toolbar_clock_size_group->add_widget (zoom_range_clock);
+       toolbar_clock_size_group->add_widget (nudge_clock);
+       toolbar_clock_size_group->add_widget (edit_mode_selector);
+       toolbar_clock_size_group->add_widget (snap_type_selector);
+       toolbar_clock_size_group->add_widget (snap_mode_selector);
+       toolbar_clock_size_group->add_widget (zoom_focus_selector);
 
-//     toolbar_selection_clock_table.attach (selection_start_clock, 0, 1, 1, 2, 0, 0);
-//     toolbar_selection_clock_table.attach (selection_end_clock, 1, 2, 1, 2, 0, 0);
-       toolbar_selection_clock_table.attach (edit_cursor_clock, 2, 3, 1, 2, FILL, FILL);
+       HBox* edit_clock_hbox = manage (new HBox());
+       VBox* edit_clock_vbox = manage (new VBox());
 
+       edit_clock_hbox->pack_start (edit_cursor_clock, false, false);
+
+       edit_clock_vbox->set_spacing (3);
+       edit_clock_vbox->set_border_width (3);
+       edit_clock_vbox->pack_start (edit_cursor_clock_label, false, false);
+       edit_clock_vbox->pack_start (*edit_clock_hbox, false, false);
 
-//     toolbar_clock_vbox.set_spacing (2);
-//     toolbar_clock_vbox.set_border_width (10);
        /* the editor/mixer button will be enabled at session connect */
 
        editor_mixer_button.set_active(false);
@@ -2630,7 +2642,7 @@ Editor::setup_toolbar ()
        HBox* hbox = new HBox;
 
        hbox->pack_start (editor_mixer_button, false, false);
-       hbox->pack_start (toolbar_selection_clock_table, false, false);
+       hbox->pack_start (*edit_clock_vbox, false, false);
        hbox->pack_start (zoom_indicator_vbox, false, false); 
        hbox->pack_start (zoom_focus_box, false, false);
        hbox->pack_start (snap_type_box, false, false);
@@ -3643,7 +3655,7 @@ Editor::pane_allocation_handler (Allocation &alloc, Paned* which)
        char buf[32];
        XMLNode* node = ARDOUR_UI::instance()->editor_settings();
        int width, height;
-       static int32_t done[4] = { 0, 0, 0, 0 };
+       static int32_t done;
        XMLNode* geometry;
 
        if ((geometry = find_named_node (*node, "geometry")) == 0) {
@@ -3656,18 +3668,19 @@ Editor::pane_allocation_handler (Allocation &alloc, Paned* which)
 
        if (which == static_cast<Paned*> (&edit_pane)) {
 
-               if (done[0]) {
+               if (done) {
                        return;
                }
 
                if (!geometry || (prop = geometry->property ("edit_pane_pos")) == 0) {
-                       pos = 75;
+                       /* initial allocation is 90% to canvas, 10% to notebook */
+                       pos = (int) floor (alloc.get_width() * 0.90f);
                        snprintf (buf, sizeof(buf), "%d", pos);
                } else {
                        pos = atoi (prop->value());
                }
-
-               if ((done[0] = GTK_WIDGET(edit_pane.gobj())->allocation.width > pos)) {
+               
+               if ((done = GTK_WIDGET(edit_pane.gobj())->allocation.width > pos)) {
                        edit_pane.set_position (pos);
                }
        }
index 74a565cd914826cf177ff629689c04f76e22396a..349781c4062841c44ff68a457cc9ef76b16b5a16 100644 (file)
@@ -278,6 +278,13 @@ class Editor : public PublicEditor
        void toggle_follow_playhead ();
        bool follow_playhead() const { return _follow_playhead; }
 
+       void toggle_waveform_visibility ();
+       void toggle_waveforms_while_recording ();
+       void toggle_measure_visibility ();
+
+       void set_meter_falloff (float);
+       void set_meter_hold (int32_t);
+
        /* xfades */
 
        void toggle_xfades_active();
index 35a9ac6d54052e05975453e8b38c45584ec3d863..dbf7bc1c89436b86394e53821c012dac4e459971 100644 (file)
@@ -21,10 +21,15 @@ Editor::register_actions ()
        RefPtr<ActionGroup> editor_actions = ActionGroup::create (X_("Editor"));
        
        /* non-operative menu items for menu bar */
--
+
        ActionManager::register_action (editor_actions, X_("Edit"), _("Edit"));
        ActionManager::register_action (editor_actions, X_("View"), _("View"));
        ActionManager::register_action (editor_actions, X_("ZoomFocus"), _("ZoomFocus"));
+       ActionManager::register_action (editor_actions, X_("MeterHold"), _("Meter hold"));
+       ActionManager::register_action (editor_actions, X_("MeterFalloff"), _("Meter falloff"));
+       ActionManager::register_action (editor_actions, X_("Solo"), _("Solo"));
+       ActionManager::register_action (editor_actions, X_("Monitoring"), _("Monitoring"));
+       ActionManager::register_action (editor_actions, X_("Autoconnect"), _("Autoconnect"));
 
        /* add named actions for the editor */
 
@@ -165,7 +170,7 @@ Editor::register_actions ()
        ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_action (editor_actions, "normalize-region", _("normalize region"), mem_fun(*this, &Editor::normalize_region));
        ActionManager::session_sensitive_actions.push_back (act);
-       act = ActionManager::register_action (editor_actions, "editor-crop", _("editor crop"), mem_fun(*this, &Editor::crop_region_to_selection));
+       act = ActionManager::register_action (editor_actions, "crop", _("crop"), mem_fun(*this, &Editor::crop_region_to_selection));
        ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_action (editor_actions, "insert-chunk", _("insert chunk"), bind (mem_fun(*this, &Editor::paste_named_selection), 1.0f));
        ActionManager::session_sensitive_actions.push_back (act);
@@ -200,8 +205,6 @@ Editor::register_actions ()
        Glib::RefPtr<ActionGroup> zoom_actions = ActionGroup::create (X_("Zoom"));
        RadioAction::Group zoom_group;
 
-       ActionManager::register_action (editor_actions, X_("ZoomFocus"), _("Zoom focus"));
-
        ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-left", _("zoom focus left"), bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusLeft));
        ActionManager::session_sensitive_actions.push_back (act);
        ActionManager::register_radio_action (zoom_actions, zoom_group, "zoom-focus-right", _("zoom focus right"), bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusRight));
@@ -297,13 +300,30 @@ Editor::register_actions ()
        act = ActionManager::register_action (rl_actions, X_("rlImportAudio"), _("Embed audio (link)"), bind (mem_fun(*this, &Editor::import_audio), false));
        ActionManager::session_sensitive_actions.push_back (act);
 
-#ifdef NEW_ACTIONS
+       ActionManager::register_toggle_action (editor_actions, X_("ToggleWaveformVisibility"), _("show waveforms"), mem_fun (*this, &Editor::toggle_waveform_visibility));
+       ActionManager::register_toggle_action (editor_actions, X_("ToggleWaveformsWhileRecording"), _("show waveforms while recording"), mem_fun (*this, &Editor::toggle_waveforms_while_recording));
+       ActionManager::register_toggle_action (editor_actions, X_("ToggleMeasureVisibility"), _("show measures"), mem_fun (*this, &Editor::toggle_measure_visibility));
+
+       RadioAction::Group meter_falloff_group;
+       RadioAction::Group meter_hold_group;
 
-       ToggleWaveformVisibility;
-       ToggleWaveformsWhileRecording;
-       ToggleMeasureVisibility;
+       /*
+           Slowest = 6.6dB/sec falloff at update rate of 40ms
+           Slow    = 6.8dB/sec falloff at update rate of 40ms
+       */
 
-#endif
+       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffOff"), _("off"), bind (mem_fun (*this, &Editor::set_meter_falloff), 0.0f));
+       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffSlowest"), _("slowest"), bind (mem_fun (*this, &Editor::set_meter_falloff), 0.266f)); 
+       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffSlow"), _("slow"), bind (mem_fun (*this, &Editor::set_meter_falloff), 0.342f));
+       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffMedium"), _("medium"), bind (mem_fun (*this, &Editor::set_meter_falloff), 0.7f));
+       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffFast"), _("fast"), bind (mem_fun (*this, &Editor::set_meter_falloff), 1.1f));
+       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffFaster"), _("faster"), bind (mem_fun (*this, &Editor::set_meter_falloff), 1.5f));
+       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffFastest"), _("fastest"), bind (mem_fun (*this, &Editor::set_meter_falloff), 2.5f));
+
+       ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldOff"), _("off"), bind (mem_fun (*this, &Editor::set_meter_hold), 0));
+       ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldShort"), _("short"), bind (mem_fun (*this, &Editor::set_meter_hold), 40));
+       ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldMedium"), _("medium"), bind (mem_fun (*this, &Editor::set_meter_hold), 100));
+       ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldLong"), _("long"), bind (mem_fun (*this, &Editor::set_meter_hold), 200));
 
        ActionManager::add_action_group (rl_actions);
        ActionManager::add_action_group (zoom_actions);
@@ -311,3 +331,34 @@ Editor::register_actions ()
        ActionManager::add_action_group (snap_actions);
        ActionManager::add_action_group (editor_actions);
 }
+
+void
+Editor::toggle_waveform_visibility ()
+{
+       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformVisibility"));
+       if (act) {
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+               set_show_waveforms (tact->get_active());
+       }
+}
+
+void
+Editor::toggle_waveforms_while_recording ()
+{
+       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformVisibility"));
+       if (act) {
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+               set_show_waveforms_recording (tact->get_active());
+       }
+}
+
+void
+Editor::toggle_measure_visibility ()
+{
+       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformVisibility"));
+       if (act) {
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+               set_show_measures (tact->get_active());
+       }
+}
+
index fa0649faf16ed4cc1eb2746b0b585d51008b04c5..64d00f56abde860886e2c9de472c58bbcf53a382 100644 (file)
@@ -3244,8 +3244,9 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
                        }
 
                        rv->get_time_axis_view().reveal_dependent_views (*rv);
+
+                       /* no need to add an undo here, we did that when we added this playlist to motion_frozen playlists */
                        
-                       session->add_undo (rv->region.playlist()->get_memento());
                        rv->region.set_position (where, (void *) this);
                }
        }
index aa8eec8df32b9278db679ebbe7da5bb4069e80c2..7bc088e2df5e9cbbfb1ccd72a96c3543a2a3e51c 100644 (file)
@@ -79,6 +79,7 @@ void
 Editor::undo (uint32_t n)
 {
        if (session) {
+               cerr << "Undo " << n << " operations\n";
                session->undo (n);
        }
 }
@@ -91,6 +92,23 @@ Editor::redo (uint32_t n)
        }
 }
 
+void
+Editor::set_meter_hold (int32_t cnt)
+{
+       if (session) {
+               session->set_meter_hold (cnt);
+       }
+}
+
+void
+Editor::set_meter_falloff (float val)
+{
+       if (session) {
+               session->set_meter_falloff (val);
+       }
+}
+
+
 int
 Editor::ensure_cursor (jack_nframes_t *pos)
 {
index 771a3eda9f133de24e220204a3c8da734b47336e..346f9ec2dd180271d8251ff3d7ef3f2599eb26f9 100644 (file)
@@ -1244,7 +1244,7 @@ MixerStrip::build_route_ops_menu ()
 {
        using namespace Menu_Helpers;
 
-       route_ops_menu = new Menu;
+       route_ops_menu = manage (new Menu);
        route_ops_menu->set_name ("ArdourContextMenu");
 
        MenuList& items = route_ops_menu->items();
@@ -1255,6 +1255,11 @@ MixerStrip::build_route_ops_menu ()
        route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
        route_active_menu_item->set_active (_route.active());
 
+       build_remote_control_menu ();
+       
+       items.push_back (SeparatorElem());
+       items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
+
        items.push_back (SeparatorElem());
        items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
 }
@@ -1274,6 +1279,8 @@ MixerStrip::list_route_operations ()
        if (route_ops_menu == 0) {
                build_route_ops_menu ();
        }
+       
+       refresh_remote_control_menu();
 
        route_ops_menu->popup (1, 0);
 }
index 8b69e26379488b8cf13b3718f9b7c828e0c8abdc..f348b96803bcec404411e4e604fc344ec3efb813 100644 (file)
@@ -220,7 +220,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
 
        void set_automated_controls_sensitivity (bool yn);
 
-       Gtk::Menu *route_ops_menu;
+       Gtk::Menuroute_ops_menu;
        void build_route_ops_menu ();
        gint name_button_button_release (GdkEventButton*);
        void list_route_operations ();
@@ -268,6 +268,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
 
        string solo_button_name () const { return "MixerSoloButton"; }
        string safe_solo_button_name () const { return "MixerSafeSoloButton"; }
+
 };
 
 #endif /* __ardour_mixer_strip__ */
index 049bf5331be2f69ae2e503e68312f30ccb1f8532..c31fdb98f540e6a1c5cb626d830999b746a333f4 100644 (file)
@@ -45,14 +45,6 @@ using namespace Editing;
 using namespace Gtkmm2ext;
 using namespace std;
 
-static const gchar *psync_strings[] = {
-       N_("Internal"),
-       N_("Slave to MTC"),
-       N_("Sync with JACK"),
-       N_("never used but stops crashes"),
-       0
-};
-
 static const gchar *lmode_strings[] = {
        N_("Later regions are higher"),
        N_("Most recently added/moved/trimmed regions are higher"),
@@ -91,32 +83,13 @@ OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
          short_xfade_adjustment (0, 1.0, 500.0, 5.0, 100.0),
          short_xfade_slider (short_xfade_adjustment),
 
-         /* solo */
-         solo_latched_button (_("Latched solo")),
-         solo_via_bus_button (_("Solo via bus")),
-
-         /* display */
-
-         show_waveforms_button (_("Show waveforms")),
-         show_waveforms_recording_button (_("Show waveforms while recording")),
-         mixer_strip_width_button (_("Narrow mixer strips")),
-         show_measures_button (_("Show measure lines")),
-         follow_playhead_button (_("Follow playhead")),
-         
          /* Sync */
 
-         send_mtc_button (_("Send MTC")),
-         send_mmc_button (_("Send MMC")),
-         jack_time_master_button (_("JACK time master")),
          smpte_offset_clock (X_("SMPTEOffsetClock"), true, true),
          smpte_offset_negative_button (_("SMPTE offset is negative")),
 
          /* MIDI */
 
-         midi_feedback_button (_("Send MIDI parameter feedback")),
-         midi_control_button (_("MIDI parameter control")),
-         mmc_control_button (_("MMC control")),
-         
          /* Click */
 
          click_table (2, 3),
@@ -129,23 +102,7 @@ OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
          delete_button_adjustment (3, 1, 5),
          delete_button_spin (delete_button_adjustment),
          edit_button_adjustment (3, 1, 5),
-         edit_button_spin (edit_button_adjustment),
-
-         /* Misc */
-
-         auto_connect_inputs_button (_("Auto-connect new track inputs to hardware")),
-         auto_connect_output_physical_button (_("Auto-connect new track outputs to hardware")),
-         auto_connect_output_master_button (_("Auto-connect new track outputs to master bus")),
-         auto_connect_output_manual_button (_("Manually connect new track outputs")),
-         hw_monitor_button(_("Use Hardware Monitoring")),
-         sw_monitor_button(_("Use Software Monitoring")),
-         plugins_stop_button (_("Stop plugins with transport")),
-         plugins_on_rec_button (_("Run plugins while recording")),
-         verify_remove_last_capture_button (_("Verify remove last capture")),
-         stop_rec_on_xrun_button (_("Stop recording on xrun")),
-         stop_at_end_button (_("Stop transport at end of session")),
-         debug_keyboard_button (_("Debug keyboard events")),
-         speed_quieten_button (_("-12dB gain reduction for ffwd/rew"))
+         edit_button_spin (edit_button_adjustment)
          
 {
        using namespace Notebook_Helpers;
@@ -178,21 +135,15 @@ OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
        setup_sync_options();
        setup_path_options();
        setup_fade_options ();
-       setup_solo_options ();
-       setup_display_options ();
-       setup_misc_options ();
        setup_keyboard_options ();
        setup_auditioner_editor ();
 
-       notebook.pages().push_back (TabElem (misc_packer, _("Misc")));
        notebook.pages().push_back (TabElem (sync_packer, _("Sync")));
        notebook.pages().push_back (TabElem (path_table, _("Paths/Files")));
-       notebook.pages().push_back (TabElem (display_packer, _("Display")));
        notebook.pages().push_back (TabElem (keyboard_mouse_table, _("Kbd/Mouse")));
        notebook.pages().push_back (TabElem (click_packer, _("Click")));
        notebook.pages().push_back (TabElem (audition_packer, _("Audition")));
        notebook.pages().push_back (TabElem (fade_packer, _("Layers & Fades")));
-       notebook.pages().push_back (TabElem (solo_packer, _("Solo")));
 
        if (!MIDI::Manager::instance()->get_midi_ports().empty()) {
                setup_midi_options ();
@@ -213,26 +164,11 @@ OptionEditor::set_session (Session *s)
        click_emphasis_path_entry.set_text ("");
        session_raid_entry.set_text ("");
 
-       send_mtc_button.set_sensitive (false);
-       send_mmc_button.set_sensitive (false);
-       midi_feedback_button.set_sensitive (false);
-       midi_control_button.set_sensitive (false);
-       mmc_control_button.set_sensitive (false);
        click_path_entry.set_sensitive (false);
        click_emphasis_path_entry.set_sensitive (false);
        session_raid_entry.set_sensitive (false);
-       plugins_on_rec_button.set_sensitive (false);
-       verify_remove_last_capture_button.set_sensitive (false);
-       slave_type_combo.set_sensitive (false);
-       solo_latched_button.set_sensitive (false);
-       solo_via_bus_button.set_sensitive (false);
+
        smpte_fps_combo.set_sensitive (false);
-       meter_hold_combo.set_sensitive (false);
-       meter_falloff_combo.set_sensitive (false);
-       auto_connect_inputs_button.set_sensitive (false);
-       auto_connect_output_physical_button.set_sensitive (false);
-       auto_connect_output_master_button.set_sensitive (false);
-       auto_connect_output_manual_button.set_sensitive (false);
        layer_mode_combo.set_sensitive (false);
        short_xfade_slider.set_sensitive (false);
        smpte_offset_negative_button.set_sensitive (false);
@@ -243,26 +179,11 @@ OptionEditor::set_session (Session *s)
                return;
        }
 
-       send_mtc_button.set_sensitive (true);
-       send_mmc_button.set_sensitive (true);
-       midi_feedback_button.set_sensitive (true);
-       midi_control_button.set_sensitive (true);
-       mmc_control_button.set_sensitive (true);
+
        click_path_entry.set_sensitive (true);
        click_emphasis_path_entry.set_sensitive (true);
        session_raid_entry.set_sensitive (true);
-       plugins_on_rec_button.set_sensitive (true);
-       verify_remove_last_capture_button.set_sensitive (true);
-       slave_type_combo.set_sensitive (true);
-       solo_latched_button.set_sensitive (true);
-       solo_via_bus_button.set_sensitive (true);
        smpte_fps_combo.set_sensitive (true);
-       meter_hold_combo.set_sensitive (true);
-       meter_falloff_combo.set_sensitive (true);
-       auto_connect_inputs_button.set_sensitive (true);
-       auto_connect_output_physical_button.set_sensitive (true);
-       auto_connect_output_master_button.set_sensitive (true);
-       auto_connect_output_manual_button.set_sensitive (true);
        layer_mode_combo.set_sensitive (true);
        short_xfade_slider.set_sensitive (true);
        smpte_offset_negative_button.set_sensitive (true);
@@ -289,14 +210,6 @@ OptionEditor::set_session (Session *s)
        smpte_offset_clock.set (s->smpte_offset (), true);
 
        smpte_offset_negative_button.set_active (session->smpte_offset_negative());
-       send_mtc_button.set_active (session->get_send_mtc());
-
-       /* MIDI I/O */
-
-       send_mmc_button.set_active (session->get_send_mmc());
-       midi_control_button.set_active (session->get_midi_control());
-       midi_feedback_button.set_active (session->get_midi_feedback());
-       mmc_control_button.set_active (session->get_mmc_control());
 
        /* set up port assignments */
 
@@ -320,77 +233,15 @@ OptionEditor::set_session (Session *s)
                }
        }
 
-       auto_connect_inputs_button.set_active (session->get_input_auto_connect());
-
-       Session::AutoConnectOption oac = session->get_output_auto_connect();
-       if (oac & Session::AutoConnectPhysical) {
-               auto_connect_output_physical_button.set_active (true);
-       } else if (oac & Session::AutoConnectMaster) {
-               auto_connect_output_master_button.set_active (true);
-       } else {
-               auto_connect_output_manual_button.set_active (true);
-       }
-
        setup_click_editor ();
        connect_audition_editor ();
 
-       plugins_on_rec_button.set_active (session->get_recording_plugins ());
-       verify_remove_last_capture_button.set_active (Config->get_verify_remove_last_capture());
-
        layer_mode_combo.set_active_text (layer_mode_strings[session->get_layer_model()]);
        xfade_model_combo.set_active_text (xfade_model_strings[session->get_xfade_model()]);
 
        short_xfade_adjustment.set_value ((Crossfade::short_xfade_length() / (float) session->frame_rate()) * 1000.0);
 
-       xfade_active_button.set_active (session->get_crossfades_active());
-       solo_latched_button.set_active (session->solo_latched());
-       solo_via_bus_button.set_active (session->solo_model() == Session::SoloBus);
-       
        add_session_paths ();
-
-       vector<string> dumb;
-       dumb.push_back (positional_sync_strings[Session::None]);
-       dumb.push_back (positional_sync_strings[Session::JACK]);
-       if (session->mtc_port()) {
-               dumb.push_back (positional_sync_strings[Session::MTC]);
-       } 
-       set_popdown_strings (slave_type_combo, dumb);
-
-       // meter stuff
-       if (session->meter_falloff() == 0.0f) {
-               meter_falloff_combo.set_active_text (_("Off"));
-       } else if (session->meter_falloff() <= 0.3f) {
-               meter_falloff_combo.set_active_text (_("Slowest"));
-       } else if (session->meter_falloff() <= 0.4f) {
-               meter_falloff_combo.set_active_text (_("Slow"));
-       } else if (session->meter_falloff() <= 0.8f) {
-               meter_falloff_combo.set_active_text (_("Medium"));
-       } else if (session->meter_falloff() <= 1.4f) {
-               meter_falloff_combo.set_active_text (_("Fast"));
-       } else if (session->meter_falloff() <= 2.0f) {
-               meter_falloff_combo.set_active_text (_("Faster"));
-       } else {
-               meter_falloff_combo.set_active_text (_("Fastest"));
-       }
-
-       switch ((int) floor (session->meter_hold())) {
-       case 0:
-               meter_hold_combo.set_active_text (_("Off"));
-               break;
-       case 40:
-               meter_hold_combo.set_active_text (_("Short"));
-               break;
-       case 100:
-               meter_hold_combo.set_active_text (_("Medium"));
-               break;
-       case 200:
-               meter_hold_combo.set_active_text (_("Long"));
-               break;
-       }
-       
-       session_control_changed (Session::SlaveType);
-       session_control_changed (Session::AlignChoice);
-       session->ControlChanged.connect (mem_fun(*this, &OptionEditor::queue_session_control_changed));
 }
 
 OptionEditor::~OptionEditor ()
@@ -608,237 +459,12 @@ OptionEditor::xfade_active_clicked ()
        }
 }
 
-void
-OptionEditor::setup_solo_options ()
-{
-       Gtk::HBox* hbox;
-
-       solo_via_bus_button.set_name ("OptionEditorToggleButton");
-       solo_latched_button.set_name ("OptionEditorToggleButton");
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (12);
-       hbox->pack_start (solo_via_bus_button, false, false);
-       solo_packer.pack_start (*hbox, false, false);
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (12);
-       hbox->pack_start (solo_latched_button, false, false);
-       solo_packer.pack_start (*hbox, false, false);
-
-       solo_via_bus_button.signal_clicked().connect 
-               (mem_fun(*this, &OptionEditor::solo_via_bus_clicked));
-       solo_latched_button.signal_clicked().connect 
-               (mem_fun(*this, &OptionEditor::solo_latched_clicked));
-
-       solo_packer.show_all ();
-}
-
-void
-OptionEditor::solo_via_bus_clicked ()
-{
-       if (!session) {
-               return;
-       }
-
-       if (solo_via_bus_button.get_active()) {
-               session->set_solo_model (Session::SoloBus);
-       } else {
-               session->set_solo_model (Session::InverseMute);
-       }
-}
-
-void
-OptionEditor::solo_latched_clicked ()
-{
-       if (!session) {
-               return;
-       }
-
-       bool x = solo_latched_button.get_active();
-
-       if (x != session->solo_latched()) {
-               session->set_solo_latched (x);
-       }
-}
-
-void
-OptionEditor::setup_display_options ()
-{
-       HBox* hbox;
-       vector<string> dumb;
-
-       display_packer.set_border_width (12);
-       display_packer.set_spacing (5);
-
-       show_waveforms_button.set_name ("OptionEditorToggleButton");
-       show_waveforms_recording_button.set_name ("OptionEditorToggleButton");
-       show_measures_button.set_name ("OptionEditorToggleButton");
-       follow_playhead_button.set_name ("OptionEditorToggleButton");
-       mixer_strip_width_button.set_name ("OptionEditorToggleButton");
-
-       mixer_strip_width_button.set_active (mixer.get_strip_width() == Narrow);
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (8);
-       hbox->pack_start (show_waveforms_button, false, false);
-       display_packer.pack_start (*hbox, false, false);
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (8);
-       hbox->pack_start (show_waveforms_recording_button, false, false);
-       display_packer.pack_start (*hbox, false, false);
-       
-       hbox = manage (new HBox);
-       hbox->set_border_width (8);
-       hbox->pack_start (show_measures_button, false, false);
-       display_packer.pack_start (*hbox, false, false);
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (8);
-       hbox->pack_start (mixer_strip_width_button, false, false);
-       display_packer.pack_start (*hbox, false, false);
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (8);
-       hbox->pack_start (follow_playhead_button, false, false);
-       display_packer.pack_start (*hbox, false, false);
-
-       Label *meter_hold_label = manage (new Label (_("Meter Peak Hold")));
-       meter_hold_label->set_name ("OptionsLabel");
-       dumb.clear ();
-       dumb.push_back (_("Off"));
-       dumb.push_back (_("Short"));
-       dumb.push_back (_("Medium"));
-       dumb.push_back (_("Long"));
-       set_popdown_strings (meter_hold_combo, dumb);
-       meter_hold_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::meter_hold_chosen));
-       hbox = manage (new HBox);
-       hbox->set_border_width (8);
-       hbox->set_spacing (8);
-       hbox->pack_start (*meter_hold_label, false, false);
-       hbox->pack_start (meter_hold_combo, false, false);
-       display_packer.pack_start (*hbox, false, false);
-
-       Label *meter_falloff_label = manage (new Label (_("Meter Falloff")));
-       meter_falloff_label->set_name ("OptionsLabel");
-       dumb.clear ();
-       dumb.push_back (_("Off"));
-       dumb.push_back (_("Slowest"));
-       dumb.push_back (_("Slow"));
-       dumb.push_back (_("Medium"));
-       dumb.push_back (_("Fast"));
-       dumb.push_back (_("Faster"));
-       dumb.push_back (_("Fastest"));
-       set_popdown_strings (meter_falloff_combo, dumb);
-       meter_falloff_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::meter_falloff_chosen));
-       hbox = manage (new HBox);
-       hbox->set_border_width (8);
-       hbox->set_spacing (8);
-       hbox->pack_start (*meter_falloff_label, false, false);
-       hbox->pack_start (meter_falloff_combo, false, false);
-       display_packer.pack_start (*hbox, false, false);
-       
-       
-       show_waveforms_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::show_waveforms_clicked));
-       show_waveforms_recording_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::show_waveforms_recording_clicked));
-       show_measures_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::show_measures_clicked));
-       mixer_strip_width_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::strip_width_clicked));
-       follow_playhead_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::follow_playhead_clicked));
-
-       editor.DisplayControlChanged.connect (mem_fun(*this, &OptionEditor::display_control_changed));
-
-       show_measures_button.set_active (editor.show_measures());
-       show_waveforms_button.set_active (editor.show_waveforms());
-       show_waveforms_recording_button.set_active (editor.show_waveforms_recording());
-       follow_playhead_button.set_active (editor.follow_playhead());
-}
-
-void
-OptionEditor::meter_hold_chosen ()
-{
-       if (session) {
-               string str = meter_hold_combo.get_active_text();
-               
-               if (str == _("Off")) {
-                       session->set_meter_hold (0);
-               } else if (str == _("Short")) {
-                       session->set_meter_hold (40);
-               } else if (str == _("Medium")) {
-                       session->set_meter_hold (100);
-               } else if (str == _("Long")) {
-                       session->set_meter_hold (200);
-               }
-       }
-}
-
-void
-OptionEditor::meter_falloff_chosen ()
-{
-       if (session) {
-               string str = meter_falloff_combo.get_active_text();
-               
-               if (str == _("Off")) {
-                       session->set_meter_falloff (0.0f);
-               } else if (str == _("Slowest")) {
-                       session->set_meter_falloff (0.266f); // 6.6 dB/sec falloff at update rate of 40 ms
-               } else if (str == _("Slow")) {
-                       session->set_meter_falloff (0.342f); // 8.6 dB/sec falloff at update rate of 40 ms
-               } else if (str == _("Medium")) {
-                       session->set_meter_falloff  (0.7f);
-               } else if (str == _("Fast")) {
-                       session->set_meter_falloff (1.1f);
-               } else if (str == _("Faster")) {
-                       session->set_meter_falloff (1.5f);
-               } else if (str == _("Fastest")) {
-                       session->set_meter_falloff (2.5f);
-               }
-       }
-}
-
-void
-OptionEditor::display_control_changed (Editing::DisplayControl dc)
-{
-       ToggleButton* button = 0;
-       bool val = true;
-
-       switch (dc) {
-       case ShowMeasures:
-               val = editor.show_measures ();
-               button = &show_measures_button;
-               break;
-       case ShowWaveforms:
-               val = editor.show_waveforms ();
-               button = &show_waveforms_button;
-               break;
-       case ShowWaveformsRecording:
-               val = editor.show_waveforms_recording ();
-               button = &show_waveforms_recording_button;
-               break;
-       case FollowPlayhead:
-               val = editor.follow_playhead ();
-               button = &follow_playhead_button;
-               break;
-       }
-
-       if (button->get_active() != val) {
-               button->set_active (val);
-       }
-}
-
 void
 OptionEditor::setup_sync_options ()
 {
-       Label *slave_type_label = manage (new Label (_("Positional Sync")));
        HBox* hbox;
        vector<string> dumb;
 
-       slave_type_label->set_name("OptionsLabel");
-       positional_sync_strings = internationalize (psync_strings);
-
-       slave_type_combo.set_name ("OptionsEntry");
-       slave_type_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::slave_type_chosen));
-
        dumb.clear ();
        dumb.push_back (X_("24 FPS"));
        dumb.push_back (X_("25 FPS"));
@@ -851,32 +477,10 @@ OptionEditor::setup_sync_options ()
        smpte_offset_clock.set_mode (AudioClock::SMPTE);
        smpte_offset_clock.ValueChanged.connect (mem_fun(*this, &OptionEditor::smpte_offset_chosen));
        
-       send_mtc_button.set_name ("OptionEditorToggleButton");
-       jack_time_master_button.set_name ("OptionEditorToggleButton");
        smpte_offset_negative_button.set_name ("OptionEditorToggleButton");
 
-       send_mtc_button.unset_flags (Gtk::CAN_FOCUS);
-       jack_time_master_button.unset_flags (Gtk::CAN_FOCUS);
        smpte_offset_negative_button.unset_flags (Gtk::CAN_FOCUS);
 
-       hbox = manage (new HBox);
-       hbox->set_border_width (5);
-       hbox->set_spacing (10);
-       hbox->pack_start (*slave_type_label, false, false);
-       hbox->pack_start (slave_type_combo, false, false);
-
-       sync_packer.pack_start (*hbox, false, false);
-       
-       hbox = manage (new HBox);
-       hbox->set_border_width (5);
-       hbox->pack_start (send_mtc_button, false, false);
-       sync_packer.pack_start (*hbox, false, false);
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (5);
-       hbox->pack_start (jack_time_master_button, false, false);
-       sync_packer.pack_start (*hbox, false, false);
-
        Label *smpte_fps_label = manage (new Label (_("SMPTE Frames/second")));
        Label *smpte_offset_label = manage (new Label (_("SMPTE Offset")));
        smpte_fps_label->set_name("OptionsLabel");
@@ -899,10 +503,6 @@ OptionEditor::setup_sync_options ()
 
        sync_packer.pack_start (*hbox, false, false);
 
-       jack_time_master_button.set_active (Config->get_jack_time_master());
-
-       send_mtc_button.signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::send_mtc_toggled), &send_mtc_button));
-       jack_time_master_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::jack_time_master_clicked));
        smpte_offset_negative_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::smpte_offset_negative_clicked));
 }
 
@@ -1061,46 +661,9 @@ OptionEditor::setup_midi_options ()
        hbox->set_border_width (6);
        hbox->pack_start (*table, true, false);
        midi_packer.pack_start (*hbox, false, false);
-       
-       VBox* mmcbuttonbox = manage (new VBox);
-
-       mmc_control_button.set_name ("OptionEditorToggleButton");
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (6);
-       hbox->pack_start (mmc_control_button, false, false, 36);
-       mmcbuttonbox->pack_start (*hbox, false, false);
-
-       midi_control_button.set_name ("OptionEditorToggleButton");
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (6);
-       hbox->pack_start (midi_control_button, false, false, 36);
-       mmcbuttonbox->pack_start (*hbox, false, false);
-
-       send_mmc_button.set_name ("OptionEditorToggleButton");
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (6);
-       hbox->pack_start (send_mmc_button, false, false, 36);
-       mmcbuttonbox->pack_start (*hbox, false, false);
-       
-       midi_feedback_button.set_name ("OptionEditorToggleButton");
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (6);
-       hbox->pack_start (midi_feedback_button, false, false, 36);
-       mmcbuttonbox->pack_start (*hbox, false, false);
-
-       midi_packer.pack_start (*mmcbuttonbox, false, false);
-
-       mmc_control_button.signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::mmc_control_toggled), &mmc_control_button));
-       midi_control_button.signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::midi_control_toggled), &midi_control_button));
-       send_mmc_button.signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::send_mmc_toggled), &send_mmc_button));
-       midi_feedback_button.signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::midi_feedback_toggled), &midi_feedback_button));
 }
 
-gint
+bool
 OptionEditor::mtc_port_chosen (GdkEventButton* ev, MIDI::Port *port, Gtk::RadioButton* rb) 
 {
        if (session) {
@@ -1111,26 +674,14 @@ OptionEditor::mtc_port_chosen (GdkEventButton* ev, MIDI::Port *port, Gtk::RadioB
                        } else {
                                session->set_mtc_port ("");
                        }
-
-                       /* update sync options to reflect MTC port availability */
-
-                       vector<string> dumb;
-                       dumb.push_back (positional_sync_strings[Session::None]);
-                       dumb.push_back (positional_sync_strings[Session::JACK]);
-
-                       if (session->mtc_port()) {
-                               dumb.push_back (positional_sync_strings[Session::MTC]);
-                       }
-                       set_popdown_strings (slave_type_combo, dumb);
-
                        rb->set_active (true);
                }
        }
-
-       return stop_signal (*rb, "button_press_event");
+       
+       return false;
 }
 
-gint
+bool
 OptionEditor::mmc_port_chosen (GdkEventButton* ev, MIDI::Port* port, Gtk::RadioButton* rb)
 {
        if (session) {
@@ -1144,10 +695,10 @@ OptionEditor::mmc_port_chosen (GdkEventButton* ev, MIDI::Port* port, Gtk::RadioB
                        rb->set_active (true);
                }
        }
-       return stop_signal (*rb, "button_press_event");
+       return false;
 }
 
-gint
+bool
 OptionEditor::midi_port_chosen (GdkEventButton* ev, MIDI::Port* port, Gtk::RadioButton* rb)
 {
        if (session) {
@@ -1161,7 +712,7 @@ OptionEditor::midi_port_chosen (GdkEventButton* ev, MIDI::Port* port, Gtk::Radio
                        rb->set_active (true);
                }
        }
-       return stop_signal (*rb, "button_press_event");
+       return false;
 }
 
 gint
@@ -1207,47 +758,6 @@ OptionEditor::port_trace_out_toggled (GdkEventButton* ev,MIDI::Port* port, Toggl
        return stop_signal (*tb, "button_press_event");
 }
 
-gint
-OptionEditor::send_mtc_toggled (GdkEventButton *ev, CheckButton *button)
-{
-       if (session) {
-               session->set_send_mtc (!button->get_active());
-       }
-       return stop_signal (*button, "button_press_event");
-}
-
-void
-OptionEditor::send_mmc_toggled (CheckButton *button)
-{
-       if (session) {
-               session->set_send_mmc (button->get_active());
-       }
-}
-
-void
-OptionEditor::mmc_control_toggled (CheckButton *button)
-{
-       if (session) {
-               session->set_mmc_control (button->get_active());
-       }
-}
-
-void
-OptionEditor::midi_control_toggled (CheckButton *button)
-{
-       if (session) {
-               session->set_midi_control (button->get_active());
-       }
-}
-
-void
-OptionEditor::midi_feedback_toggled (CheckButton *button)
-{
-       if (session) {
-               session->set_midi_feedback (button->get_active());
-       }
-}
-
 void
 OptionEditor::save ()
 {
@@ -1260,22 +770,10 @@ gint
 OptionEditor::wm_close (GdkEventAny *ev)
 {
        save ();
-       just_close_win();
+       hide ();
        return TRUE;
 }
 
-void
-OptionEditor::jack_time_master_clicked ()
-{
-       bool yn = jack_time_master_button.get_active();
-
-       Config->set_jack_time_master (yn);
-
-       if (session) {
-               session->engine().reset_timebase ();
-       }
-}
-
 void
 OptionEditor::raid_path_changed ()
 {
@@ -1376,96 +874,6 @@ OptionEditor::click_emphasis_sound_changed ()
        }
 }
 
-void
-OptionEditor::show_waveforms_clicked ()
-{
-       editor.set_show_waveforms (show_waveforms_button.get_active());
-}
-
-void
-OptionEditor::show_waveforms_recording_clicked ()
-{
-       editor.set_show_waveforms_recording (show_waveforms_recording_button.get_active());
-}
-
-void
-OptionEditor::show_measures_clicked ()
-{
-       editor.set_show_measures (show_measures_button.get_active());
-}
-
-void
-OptionEditor::follow_playhead_clicked ()
-{
-       editor.set_follow_playhead (follow_playhead_button.get_active());
-}
-
-void
-OptionEditor::strip_width_clicked ()
-{
-       mixer.set_strip_width (mixer_strip_width_button.get_active() ? Narrow : Wide);
-}
-
-
-void
-OptionEditor::just_close_win()
-{
-       hide();
-}
-
-void
-OptionEditor::queue_session_control_changed (Session::ControlType t)
-{
-       ui.call_slot (bind (mem_fun(*this, &OptionEditor::session_control_changed), t));
-}
-
-void
-OptionEditor::session_control_changed (Session::ControlType t)
-{
-       switch (t) {
-       case Session::SlaveType:
-               switch (session->slave_source()) {
-               case Session::None:
-                       slave_type_combo.set_active_text (positional_sync_strings[Session::None]);
-                       break;
-               case Session::MTC:
-                       slave_type_combo.set_active_text (positional_sync_strings[Session::MTC]);
-                       break;
-               case Session::JACK:
-                       slave_type_combo.set_active_text (positional_sync_strings[Session::JACK]);
-                       break;
-               default:
-                       slave_type_combo.set_active_text (_("--unknown--"));
-                       break;
-               }
-               
-               break;
-
-       case Session::SendMTC:
-               map_some_session_state (send_mtc_button, &Session::get_send_mtc);
-               break;
-
-       case Session::SendMMC:
-               map_some_session_state (send_mmc_button, &Session::get_send_mmc);
-               break;
-
-       case Session::MMCControl:       
-               map_some_session_state (mmc_control_button, &Session::get_mmc_control);
-               break;
-
-       case Session::MidiFeedback:       
-               map_some_session_state (midi_feedback_button, &Session::get_midi_feedback);
-               break;
-
-       case Session::MidiControl:       
-                map_some_session_state (midi_control_button, &Session::get_midi_control);
-               break;
-       
-       default:
-               break;
-       }
-}
-
 void
 OptionEditor::native_format_chosen ()
 {
@@ -1483,26 +891,6 @@ OptionEditor::native_format_chosen ()
        }
 }
 
-void
-OptionEditor::slave_type_chosen ()
-{
-       string which;
-
-       if (session == 0) {
-               return;
-       }
-
-       which = slave_type_combo.get_active_text();
-
-       if (which == positional_sync_strings[Session::None]) {
-               session->request_slave_source (Session::None);
-       } else if (which == positional_sync_strings[Session::MTC]) {
-               session->request_slave_source (Session::MTC);
-       } else if (which == positional_sync_strings[Session::JACK]) {
-               session->request_slave_source (Session::JACK);
-       } 
-}
-
 void
 OptionEditor::clear_click_editor ()
 {
@@ -1619,183 +1007,6 @@ OptionEditor::focus_out_event_handler (GdkEventFocus* ev, void (OptionEditor::*p
        return false;
 }
 
-void
-OptionEditor::setup_misc_options()
-{
-       Gtk::Table* table = manage (new Table (4, 2));  
-       table->set_homogeneous (true);
-
-       misc_packer.set_border_width (8);
-       misc_packer.set_spacing (3);
-       misc_packer.pack_start (*table, true, true);
-
-       table->attach (hw_monitor_button, 0, 1, 0, 1, Gtk::FILL, FILL, 8, 0);
-       table->attach (sw_monitor_button, 0, 1, 1, 2, Gtk::FILL, FILL, 8, 0);
-       table->attach (plugins_stop_button, 0, 1, 2, 3, Gtk::FILL, FILL, 8, 0);
-       table->attach (plugins_on_rec_button, 0, 1, 3, 4, Gtk::FILL, FILL, 8, 0);
-       table->attach (verify_remove_last_capture_button, 0, 1, 4, 5, Gtk::FILL, FILL, 8, 0);
-
-       table->attach (stop_rec_on_xrun_button, 1, 2, 0, 1, Gtk::FILL, FILL, 8, 0);
-       table->attach (stop_at_end_button, 1, 2, 1, 2, Gtk::FILL, FILL, 8, 0);
-       table->attach (debug_keyboard_button, 1, 2, 2, 3, Gtk::FILL, FILL, 8, 0);
-       table->attach (speed_quieten_button, 1, 2, 3, 4, Gtk::FILL, FILL, 8, 0);
-
-       Gtk::VBox* connect_box = manage (new VBox);
-       connect_box->set_spacing (3);
-       connect_box->set_border_width (8);
-
-       auto_connect_output_button_group = auto_connect_output_master_button.get_group();
-       auto_connect_output_manual_button.set_group (auto_connect_output_button_group);
-       auto_connect_output_physical_button.set_group (auto_connect_output_button_group);
-
-       Gtk::HBox* useless_box = manage (new HBox);
-       useless_box->pack_start (auto_connect_inputs_button, false, false);
-       connect_box->pack_start (*useless_box, false, false);
-       connect_box->pack_start (auto_connect_output_master_button, false, false);
-       connect_box->pack_start (auto_connect_output_physical_button, false, false);
-       connect_box->pack_start (auto_connect_output_manual_button, false, false);
-
-       misc_packer.pack_start (*connect_box, false, false);
-       
-       hw_monitor_button.set_name ("OptionEditorToggleButton");
-       sw_monitor_button.set_name ("OptionEditorToggleButton");
-       plugins_stop_button.set_name ("OptionEditorToggleButton");
-       plugins_on_rec_button.set_name ("OptionEditorToggleButton");
-       verify_remove_last_capture_button.set_name ("OptionEditorToggleButton");
-       auto_connect_inputs_button.set_name ("OptionEditorToggleButton");
-       auto_connect_output_physical_button.set_name ("OptionEditorToggleButton");
-       auto_connect_output_master_button.set_name ("OptionEditorToggleButton");
-       auto_connect_output_manual_button.set_name ("OptionEditorToggleButton");
-       stop_rec_on_xrun_button.set_name ("OptionEditorToggleButton");
-       stop_at_end_button.set_name ("OptionEditorToggleButton");
-       debug_keyboard_button.set_name ("OptionEditorToggleButton");
-       speed_quieten_button.set_name ("OptionEditorToggleButton");
-
-       hw_monitor_button.set_active (Config->get_use_hardware_monitoring());
-       sw_monitor_button.set_active (!Config->get_no_sw_monitoring());
-       plugins_stop_button.set_active (Config->get_plugins_stop_with_transport());
-       stop_rec_on_xrun_button.set_active (Config->get_stop_recording_on_xrun());
-       stop_at_end_button.set_active (Config->get_stop_at_session_end());
-       debug_keyboard_button.set_active (false);
-       speed_quieten_button.set_active (Config->get_quieten_at_speed() != 1.0f);
-
-       hw_monitor_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::hw_monitor_clicked));
-       sw_monitor_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::sw_monitor_clicked));
-       plugins_stop_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::plugins_stop_with_transport_clicked));
-       plugins_on_rec_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::plugins_on_while_recording_clicked));
-       verify_remove_last_capture_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::verify_remove_last_capture_clicked));
-       auto_connect_inputs_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_inputs_clicked));
-       auto_connect_output_physical_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_output_physical_clicked));
-       auto_connect_output_master_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_output_master_clicked));
-       auto_connect_output_manual_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_output_manual_clicked));
-       stop_rec_on_xrun_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::stop_rec_on_xrun_clicked));
-       stop_at_end_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::stop_at_end_clicked));
-       debug_keyboard_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::debug_keyboard_clicked));
-       speed_quieten_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::speed_quieten_clicked));
-}
-
-void
-OptionEditor::speed_quieten_clicked ()
-{
-       if (speed_quieten_button.get_active()) {
-               Config->set_quieten_at_speed (0.251189); // -12dB reduction for ffwd or rewind
-       } else {
-               Config->set_quieten_at_speed (1.0); /* no change */
-       }
-}
-
-void
-OptionEditor::debug_keyboard_clicked ()
-{
-       extern bool debug_keyboard;
-       debug_keyboard = debug_keyboard_button.get_active ();
-}
-
-void
-OptionEditor::auto_connect_inputs_clicked ()
-{
-       if (session) {
-               session->set_input_auto_connect (auto_connect_inputs_button.get_active());
-       }
-}
-
-void
-OptionEditor::auto_connect_output_master_clicked ()
-{
-       if (session) {
-               if (auto_connect_output_master_button.get_active()) {
-                       session->set_output_auto_connect (Session::AutoConnectMaster);
-               } 
-       }
-}
-
-void
-OptionEditor::auto_connect_output_physical_clicked ()
-{
-       if (session) {
-               if (auto_connect_output_physical_button.get_active()) {
-                       session->set_output_auto_connect (Session::AutoConnectPhysical);
-               } 
-       }
-}
-
-void
-OptionEditor::auto_connect_output_manual_clicked ()
-{
-       if (session) {
-               if (auto_connect_output_manual_button.get_active()) {
-                       session->set_output_auto_connect (Session::AutoConnectOption (0));
-               } 
-       }
-}
-
-void
-OptionEditor::hw_monitor_clicked ()
-{
-       Config->set_use_hardware_monitoring (hw_monitor_button.get_active());
-       if (session) {
-               session->reset_input_monitor_state ();
-       }
-}
-
-void
-OptionEditor::sw_monitor_clicked ()
-{
-       Config->set_no_sw_monitoring (!sw_monitor_button.get_active());
-}
-
-void
-OptionEditor::plugins_stop_with_transport_clicked ()
-{
-       Config->set_plugins_stop_with_transport (plugins_stop_button.get_active());
-}
-
-void
-OptionEditor::plugins_on_while_recording_clicked ()
-{
-       if (session) {
-               session->set_recording_plugins (plugins_on_rec_button.get_active());
-       }
-}
-
-void
-OptionEditor::verify_remove_last_capture_clicked ()
-{
-       Config->set_verify_remove_last_capture(verify_remove_last_capture_button.get_active());
-}
-
-void
-OptionEditor::stop_rec_on_xrun_clicked ()
-{
-       Config->set_stop_recording_on_xrun (stop_rec_on_xrun_button.get_active());
-}
-
-void
-OptionEditor::stop_at_end_clicked ()
-{
-       Config->set_stop_at_session_end (stop_at_end_button.get_active());
-}
-                                                 
 static const struct {
     const char *name;
     guint   modifier;
@@ -1988,11 +1199,3 @@ OptionEditor::fixup_combo_size (Gtk::ComboBoxText& combo, vector<string>& string
        set_size_request_to_display_given_text (combo, maxstring.c_str(), 10 + FUDGE, 10);
 }
 
-void
-OptionEditor::map_some_session_state (CheckButton& button, bool (Session::*get)() const)
-{
-       if (session) {
-               button.set_active ((session->*get)());
-       }
-}
-
index d1513f4661b6a608f3baf11e2e0946165265d2a1..cf70e65a36968e98eca1e097de53793fb6873d25 100644 (file)
@@ -65,28 +65,22 @@ class OptionEditor : public Gtk::Dialog
 
        /* Generic */
 
-       void session_control_changed (ARDOUR::Session::ControlType);
-       void queue_session_control_changed (ARDOUR::Session::ControlType);
-       void map_some_session_state (Gtk::CheckButton& button, bool (ARDOUR::Session::*get)() const);
        gint wm_close (GdkEventAny *);
-       void just_close_win();
        bool focus_out_event_handler (GdkEventFocus*, void (OptionEditor::*pmf)());
 
        /* paths */
 
        Gtk::Table              path_table;
-
        Gtk::Entry              session_raid_entry;
-
        Gtk::ComboBoxText       native_format_combo;
 
-       struct SoundFilePathColumns : public Gtk::TreeModel::ColumnRecord
-       {
-         public:
-           Gtk::TreeModelColumn<std::string> paths;
-
-               SoundFilePathColumns() { add (paths); }
+       struct SoundFilePathColumns : public Gtk::TreeModel::ColumnRecord {
+           public:
+                 SoundFilePathColumns() { add (paths); }
+                 Gtk::TreeModelColumn<std::string> paths;
+                           
        };
+
        SoundFilePathColumns sfdb_path_columns;
        Glib::RefPtr<Gtk::ListStore> sfdb_paths;
        Gtk::TreeView sfdb_path_view;
@@ -99,8 +93,6 @@ class OptionEditor : public Gtk::Dialog
 
        /* fades */
 
-       // Gtk::Table           fade_table;
-
        Gtk::VBox        fade_packer;
        Gtk::CheckButton auto_xfade_button;
        Gtk::CheckButton xfade_active_button;
@@ -118,57 +110,17 @@ class OptionEditor : public Gtk::Dialog
        void setup_fade_options();
        void short_xfade_adjustment_changed ();
 
-       /* solo */
-
-       Gtk::VBox        solo_packer;
-       Gtk::CheckButton solo_latched_button;
-       Gtk::CheckButton solo_via_bus_button;
-
-       void solo_latched_clicked();
-       void solo_via_bus_clicked ();
-       
-       void setup_solo_options();
-
-       /* display */
-
-       Gtk::VBox        display_packer;
-       Gtk::CheckButton show_waveforms_button;
-       Gtk::CheckButton show_waveforms_recording_button;
-       Gtk::CheckButton mixer_strip_width_button;
-       Gtk::CheckButton show_measures_button;
-       Gtk::CheckButton follow_playhead_button;
-       Gtk::ComboBoxText meter_hold_combo;
-       Gtk::ComboBoxText meter_falloff_combo;
-
-       void setup_display_options();
-       void show_waveforms_clicked ();
-       void show_waveforms_recording_clicked ();
-       void show_measures_clicked ();
-       void strip_width_clicked ();
-       void follow_playhead_clicked ();
-       void meter_hold_chosen ();
-       void meter_falloff_chosen ();
-       
-       void display_control_changed (Editing::DisplayControl);
-
        /* Sync */
 
        Gtk::VBox sync_packer;
 
-       Gtk::CheckButton send_mtc_button;
-       Gtk::CheckButton send_mmc_button;
-       Gtk::CheckButton jack_time_master_button;
        Gtk::ComboBoxText slave_type_combo;
        Gtk::ComboBoxText smpte_fps_combo;
        AudioClock smpte_offset_clock;
        Gtk::CheckButton smpte_offset_negative_button;
 
        void setup_sync_options ();
-       gint send_mtc_toggled (GdkEventButton*, Gtk::CheckButton*);
 
-       void slave_type_chosen ();
-       void jack_time_master_clicked ();
-       void jack_transport_master_clicked ();
        void smpte_fps_chosen ();
        void smpte_offset_chosen ();
        void smpte_offset_negative_clicked ();
@@ -176,26 +128,18 @@ class OptionEditor : public Gtk::Dialog
        /* MIDI */
 
        Gtk::VBox  midi_packer;
-       Gtk::CheckButton midi_feedback_button;
-       Gtk::CheckButton midi_control_button;
-       Gtk::CheckButton mmc_control_button;
 
        Gtk::RadioButton::Group mtc_button_group;
        Gtk::RadioButton::Group mmc_button_group;
        Gtk::RadioButton::Group midi_button_group;
 
-       void send_mmc_toggled (Gtk::CheckButton*);
-       void mmc_control_toggled (Gtk::CheckButton*);
-       void midi_control_toggled (Gtk::CheckButton*);
-       void midi_feedback_toggled (Gtk::CheckButton*);
-
        gint port_online_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*);
        gint port_trace_in_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*);
        gint port_trace_out_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*);
        
-       gint mmc_port_chosen (GdkEventButton*,MIDI::Port*,Gtk::RadioButton*);
-       gint mtc_port_chosen (GdkEventButton*,MIDI::Port*,Gtk::RadioButton*);
-       gint midi_port_chosen (GdkEventButton*,MIDI::Port*,Gtk::RadioButton*);
+       bool mmc_port_chosen (GdkEventButton*,MIDI::Port*,Gtk::RadioButton*);
+       bool mtc_port_chosen (GdkEventButton*,MIDI::Port*,Gtk::RadioButton*);
+       bool midi_port_chosen (GdkEventButton*,MIDI::Port*,Gtk::RadioButton*);
 
        void map_port_online (MIDI::Port*, Gtk::ToggleButton*);
 
@@ -264,42 +208,6 @@ class OptionEditor : public Gtk::Dialog
        void edit_button_changed ();
        void delete_button_changed ();
 
-       /* Miscellany */
-
-       Gtk::VBox misc_packer;
-
-       Gtk::CheckButton auto_connect_inputs_button;
-
-       Gtk::RadioButton auto_connect_output_physical_button;
-       Gtk::RadioButton auto_connect_output_master_button;
-       Gtk::RadioButton auto_connect_output_manual_button;
-       Gtk::RadioButton::Group auto_connect_output_button_group;
-
-       Gtk::CheckButton hw_monitor_button;
-       Gtk::CheckButton sw_monitor_button;
-       Gtk::CheckButton plugins_stop_button;
-       Gtk::CheckButton plugins_on_rec_button;
-       Gtk::CheckButton verify_remove_last_capture_button;
-       Gtk::CheckButton stop_rec_on_xrun_button;
-       Gtk::CheckButton stop_at_end_button;
-       Gtk::CheckButton debug_keyboard_button;
-       Gtk::CheckButton speed_quieten_button;
-
-       void setup_misc_options ();
-       void plugins_stop_with_transport_clicked ();
-       void verify_remove_last_capture_clicked ();
-       void plugins_on_while_recording_clicked ();
-       void auto_connect_inputs_clicked ();
-       void auto_connect_output_physical_clicked ();
-       void auto_connect_output_master_clicked ();
-       void auto_connect_output_manual_clicked ();
-       void hw_monitor_clicked ();
-       void sw_monitor_clicked ();
-       void stop_rec_on_xrun_clicked ();
-       void stop_at_end_clicked ();
-       void debug_keyboard_clicked ();
-       void speed_quieten_clicked ();
-
        void fixup_combo_size (Gtk::ComboBoxText&, std::vector<std::string>& strings);
 };
 
index 1780204321a3bfd750d01a3bcb86bc60f410cbda..82b6cac3bdc18635f4e28164d0e9bc10d1052a01 100644 (file)
@@ -54,6 +54,7 @@ RouteUI::RouteUI (ARDOUR::Route& rt, ARDOUR::Session& sess, const char* m_name,
        xml_node = 0;
        mute_menu = 0;
        solo_menu = 0;
+       remote_control_menu = 0;
        ignore_toggle = false;
        wait_for_release = false;
        route_active_menu_item = 0;
@@ -408,6 +409,58 @@ RouteUI::update_rec_display ()
        }
 }
 
+void
+RouteUI::build_remote_control_menu ()
+{
+       remote_control_menu = manage (new Menu);
+       refresh_remote_control_menu ();
+}
+
+void
+RouteUI::refresh_remote_control_menu ()
+{
+       using namespace Menu_Helpers;
+
+       RadioMenuItem::Group rc_group;
+       CheckMenuItem* rc_active;
+       uint32_t limit = _session.ntracks();
+       char buf[32];
+
+       MenuList& rc_items = remote_control_menu->items();
+       rc_items.clear ();
+
+       /* note that this menu list starts at zero, not 1, because zero
+          is a valid, if useless, ID.
+       */
+
+       limit += 4; /* leave some breathing room */
+       
+       for (uint32_t i = 0; i < limit; ++i) {
+               snprintf (buf, sizeof (buf), "%u", i);
+               rc_items.push_back (RadioMenuElem (rc_group, buf));
+               rc_active = dynamic_cast<RadioMenuItem*>(&rc_items.back());
+               if (_route.remote_control_id() == i) {
+                       rc_active = dynamic_cast<CheckMenuItem*> (&rc_items.back());
+                       rc_active->set_active ();
+               }
+               rc_active->signal_activate().connect (bind (mem_fun (*this, &RouteUI::set_remote_control_id), i, rc_active));
+       }
+}
+
+void
+RouteUI::set_remote_control_id (uint32_t id, CheckMenuItem* item)
+{
+       /* this is called when the radio menu item is toggled, and so 
+          is actually invoked twice per menu selection. we only
+          care about the invocation for the item that was being
+          marked active.
+       */
+
+       if (item->get_active()) {
+               _route.set_remote_control_id (id);
+       }
+}
+
 void
 RouteUI::build_solo_menu (void)
 {
@@ -840,3 +893,4 @@ RouteUI::map_frozen ()
                }
        }
 }
+
index c49583ab4522751b32085e19602bacd92f86fcf0..990bcd99edc4913bf8db562032c5b7b5c124dd55 100644 (file)
@@ -74,6 +74,7 @@ class RouteUI : public virtual AxisView
        
        Gtk::Menu* mute_menu;
        Gtk::Menu* solo_menu;
+       Gtk::Menu* remote_control_menu;
 
        XMLNode *xml_node;
        void ensure_xml_node ();
@@ -92,6 +93,8 @@ class RouteUI : public virtual AxisView
        void session_rec_enable_changed();
 
        void build_solo_menu (void);
+       void build_remote_control_menu (void);
+       void refresh_remote_control_menu ();
 
        void solo_safe_toggle (void*, Gtk::CheckMenuItem*);
        void toggle_solo_safe (Gtk::CheckMenuItem*);
@@ -123,8 +126,6 @@ class RouteUI : public virtual AxisView
        virtual void name_changed (void *src);
        void route_removed ();
 
-       static gint okay_gplusplus_cannot_do_complex_templates (RouteUI *rui);
-
        Gtk::CheckMenuItem *route_active_menu_item;
        void toggle_route_active ();
        virtual void route_active_changed ();
@@ -137,6 +138,8 @@ class RouteUI : public virtual AxisView
        void update_solo_display ();
        virtual void map_frozen ();
 
+       void set_remote_control_id (uint32_t id, Gtk::CheckMenuItem* item);
+
        void reversibly_apply_route_boolean (string name, void (ARDOUR::Route::*func)(bool, void*), bool, void *);
        void reversibly_apply_audio_track_boolean (string name, void (ARDOUR::AudioTrack::*func)(bool, void*), bool, void *);
 };
index 4213bc8431d6b14612a82234591b3cc885868688..a8b7499644cc2d1163619364b998e8add9296483 100644 (file)
@@ -470,7 +470,7 @@ StreamView::redisplay_diskstream ()
                if (!(*i)->is_valid()) {
                        delete *i;
                        region_views.erase (i);
-               }
+               } 
 
                i = tmp;
        }
index 140490d46d47fff8567c1a727a6b5acfeb606cb0..fd44d273292858255cd5f731957ab45e2066ab96 100644 (file)
@@ -124,6 +124,9 @@ class Configuration : public Stateful
        bool get_use_hardware_monitoring();
        void set_use_hardware_monitoring(bool);
 
+       bool get_use_sw_monitoring();
+       void set_use_sw_monitoring(bool);
+
        bool get_jack_time_master();
        void set_jack_time_master(bool);
 
@@ -133,9 +136,6 @@ class Configuration : public Stateful
        bool get_plugins_stop_with_transport();
        void set_plugins_stop_with_transport(bool);
 
-       bool get_no_sw_monitoring();
-       void set_no_sw_monitoring(bool);
-
        bool get_stop_recording_on_xrun();
        void set_stop_recording_on_xrun(bool);
 
@@ -220,12 +220,12 @@ class Configuration : public Stateful
        bool          trace_midi_output_is_user;
        bool          plugins_stop_with_transport;
        bool          plugins_stop_with_transport_is_user;
-       bool          no_sw_monitoring;
-       bool          no_sw_monitoring_is_user;
+       bool          use_sw_monitoring;
+       bool          use_sw_monitoring_is_user;
        bool          stop_recording_on_xrun;
        bool          stop_recording_on_xrun_is_user;
-       bool              verify_remove_last_capture;
-       bool              verify_remove_last_capture_is_user;
+       bool          verify_remove_last_capture;
+       bool          verify_remove_last_capture_is_user;
        bool          stop_at_session_end;
        bool          stop_at_session_end_is_user;
        bool          seamless_looping;
index 9c0edcdad4a3a28634221777ac4c19c562d140ee..ed4b695bffde34f86914a055a3b8aee8e9de73cd 100644 (file)
@@ -245,6 +245,10 @@ class Route : public IO
 
        void protect_automation ();
        
+       void set_remote_control_id (uint32_t id);
+       uint32_t remote_control_id () const;
+       sigc::signal<void> RemoteControlIDChanged;
+
   protected:
        friend class Session;
 
@@ -317,6 +321,7 @@ class Route : public IO
 
        state_id_t _current_state_id;
        uint32_t redirect_max_outs;
+       uint32_t _remote_control_id;
 
        uint32_t pans_required() const;
        uint32_t n_process_buffers ();
index 88f629e5168b9b660db5bd2dd53e0d4ccf67d98b..0b13cf5f30f72b387d3701fa19a98a9bd9312032 100644 (file)
@@ -391,7 +391,8 @@ class Session : public sigc::trackable, public Stateful
                PunchOut,
                SendMTC,
                MMCControl,
-               Live,
+               SoloLatch,
+               SoloingModel,
                RecordingPlugins,
                CrossFadesActive,
                SendMMC,
@@ -399,7 +400,8 @@ class Session : public sigc::trackable, public Stateful
                Clicking,
                EditingMode,
                PlayRange,
-               AlignChoice,
+               LayeringModel,
+               CrossfadingModel,
                SeamlessLoop,
                MidiFeedback,
                MidiControl
@@ -440,7 +442,7 @@ class Session : public sigc::trackable, public Stateful
        bool get_recording_plugins () const { return recording_plugins; }
        bool get_crossfades_active () const { return crossfades_active; }
 
-       AutoConnectOption get_input_auto_connect () const { return input_auto_connect; }
+       bool get_input_auto_connect () const;
        AutoConnectOption get_output_auto_connect () const { return output_auto_connect; }
 
        enum LayerModel {
@@ -452,14 +454,9 @@ class Session : public sigc::trackable, public Stateful
        void set_layer_model (LayerModel);
        LayerModel get_layer_model () const { return layer_model; }
 
-       sigc::signal<void> LayerModelChanged;
-
        void set_xfade_model (CrossfadeModel);
        CrossfadeModel get_xfade_model () const { return xfade_model; }
 
-       void set_align_style (AlignStyle);
-       AlignStyle get_align_style () const { return align_style; }
-
        void add_event (jack_nframes_t action_frame, Event::Type type, jack_nframes_t target_frame = 0);
        void remove_event (jack_nframes_t frame, Event::Type type);
        void clear_events (Event::Type type);
@@ -1719,8 +1716,6 @@ class Session : public sigc::trackable, public Stateful
        AutoConnectOption input_auto_connect;
        AutoConnectOption output_auto_connect;
 
-       AlignStyle align_style;
-
        gain_t* _gain_automation_buffer;
        pan_t** _pan_automation_buffer;
        void allocate_pan_automation_buffers (jack_nframes_t nframes, uint32_t howmany, bool force);
index faedc120ee34afb1bbd269b7dca14a29580c1853..105ca38dccd34d762b7540eb52d3d699c1c6710d 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <list>
 #include <string>
+#include <vector>
 
 #include <sigc++/signal.h>
 
@@ -35,7 +36,14 @@ class StateManager : public sigc::trackable
 
        state_id_t _current_state_id;
 
+       static void set_allow_save (bool);
+       static bool allow_save ();
+
   protected:
+       static bool _allow_save;
+       typedef std::pair<StateManager*,std::string> DeferredSave;
+       static std::vector<DeferredSave> deferred;
+
        StateMap   states;
 
        virtual Change   restore_state (State&) = 0;
index 73e0a9116455f737e16d491578169a68aa61d6d9..9c68c6111405ebb86ae6e3a3e55b76ea57c364af 100644 (file)
@@ -576,7 +576,6 @@ AudioPlaylist::state_factory (std::string why) const
        for (Crossfades::const_iterator i = _crossfades.begin(); i != _crossfades.end(); ++i) {
                state->crossfade_states.push_back ((*i)->get_memento());
        }
-
        return state;
 }
 
@@ -592,13 +591,13 @@ AudioPlaylist::restore_state (StateManager::State& state)
                regions = apstate->regions;
 
                for (list<UndoAction>::iterator s = apstate->region_states.begin(); s != apstate->region_states.end(); ++s) {
-                 *s;
+                       (*s) ();
                }
 
                _crossfades = apstate->crossfades;
                
                for (list<UndoAction>::iterator s = apstate->crossfade_states.begin(); s != apstate->crossfade_states.end(); ++s) {
-                 *s;
+                       (*s) ();
                }
 
                in_set_state = false;
@@ -611,7 +610,7 @@ AudioPlaylist::restore_state (StateManager::State& state)
 UndoAction
 AudioPlaylist::get_memento () const
 {
-  return sigc::bind (mem_fun (*(const_cast<AudioPlaylist*> (this)), &StateManager::use_state), _current_state_id);
+       return sigc::bind (mem_fun (*(const_cast<AudioPlaylist*> (this)), &StateManager::use_state), _current_state_id);
 }
 
 void
index 1d3f32ae6be5fb8b5f826e2dd8741b874a010b3a..4a922d631d55e0385f8a5681dd89f31c4d1ec05f 100644 (file)
@@ -322,6 +322,24 @@ AudioTrack::set_state (const XMLNode& node)
                }
        }
 
+
+       XMLNodeList nlist;
+       XMLNodeConstIterator niter;
+       XMLNode *child;
+
+       nlist = node.children();
+       for (niter = nlist.begin(); niter != nlist.end(); ++niter){
+               child = *niter;
+
+               if (child->name() == X_("remote_control")) {
+                       if ((prop = child->property (X_("id"))) != 0) {
+                               int32_t x;
+                               sscanf (prop->value().c_str(), "%d", &x);
+                               set_remote_control_id (x);
+                       }
+               }
+       }
+
        pending_state = const_cast<XMLNode*> (&node);
 
        _session.StateReady.connect (mem_fun (*this, &AudioTrack::set_state_part_two));
@@ -393,7 +411,11 @@ AudioTrack::get_state()
                set_midi_node_info (child, ev, chn, additional);
        }
 
-       
+       XMLNode* remote_control_node = new XMLNode (X_("remote_control"));
+       snprintf (buf, sizeof (buf), "%d", _remote_control_id);
+       remote_control_node->add_property (X_("id"), buf);
+       root.add_child_nocopy (*remote_control_node);
+
        return root;
 }
 
@@ -519,17 +541,17 @@ AudioTrack::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nf
        } else {
 
                if (_session.get_auto_input()) {
-                       if (Config->get_no_sw_monitoring()) {
-                               send_silence = true;
-                       } else {
+                       if (Config->get_use_sw_monitoring()) {
                                send_silence = false;
+                       } else {
+                               send_silence = true;
                        }
                } else {
                        if (diskstream->record_enabled()) {
-                               if (Config->get_no_sw_monitoring()) {
-                                       send_silence = true;
-                               } else {
+                               if (Config->get_use_sw_monitoring()) {
                                        send_silence = false;
+                               } else {
+                                       send_silence = true;
                                }
                        } else {
                                send_silence = true;
index 8d4a5f017748350af96f952b87d424026e4c7d27..bc14968fa7142f92fe2ab0b612de99020b3b63dd 100644 (file)
@@ -376,7 +376,7 @@ AudioRegion::restore_state (StateManager::State& sstate)
 UndoAction
 AudioRegion::get_memento() const
 {
-  return sigc::bind (mem_fun (*(const_cast<AudioRegion *> (this)), &StateManager::use_state), _current_state_id);
+       return sigc::bind (mem_fun (*(const_cast<AudioRegion *> (this)), &StateManager::use_state), _current_state_id);
 }
 
 bool
index 0de30a3538fe2215efa945ef1b4e7e3d6424bb9b..28f13aabb8442281a361ac5f06f4171379c2b87d 100644 (file)
@@ -257,8 +257,8 @@ Configuration::state (bool user_only)
        if (!user_only || plugins_stop_with_transport_is_user) {
                node->add_child_nocopy(option_node("plugins-stop-with-transport", plugins_stop_with_transport?"yes":"no"));
        }
-       if (!user_only || no_sw_monitoring_is_user) {
-               node->add_child_nocopy(option_node("no-sw-monitoring", no_sw_monitoring?"yes":"no"));
+       if (!user_only || use_sw_monitoring_is_user) {
+               node->add_child_nocopy(option_node("use-sw-monitoring", use_sw_monitoring?"yes":"no"));
        }
        if (!user_only || stop_recording_on_xrun_is_user) {
                node->add_child_nocopy(option_node("stop-recording-on-xrun", stop_recording_on_xrun?"yes":"no"));
@@ -400,8 +400,10 @@ Configuration::set_state (const XMLNode& root)
                                        set_trace_midi_output (option_value == "yes");
                                } else if (option_name == "plugins-stop-with-transport") {
                                        set_plugins_stop_with_transport (option_value == "yes");
-                               } else if (option_name == "no-sw-monitoring") {
-                                       set_no_sw_monitoring (option_value == "yes");
+                               } else if (option_name == "use-sw-monitoring") {
+                                       set_use_sw_monitoring (option_value == "yes");
+                               } else if (option_name == "no-sw-monitoring") {     /* DEPRECATED */
+                                       set_use_sw_monitoring (option_value != "yes");
                                } else if (option_name == "stop-recording-on-xrun") {
                                        set_stop_recording_on_xrun (option_value == "yes");
                                } else if (option_name == "verify-remove-last-capture") {
@@ -475,7 +477,7 @@ Configuration::set_defaults ()
        trace_midi_input = false;
        trace_midi_output = false;
        plugins_stop_with_transport = false;
-       no_sw_monitoring = false;
+       use_sw_monitoring = true;
        stop_recording_on_xrun = false;
        verify_remove_last_capture = true;
        stop_at_session_end = true;
@@ -514,7 +516,7 @@ Configuration::set_defaults ()
        trace_midi_input_is_user = false;
        trace_midi_output_is_user = false;
        plugins_stop_with_transport_is_user = false;
-       no_sw_monitoring_is_user = false;
+       use_sw_monitoring_is_user = false;
        stop_recording_on_xrun_is_user = false;
        verify_remove_last_capture_is_user = false;
        stop_at_session_end_is_user = false;
@@ -948,17 +950,17 @@ Configuration::set_plugins_stop_with_transport (bool yn)
 }
 
 bool
-Configuration::get_no_sw_monitoring ()
+Configuration::get_use_sw_monitoring ()
 {
-       return no_sw_monitoring;
+       return use_sw_monitoring;
 }
 
 void
-Configuration::set_no_sw_monitoring (bool yn)
+Configuration::set_use_sw_monitoring (bool yn)
 {
-       no_sw_monitoring = yn;
+       use_sw_monitoring = yn;
        if (user_configuration) {
-               no_sw_monitoring_is_user = true;
+               use_sw_monitoring_is_user = true;
        }
 }
 
index 8977135ba7e5b52d97bdd4d49c5296a41331c72f..7772fcbf82284a4fe8f8bc41e32e3ab7a11a4e4a 100644 (file)
@@ -223,8 +223,6 @@ Playlist::init (bool hide)
        layer_op_counter = 0;
        freeze_length = 0;
 
-       // _session.LayerModelChanged.connect (slot (*this, &Playlist::relayer));
-
        Modified.connect (mem_fun (*this, &Playlist::mark_session_dirty));
 }
 
index 6e07ef90f26d6c899d9b574f3517ebbf74588d38..5fcbd53bb68c8c2a968cbccdf31d84a8af9c47a8 100644 (file)
@@ -86,6 +86,7 @@ Route::init ()
        _have_internal_generator = false;
        _declickable = false;
        _pending_declick = true;
+       _remote_control_id = 0;
 
        _edit_group = 0;
        _mix_group = 0;
@@ -118,6 +119,21 @@ Route::~Route ()
        }
 }
 
+void
+Route::set_remote_control_id (uint32_t id)
+{
+       if (id != _remote_control_id) {
+               _remote_control_id = id;
+               RemoteControlIDChanged ();
+       }
+}
+
+uint32_t
+Route::remote_control_id() const
+{
+       return _remote_control_id;
+}
+
 long
 Route::order_key (string name) const
 {
@@ -213,7 +229,7 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
        IO *co;
        bool mute_audible;
        bool solo_audible;
-       bool no_monitor = (Config->get_use_hardware_monitoring() || Config->get_no_sw_monitoring ());
+       bool no_monitor = (Config->get_use_hardware_monitoring() || !Config->get_use_sw_monitoring ());
        gain_t* gab = _session.gain_automation_buffer();
 
        declick = _pending_declick;
@@ -406,7 +422,7 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
 
                 // AND software monitoring required
 
-                !Config->get_no_sw_monitoring())) { 
+                Config->get_use_sw_monitoring())) { 
                
                if (apply_gain_automation) {
                        
index f811fbd0af42e8f8bd684edff026f84fa400e737..726d3070bb9b67833d265ad5c50bd029c7e1ee07 100644 (file)
@@ -989,6 +989,12 @@ Session::set_input_auto_connect (bool yn)
        set_dirty ();
 }
 
+bool
+Session::get_input_auto_connect () const
+{
+       return (input_auto_connect & AutoConnectPhysical);
+}
+
 void
 Session::set_output_auto_connect (AutoConnectOption aco)
 {
@@ -1715,6 +1721,8 @@ Session::new_audio_track (int input_channels, int output_channels)
                track->diskstream_changed.connect (mem_fun (this, &Session::resort_routes));
 
                add_route (track);
+
+               track->set_remote_control_id (ntracks());
        }
 
        catch (failed_constructor &err) {
@@ -2031,8 +2039,11 @@ Session::route_solo_changed (void* src, Route* route)
 void
 Session::set_solo_latched (bool yn)
 {
-       _solo_latched = yn;
-       set_dirty ();
+       if (yn != _solo_latched) {
+               _solo_latched = yn;
+               set_dirty ();
+               ControlChanged (SoloLatch);
+       }
 }
 
 void
@@ -3304,22 +3315,14 @@ Session::n_playlists () const
        return playlists.size();
 }
 
-void
-Session::set_align_style (AlignStyle style)
-{
-       align_style = style;
-
-       foreach_diskstream (&DiskStream::set_capture_offset);
-
-       set_dirty ();
-       ControlChanged (AlignChoice);
-}
-
 void
 Session::set_solo_model (SoloModel sm)
 {
-       _solo_model = sm;
-       set_dirty ();
+       if (sm != _solo_model) {
+               _solo_model = sm;
+               ControlChanged (SoloingModel);
+               set_dirty ();
+       }
 }
 
 void
@@ -3555,15 +3558,20 @@ Session::nbusses () const
 void
 Session::set_layer_model (LayerModel lm)
 {
-       layer_model = lm;
-       LayerModelChanged (); /* EMIT SIGNAL */
-       set_dirty ();
+       if (lm != layer_model) {
+               layer_model = lm;
+               set_dirty ();
+               ControlChanged (LayeringModel);
+       }
 }
 
 void
 Session::set_xfade_model (CrossfadeModel xm)
 {
-       xfade_model = xm;
-       set_dirty ();
+       if (xm != xfade_model) {
+               xfade_model = xm;
+               set_dirty ();
+               ControlChanged (CrossfadingModel);
+       }
 }
 
index 2e6d0cd80ba9d441b0dedf8a2b7a6fdd20a66529..840cb6a97dca180dc0f3e1e5983da40df80d0a10 100644 (file)
@@ -204,7 +204,7 @@ Session::feedback_thread_work ()
                        tmp = i;
                        ++tmp;
                        
-                       if ((*i)) {
+                       if ((*i) ()) {
                                feedback_functions.erase (i);
                        }
                        
index 18d8b3672b1a46ab71a2fe4e3a57c5987f67da9b..56e593086a07c5405318fe682dfcbdd1fda7daaa 100644 (file)
@@ -803,19 +803,14 @@ Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled)
 {
        if (mmc_control) {
 
-               /* don't take route or diskstream lock: if using dynamic punch,
-                  this could cause a dropout. XXX is that really OK?
-                  or should we queue a rec-enable request?
-               */
-
-               size_t n;
                RouteList::iterator i;
-
-               for (n = 0, i = routes.begin(); i != routes.end(); ++i) {
+               RWLockMonitor (route_lock, false, __LINE__, __FILE__);
+               
+               for (i = routes.begin(); i != routes.end(); ++i) {
                        AudioTrack *at;
 
                        if ((at = dynamic_cast<AudioTrack*>(*i)) != 0) {
-                               if (n++ == trk) {
+                               if (trk == at->remote_control_id()) {
                                        at->set_record_enable (enabled, &mmc);
                                        break;
                                }
@@ -1468,7 +1463,7 @@ Session::midi_thread_work ()
                                tmp = i;
                                ++tmp;
                                
-                               if (!(*i)) {
+                               if (!(*i)()) {
                                        midi_timeouts.erase (i);
                                }
                                
index 53ca23a366175f2833a34861d2b80d300b173bab..7a88443dbd556c78d14a6522bae40ccfa59408d3 100644 (file)
@@ -177,7 +177,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        _edit_mode = Slide;
        pending_edit_mode = _edit_mode;
        _play_range = false;
-       align_style = ExistingMaterial;
        _control_out = 0;
        _master_out = 0;
        input_auto_connect = AutoConnectOption (0);
@@ -988,16 +987,6 @@ Session::load_options (const XMLNode& node)
                }
        }
 
-       if ((child = find_named_node (node, "align-style")) != 0) {
-               if ((prop = child->property ("val")) != 0) {
-                       if (prop->value() == "capture") {
-                               set_align_style (CaptureTime);
-                       } else {
-                               set_align_style (ExistingMaterial);
-                       }
-               }
-       }
-
        if ((child = find_named_node (node, "layer-model")) != 0) {
                if ((prop = child->property ("val")) != 0) {
                        if (prop->value() == X_("LaterHigher")) {
@@ -1197,9 +1186,6 @@ Session::get_options () const
        child = opthead->add_child ("solo-model");
        child->add_property ("val", _solo_model == SoloBus ? "SoloBus" : "InverseMute");
 
-       child = opthead->add_child ("align-style");
-       child->add_property ("val", (align_style == ExistingMaterial ? "existing" : "capture"));
-
        child = opthead->add_child ("layer-model");
        switch (layer_model) {
        case LaterHigher:
@@ -1450,6 +1436,7 @@ Session::set_state (const XMLNode& node)
        XMLNodeList nlist;
        XMLNode* child;
        const XMLProperty* prop;
+       int ret = -1;
 
        _state_of_the_state = StateOfTheState (_state_of_the_state|CannotSave);
        
@@ -1458,6 +1445,8 @@ Session::set_state (const XMLNode& node)
                return -1;
        }
 
+       StateManager::set_allow_save (false);
+
        if ((prop = node.property ("name")) != 0) {
                _name = prop->value ();
        }
@@ -1483,7 +1472,6 @@ Session::set_state (const XMLNode& node)
        */
 
        if (use_config_midi_ports ()) {
-               return -1;
        }
 
        if ((child = find_named_node (node, "Path")) != 0) {
@@ -1500,63 +1488,61 @@ Session::set_state (const XMLNode& node)
 
        if ((child = find_named_node (node, "Options")) == 0) {
                error << _("Session: XML state has no options section") << endmsg;
-               return -1;
        } else if (load_options (*child)) {
-               return -1;
        }
 
        if ((child = find_named_node (node, "Sources")) == 0) {
                error << _("Session: XML state has no sources section") << endmsg;
-               return -1;
+               goto out;
        } else if (load_sources (*child)) {
-               return -1;
+               goto out;
        }
 
        if ((child = find_named_node (node, "Regions")) == 0) {
                error << _("Session: XML state has no Regions section") << endmsg;
-               return -1;
+               goto out;
        } else if (load_regions (*child)) {
-               return -1;
+               goto out;
        }
 
        if ((child = find_named_node (node, "Playlists")) == 0) {
                error << _("Session: XML state has no playlists section") << endmsg;
-               return -1;
+               goto out;
        } else if (load_playlists (*child)) {
-               return -1;
+               goto out;
        }
 
        if ((child = find_named_node (node, "UnusedPlaylists")) == 0) {
                // this is OK
        } else if (load_unused_playlists (*child)) {
-               return -1;
+               goto out;
        }
        
        if ((child = find_named_node (node, "NamedSelections")) != 0) {
                if (load_named_selections (*child)) {
-                       return -1;
+                       goto out;
                }
        }
 
        if ((child = find_named_node (node, "DiskStreams")) == 0) {
                error << _("Session: XML state has no diskstreams section") << endmsg;
-               return -1;
+               goto out;
        } else if (load_diskstreams (*child)) {
-               return -1;
+               goto out;
        }
 
        if ((child = find_named_node (node, "Connections")) == 0) {
                error << _("Session: XML state has no connections section") << endmsg;
-               return -1;
+               goto out;
        } else if (load_connections (*child)) {
-               return -1;
+               goto out;
        }
 
        if ((child = find_named_node (node, "Locations")) == 0) {
                error << _("Session: XML state has no locations section") << endmsg;
-               return -1;
+               goto out;
        } else if (_locations.set_state (*child)) {
-               return -1;
+               goto out;
        }
 
        Location* location;
@@ -1579,30 +1565,30 @@ Session::set_state (const XMLNode& node)
 
        if ((child = find_named_node (node, "EditGroups")) == 0) {
                error << _("Session: XML state has no edit groups section") << endmsg;
-               return -1;
+               goto out;
        } else if (load_edit_groups (*child)) {
-               return -1;
+               goto out;
        }
 
        if ((child = find_named_node (node, "MixGroups")) == 0) {
                error << _("Session: XML state has no mix groups section") << endmsg;
-               return -1;
+               goto out;
        } else if (load_mix_groups (*child)) {
-               return -1;
+               goto out;
        }
 
        if ((child = find_named_node (node, "TempoMap")) == 0) {
                error << _("Session: XML state has no Tempo Map section") << endmsg;
-               return -1;
+               goto out;
        } else if (_tempo_map->set_state (*child)) {
-               return -1;
+               goto out;
        }
 
        if ((child = find_named_node (node, "Routes")) == 0) {
                error << _("Session: XML state has no routes section") << endmsg;
-               return -1;
+               goto out;
        } else if (load_routes (*child)) {
-               return -1;
+               goto out;
        }
 
        if ((child = find_named_node (node, "Click")) == 0) {
@@ -1621,13 +1607,20 @@ Session::set_state (const XMLNode& node)
 
        _state_of_the_state = Clean;
 
+       StateManager::set_allow_save (true);
+
        if (state_was_pending) {
                save_state (_current_snapshot_name);
                remove_pending_capture_state ();
                state_was_pending = false;
        }
 
-       return 0;
+       ret = 0;
+
+  out:
+       /* yes, doing it twice doesn't hurt and makes the code easier */
+       StateManager::set_allow_save (true);
+       return ret;
 }
 
 int
index de9a72b40a92956286c33297c929085e7a2fe43e..4bb44dbc950721332bca98c2b55ffb0a717bb2ff 100644 (file)
@@ -4,6 +4,10 @@
 #include "i18n.h"
 
 using namespace ARDOUR;
+using namespace std;
+
+bool StateManager::_allow_save = true;
+vector<StateManager::DeferredSave> StateManager::deferred;
 
 StateManager::StateManager ()
 {
@@ -14,6 +18,19 @@ StateManager::~StateManager()
 {
 }
 
+void
+StateManager::set_allow_save (bool yn)
+{
+       _allow_save = yn;
+
+       if (yn) {
+               for (vector<DeferredSave>::iterator x = deferred.begin(); x != deferred.end(); ++x) {
+                       (*x).first->save_state ((*x).second);
+               }
+               deferred.clear ();
+       }
+}
+
 void
 StateManager::drop_all_states ()
 {
@@ -32,13 +49,12 @@ StateManager::use_state (state_id_t id)
        Change what_changed;
        state_id_t n;
        StateMap::iterator i;
-       
+
        for (n = 0, i = states.begin(); n < id && i != states.end(); ++n, ++i);
 
        if (n != id || i == states.end()) {
                fatal << string_compose (_("programming error: illegal state ID (%1) passed to "
-                                   "StateManager::set_state() (range = 0-%3)"), id,
-                                 states.size()-1)
+                                   "StateManager::set_state() (range = 0-%2)"), id, states.size()-1)
                      << endmsg;
                /*NOTREACHED*/
                return;
@@ -52,6 +68,11 @@ StateManager::use_state (state_id_t id)
 void
 StateManager::save_state (std::string why)
 {
+       if (!_allow_save) {
+               deferred.push_back (DeferredSave (this, why));
+               return;
+       }
+
        states.push_back (state_factory (why));
        _current_state_id = states.size() - 1;
 }
index 0af1cc2e7a54ce13ce95eea40c6c17ae0658116c..482cb5cf37b6d3d1564e661f8a0ef1e25dca105f 100644 (file)
@@ -77,6 +77,7 @@ UndoCommand::clear ()
 void
 UndoCommand::undo ()
 {
+       cerr << "There are " << undo_actions.size() << " actions to undo\n";
        for (list<UndoAction>::reverse_iterator i = undo_actions.rbegin(); i != undo_actions.rend(); ++i) {
                (*i)();
        }
@@ -99,12 +100,14 @@ UndoHistory::add (UndoCommand uc)
 void
 UndoHistory::undo (unsigned int n)
 {
+       cerr << "Undo history undoing " << n << " with a list of " << UndoList.size() << endl;
        while (n--) {
                if (UndoList.size() == 0) {
                        return;
                }
                UndoCommand uc = UndoList.back ();
                UndoList.pop_back ();
+               cerr << "undoing command called " << uc.name() << endl;
                uc.undo ();
                RedoList.push_back (uc);
        }