First stage of options rework.
authorCarl Hetherington <carl@carlh.net>
Thu, 14 May 2009 00:13:27 +0000 (00:13 +0000)
committerCarl Hetherington <carl@carlh.net>
Thu, 14 May 2009 00:13:27 +0000 (00:13 +0000)
- Split Configuration into RCConfiguration and SessionConfiguration;
the first for options which are saved to .rc files and the second
for options which are saved in a session file.

- Move some options from the old `master' Configuration object into
SessionConfiguration; this needs more refinement.

- Reflect many RCConfiguration options in an expanded Edit->Preferences
dialog; my intention is to remove the corresponding menu items
eventually.

git-svn-id: svn://localhost/ardour2/branches/3.0@5075 d708f5d6-7413-0410-9779-e7cbd77b26cf

65 files changed:
.gitignore
gtk2_ardour/actions.cc
gtk2_ardour/actions.h
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/audio_region_view.cc
gtk2_ardour/audio_streamview.cc
gtk2_ardour/editor_actions.cc
gtk2_ardour/editor_markers.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/editor_rulers.cc
gtk2_ardour/ghostregion.h
gtk2_ardour/midi_port_dialog.cc
gtk2_ardour/option_editor.cc
gtk2_ardour/option_editor.h
gtk2_ardour/selection.cc
gtk2_ardour/sfdb_ui.cc
gtk2_ardour/sfdb_ui.h
gtk2_ardour/ui_config.h
gtk2_ardour/wscript
libs/ardour/ardour/ardour.h
libs/ardour/ardour/audio_diskstream.h
libs/ardour/ardour/broadcast_info.h
libs/ardour/ardour/configuration.h
libs/ardour/ardour/configuration_variable.h
libs/ardour/ardour/diskstream.h
libs/ardour/ardour/midi_diskstream.h
libs/ardour/ardour/session.h
libs/ardour/ardour/session_object.h
libs/ardour/ardour/sndfilesource.h
libs/ardour/ardour/types.h
libs/ardour/ardour/utils.h
libs/ardour/audio_diskstream.cc
libs/ardour/audio_playlist.cc
libs/ardour/audio_track.cc
libs/ardour/audioregion.cc
libs/ardour/auditioner.cc
libs/ardour/broadcast_info.cc
libs/ardour/configuration.cc
libs/ardour/crossfade.cc
libs/ardour/globals.cc
libs/ardour/midi_diskstream.cc
libs/ardour/midi_track.cc
libs/ardour/playlist.cc
libs/ardour/playlist_factory.cc
libs/ardour/route.cc
libs/ardour/session.cc
libs/ardour/session_events.cc
libs/ardour/session_midi.cc
libs/ardour/session_process.cc
libs/ardour/session_state.cc
libs/ardour/session_time.cc
libs/ardour/session_transport.cc
libs/ardour/sndfilesource.cc
libs/ardour/source_factory.cc
libs/ardour/track.cc
libs/ardour/utils.cc
libs/ardour/wscript
libs/surfaces/control_protocol/basic_ui.cc
libs/surfaces/control_protocol/control_protocol/smpte.h
libs/surfaces/control_protocol/smpte.cc

index 94ff974360fec1c8372c025b4c6700181cba37d9..c63535e8d0dc734fdf3bee77e8b713702ca48045 100644 (file)
@@ -29,6 +29,8 @@ gtk2_ardour/ergonomic-us.bindings
 gtk2_ardour/mnemonic-us.bindings
 gtk2_ardour/version.cc
 gtk2_ardour/version.h
+gtk2_ardour/test/*.cpp
+gtk2_ardour/test/test_ui_config
 libs/ardour/ardour/version.h
 libs/ardour/svn_revision.cc
 libs/ardour/version.cc
index 9059ba277668f2d813fe09c02051f78c586a9695..74daa23a9a1495cf9dac5a07a39122e9a6856e79 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "ardour/ardour.h"
 #include "ardour/filesystem_paths.h"
+#include "ardour/rc_configuration.h"
 
 #include "actions.h"
 #include "i18n.h"
@@ -359,7 +360,7 @@ ActionManager::uncheck_toggleaction (const char * name)
  * @param Method to get the state of the Configuration setting.
  */
 void
-ActionManager::toggle_config_state (const char* group, const char* action, bool (Configuration::*set)(bool), bool (Configuration::*get)(void) const)
+ActionManager::toggle_config_state (const char* group, const char* action, bool (RCConfiguration::*set)(bool), bool (RCConfiguration::*get)(void) const)
 {
        Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
        if (act) {
@@ -376,13 +377,16 @@ ActionManager::toggle_config_state (const char* group, const char* action, bool
 }
 
 void
-ActionManager::toggle_config_state (const char* group, const char* action, sigc::slot<void> theSlot)
+ActionManager::toggle_config_state_foo (const char* group, const char* action, sigc::slot<bool, bool> set, sigc::slot<bool> get)
 {
        Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
        if (act) {
                Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
                if (tact->get_active()) {
-                       theSlot ();
+                       bool const x = get ();
+                       if (x != tact->get_active ()) {
+                               set (x);
+                       }
                }
        }
 }
@@ -394,7 +398,7 @@ ActionManager::toggle_config_state (const char* group, const char* action, sigc:
  * @param get Method to obtain the state that the ToggleAction should have.
  */
 void
-ActionManager::map_some_state (const char* group, const char* action, bool (Configuration::*get)() const)
+ActionManager::map_some_state (const char* group, const char* action, bool (RCConfiguration::*get)() const)
 {
        Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
        if (act) {
@@ -414,3 +418,21 @@ ActionManager::map_some_state (const char* group, const char* action, bool (Conf
                cerr << group << ':' << action << " not an action\n";
        }
 }
+
+void
+ActionManager::map_some_state (const char* group, const char* action, sigc::slot<bool> get)
+{
+       Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
+       if (act) {
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
+
+               if (tact) {
+                       
+                       bool const x = get ();
+
+                       if (tact->get_active() != x) {
+                               tact->set_active (x);
+                       }
+               }
+       }
+}
index c7175d1891596c0b5b31e2b47f3cfa80d2cea366..3a20f4d5423d636c3617a4a1c76a7e942629fb33 100644 (file)
@@ -27,7 +27,7 @@
 #include <gtkmm/actiongroup.h>
 #include <gtkmm/accelkey.h>
 
-#include "ardour/configuration.h"
+#include "ardour/rc_configuration.h"
 
 namespace Gtk {
        class UIManager;
@@ -59,9 +59,10 @@ class ActionManager
        static std::vector<Glib::RefPtr<Gtk::Action> > jack_opposite_sensitive_actions;
        static std::vector<Glib::RefPtr<Gtk::Action> > edit_point_in_region_sensitive_actions;
 
-       static void map_some_state (const char* group, const char* action, bool (ARDOUR::Configuration::*get)() const);
-       static void toggle_config_state (const char* group, const char* action, bool (ARDOUR::Configuration::*set)(bool), bool (ARDOUR::Configuration::*get)(void) const);
-       static void toggle_config_state (const char* group, const char* action, sigc::slot<void> theSlot);
+       static void map_some_state (const char* group, const char* action, bool (ARDOUR::RCConfiguration::*get)() const);
+       static void map_some_state (const char* group, const char* action, sigc::slot<bool>);
+       static void toggle_config_state (const char* group, const char* action, bool (ARDOUR::RCConfiguration::*set)(bool), bool (ARDOUR::RCConfiguration::*get)(void) const);
+       static void toggle_config_state_foo (const char* group, const char* action, sigc::slot<bool, bool>, sigc::slot<bool>);
 
        static void set_sensitive (std::vector<Glib::RefPtr<Gtk::Action> >& actions, bool);
 
index b8478d222ad006082f6df4821dd3eb41d10ad4a9..999f3d38723f8f0c63cf728b3016a8f620b5f97e 100644 (file)
@@ -198,7 +198,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
        _will_create_new_session_automatically = false;
        add_route_dialog = 0;
        route_params = 0;
-       option_editor = 0;
+       rc_option_editor = 0;
        location_ui = 0;
        open_session_selector = 0;
        have_configure_timeout = false;
@@ -252,7 +252,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
                }
 
                setup_gtk_ardour_enums ();
-               Config->set_current_owner (ConfigVariableBase::Interface);
                setup_profile ();
 
                GainMeter::setup_slider_pix ();
@@ -361,10 +360,6 @@ ARDOUR_UI::post_engine ()
 
        blink_timeout_tag = -1;
 
-       /* the global configuration object is now valid */
-
-       use_config ();
-
        /* this being a GUI and all, we want peakfiles */
 
        AudioFileSource::set_build_peakfiles (true);
@@ -655,6 +650,8 @@ ARDOUR_UI::startup ()
                exit (1);
        }
 
+       use_config ();
+
        goto_editor_window ();
        
        BootMessage (_("Ardour is ready for use"));
@@ -2466,8 +2463,6 @@ ARDOUR_UI::load_session (const Glib::ustring& path, const Glib::ustring& snap_na
 
        connect_to_session (new_session);
 
-       Config->set_current_owner (ConfigVariableBase::Interface);
-
        session_loaded = true;
        
        goto_editor_window ();
@@ -3172,7 +3167,9 @@ ARDOUR_UI::use_config ()
 {
        Glib::RefPtr<Action> act;
 
-       switch (Config->get_native_file_data_format ()) {
+       assert (session);
+
+       switch (session->config.get_native_file_data_format ()) {
        case FormatFloat:
                act = ActionManager::get_action (X_("options"), X_("FileDataFormatFloat"));
                break;
@@ -3189,7 +3186,7 @@ ARDOUR_UI::use_config ()
                ract->set_active ();
        }       
 
-       switch (Config->get_native_file_header_format ()) {
+       switch (session->config.get_native_file_header_format ()) {
        case BWF:
                act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatBWF"));
                break;
index 81e0e0da5cccf1a8547f3c9d4a95155260c7217e..f01e2a6bf98aeddd421e2044ae506baee284a275 100644 (file)
@@ -60,7 +60,6 @@
 #include <gtkmm2ext/bindable_button.h>
 #include "ardour/ardour.h"
 #include "ardour/session.h"
-#include "ardour/configuration.h"
 #include "ardour/types.h"
 
 #include "audio_clock.h"
@@ -71,7 +70,7 @@
 class AudioClock;
 class PublicEditor;
 class Keyboard;
-class OptionEditor;
+class RCOptionEditor;
 class KeyEditor;
 class Mixer_UI;
 class ConnectionEditor;
@@ -257,7 +256,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
 
        void toggle_session_auto_loop ();
 
-       void toggle_options_window ();
+       void toggle_rc_options_window ();
 
   private:
        ArdourStartup*      _startup;
@@ -597,9 +596,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI
 
        KeyEditor *key_editor;
 
-       /* Options window */
+       /* RC Options window */
 
-       OptionEditor *option_editor;
+       RCOptionEditor *rc_option_editor;
 
        /* route dialog */
 
index f2fb31ddbfde5a0b4e4212d11c617042f622a9fa..92fadd198bae6c881ab8c0ddbe00bc06fb8c52af 100644 (file)
@@ -664,7 +664,7 @@ ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev)
                shuttle_grabbed = false;
                shuttle_box.remove_modal_grab ();
                if (Config->get_shuttle_behaviour() == Sprung) {
-                       if (Config->get_auto_play() || roll_button.get_visual_state()) {
+                       if (session->config.get_auto_play() || roll_button.get_visual_state()) {
                                shuttle_fract = SHUTTLE_FRACT_SPEED1;                           
                                session->request_transport_speed (1.0);
                                stop_button.set_visual_state (0);
index 3fa662d589d88773e832c9b926b06e26f8c9f633..37e1a23c21352642b1bbaf6ad2b2717e496093c6 100644 (file)
@@ -29,7 +29,7 @@
 #include "ardour_ui.h"
 #include "location_ui.h"
 #include "mixer_ui.h"
-#include "option_editor.h"
+#include "rc_option_editor.h"
 #include "public_editor.h"
 #include "route_params_ui.h"
 #include "sfdb_ui.h"
@@ -99,10 +99,6 @@ ARDOUR_UI::connect_to_session (Session *s)
                route_params->set_session (s);
        }
 
-       if (option_editor) {
-               option_editor->set_session (s);
-       }
-
        setup_session_options ();
 
        Blink.connect (mem_fun(*this, &ARDOUR_UI::transport_rec_enable_blink));
@@ -202,10 +198,6 @@ ARDOUR_UI::unload_session (bool hide_stuff)
        preroll_clock.set_session (0);
        postroll_clock.set_session (0);
 
-       if (option_editor) {
-               option_editor->set_session (0);
-       }
-
        delete session;
        session = 0;
 
@@ -231,12 +223,12 @@ ARDOUR_UI::toggle_big_clock_window ()
 }
 
 void
-ARDOUR_UI::toggle_options_window ()
+ARDOUR_UI::toggle_rc_options_window ()
 {
-       if (option_editor == 0) {
-               option_editor = new OptionEditor (*this, *editor, *mixer);
-               option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleOptionsEditor")));
-               option_editor->set_session (session);
+       if (rc_option_editor == 0) {
+               rc_option_editor = new RCOptionEditor;
+               rc_option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleOptionsEditor")));
+               rc_option_editor->set_session (session);
        } 
 
        RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleOptionsEditor"));
@@ -244,10 +236,10 @@ ARDOUR_UI::toggle_options_window ()
                RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
        
                if (tact->get_active()) {
-                       option_editor->show_all ();
-                       option_editor->present ();
+                       rc_option_editor->show_all ();
+                       rc_option_editor->present ();
                } else {
-                       option_editor->hide ();
+                       rc_option_editor->hide ();
                } 
        }
 }
index 870cb5ff97d59f1e40dfa27e26e54ea6a25bde06..1e6381ed67cec73d3c9e2e9f6be289c77d42d6bd 100644 (file)
@@ -202,7 +202,7 @@ ARDOUR_UI::install_actions ()
        ActionManager::register_action (common_actions, X_("goto-editor"), _("Show Editor"),  mem_fun(*this, &ARDOUR_UI::goto_editor_window));
        ActionManager::register_action (common_actions, X_("goto-mixer"), _("Show Mixer"),  mem_fun(*this, &ARDOUR_UI::goto_mixer_window));
        ActionManager::register_action (common_actions, X_("toggle-editor-mixer-on-top"), _("Toggle Editor Mixer on Top"),  mem_fun(*this, &ARDOUR_UI::toggle_editor_mixer_on_top));
-       ActionManager::register_toggle_action (common_actions, X_("ToggleOptionsEditor"), _("Preferences"), mem_fun(*this, &ARDOUR_UI::toggle_options_window));
+       ActionManager::register_toggle_action (common_actions, X_("ToggleOptionsEditor"), _("Preferences"), mem_fun(*this, &ARDOUR_UI::toggle_rc_options_window));
        act = ActionManager::register_toggle_action (common_actions, X_("ToggleInspector"), _("Track/Bus Inspector"), mem_fun(*this, &ARDOUR_UI::toggle_route_params_window));
        ActionManager::session_sensitive_actions.push_back (act);
        ActionManager::session_sensitive_actions.push_back (act);
@@ -425,8 +425,8 @@ ARDOUR_UI::install_actions ()
 
        Glib::RefPtr<ActionGroup> shuttle_actions = ActionGroup::create ("ShuttleActions");
 
-       shuttle_actions->add (Action::create (X_("SetShuttleUnitsPercentage"), _("Percentage")), hide_return (bind (mem_fun (*Config, &Configuration::set_shuttle_units), Percentage)));
-       shuttle_actions->add (Action::create (X_("SetShuttleUnitsSemitones"), _("Semitones")), hide_return (bind (mem_fun (*Config, &Configuration::set_shuttle_units), Semitones)));
+       shuttle_actions->add (Action::create (X_("SetShuttleUnitsPercentage"), _("Percentage")), hide_return (bind (mem_fun (*Config, &RCConfiguration::set_shuttle_units), Percentage)));
+       shuttle_actions->add (Action::create (X_("SetShuttleUnitsSemitones"), _("Semitones")), hide_return (bind (mem_fun (*Config, &RCConfiguration::set_shuttle_units), Semitones)));
 
        Glib::RefPtr<ActionGroup> option_actions = ActionGroup::create ("options");
 
index f47f4c90796ce7ae5f4ea3c5d0316a383423b1aa..d5ad849a9c886f37d0bf9347a90a62a0eb25e8da 100644 (file)
@@ -46,55 +46,55 @@ using namespace sigc;
 void
 ARDOUR_UI::toggle_time_master ()
 {
-       ActionManager::toggle_config_state ("Transport", "ToggleTimeMaster", &Configuration::set_jack_time_master, &Configuration::get_jack_time_master);
+       ActionManager::toggle_config_state ("Transport", "ToggleTimeMaster", &RCConfiguration::set_jack_time_master, &RCConfiguration::get_jack_time_master);
 }
 
 void
 ARDOUR_UI::toggle_send_mtc ()
 {
-       ActionManager::toggle_config_state ("options", "SendMTC", &Configuration::set_send_mtc, &Configuration::get_send_mtc);
+       ActionManager::toggle_config_state ("options", "SendMTC", &RCConfiguration::set_send_mtc, &RCConfiguration::get_send_mtc);
 }
 
 void
 ARDOUR_UI::toggle_send_mmc ()
 {
-       ActionManager::toggle_config_state ("options", "SendMMC", &Configuration::set_send_mmc, &Configuration::get_send_mmc);
+       ActionManager::toggle_config_state ("options", "SendMMC", &RCConfiguration::set_send_mmc, &RCConfiguration::get_send_mmc);
 }
 
 void
 ARDOUR_UI::toggle_send_midi_clock ()
 {
-       ActionManager::toggle_config_state ("options", "SendMidiClock", &Configuration::set_send_midi_clock, &Configuration::get_send_midi_clock);
+       ActionManager::toggle_config_state ("options", "SendMidiClock", &RCConfiguration::set_send_midi_clock, &RCConfiguration::get_send_midi_clock);
 }
 
 void
 ARDOUR_UI::toggle_use_mmc ()
 {
-       ActionManager::toggle_config_state ("options", "UseMMC", &Configuration::set_mmc_control, &Configuration::get_mmc_control);
+       ActionManager::toggle_config_state ("options", "UseMMC", &RCConfiguration::set_mmc_control, &RCConfiguration::get_mmc_control);
 }
 
 void
 ARDOUR_UI::toggle_use_osc ()
 {
-       ActionManager::toggle_config_state ("options", "UseOSC", &Configuration::set_use_osc, &Configuration::get_use_osc);
+       ActionManager::toggle_config_state ("options", "UseOSC", &RCConfiguration::set_use_osc, &RCConfiguration::get_use_osc);
 }
 
 void
 ARDOUR_UI::toggle_send_midi_feedback ()
 {
-       ActionManager::toggle_config_state ("options", "SendMIDIfeedback", &Configuration::set_midi_feedback, &Configuration::get_midi_feedback);
+       ActionManager::toggle_config_state ("options", "SendMIDIfeedback", &RCConfiguration::set_midi_feedback, &RCConfiguration::get_midi_feedback);
 }
 
 void
 ARDOUR_UI::toggle_denormal_protection ()
 {
-       ActionManager::toggle_config_state ("options", "DenormalProtection", &Configuration::set_denormal_protection, &Configuration::get_denormal_protection);
+       ActionManager::toggle_config_state ("options", "DenormalProtection", &RCConfiguration::set_denormal_protection, &RCConfiguration::get_denormal_protection);
 }
 
 void
 ARDOUR_UI::toggle_only_copy_imported_files ()
 {
-       ActionManager::toggle_config_state ("options", "OnlyCopyImportedFiles", &Configuration::set_only_copy_imported_files, &Configuration::get_only_copy_imported_files);
+       ActionManager::toggle_config_state ("options", "OnlyCopyImportedFiles", &RCConfiguration::set_only_copy_imported_files, &RCConfiguration::get_only_copy_imported_files);
 }
 
 
@@ -134,8 +134,8 @@ ARDOUR_UI::set_native_file_header_format (HeaderFormat hf)
 
        if (act) {
                Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
-               if (ract && ract->get_active() && Config->get_native_file_header_format() != hf) {
-                       Config->set_native_file_header_format (hf);
+               if (ract && ract->get_active() && session->config.get_native_file_header_format() != hf) {
+                       session->config.set_native_file_header_format (hf);
                }
        }
 }
@@ -164,8 +164,8 @@ ARDOUR_UI::set_native_file_data_format (SampleFormat sf)
 
        if (act) {
                Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
-               if (ract && ract->get_active() && Config->get_native_file_data_format() != sf) {
-                       Config->set_native_file_data_format (sf);
+               if (ract && ract->get_active() && session->config.get_native_file_data_format() != sf) {
+                       session->config.set_native_file_data_format (sf);
                }
        }
 }
@@ -360,25 +360,25 @@ ARDOUR_UI::set_denormal_model (DenormalModel model)
 void
 ARDOUR_UI::toggle_auto_input ()
 {
-       ActionManager::toggle_config_state ("Transport", "ToggleAutoInput", &Configuration::set_auto_input, &Configuration::get_auto_input);
+       ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoInput", mem_fun (session->config, &SessionConfiguration::set_auto_input), mem_fun (session->config, &SessionConfiguration::get_auto_input));
 }
 
 void
 ARDOUR_UI::toggle_auto_play ()
 {
-       ActionManager::toggle_config_state ("Transport", "ToggleAutoPlay", &Configuration::set_auto_play, &Configuration::get_auto_play);
+       ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoPlay", mem_fun (session->config, &SessionConfiguration::set_auto_play), mem_fun (session->config, &SessionConfiguration::get_auto_play));
 }
 
 void
 ARDOUR_UI::toggle_auto_return ()
 {
-       ActionManager::toggle_config_state ("Transport", "ToggleAutoReturn", &Configuration::set_auto_return, &Configuration::get_auto_return);
+       ActionManager::toggle_config_state_foo ("Transport", "ToggleAutoReturn", mem_fun (session->config, &SessionConfiguration::set_auto_return), mem_fun (session->config, &SessionConfiguration::get_auto_return));
 }
 
 void
 ARDOUR_UI::toggle_click ()
 {
-       ActionManager::toggle_config_state ("Transport", "ToggleClick", &Configuration::set_clicking, &Configuration::get_clicking);
+       ActionManager::toggle_config_state ("Transport", "ToggleClick", &RCConfiguration::set_clicking, &RCConfiguration::get_clicking);
 }
 
 void
@@ -446,13 +446,13 @@ ARDOUR_UI::toggle_punch ()
 void
 ARDOUR_UI::toggle_punch_in ()
 {
-       ActionManager::toggle_config_state ("Transport", "TogglePunchIn", &Configuration::set_punch_in, &Configuration::get_punch_in);
+       ActionManager::toggle_config_state_foo ("Transport", "TogglePunchIn", mem_fun (session->config, &SessionConfiguration::set_punch_in), mem_fun (session->config, &SessionConfiguration::get_punch_in));
 }
 
 void
 ARDOUR_UI::toggle_punch_out ()
 {
-       ActionManager::toggle_config_state ("Transport", "TogglePunchOut", &Configuration::set_punch_out, &Configuration::get_punch_out);
+       ActionManager::toggle_config_state_foo ("Transport", "TogglePunchOut", mem_fun (session->config, &SessionConfiguration::set_punch_out), mem_fun (session->config, &SessionConfiguration::get_punch_out));
 }
 
 void
@@ -482,139 +482,139 @@ ARDOUR_UI::toggle_editing_space()
 void
 ARDOUR_UI::toggle_new_plugins_active ()
 {
-       ActionManager::toggle_config_state ("options", "NewPluginsActive", &Configuration::set_new_plugins_active, &Configuration::get_new_plugins_active);
+       ActionManager::toggle_config_state ("options", "NewPluginsActive", &RCConfiguration::set_new_plugins_active, &RCConfiguration::get_new_plugins_active);
 }
 
 void
 ARDOUR_UI::toggle_StopPluginsWithTransport()
 {
-       ActionManager::toggle_config_state ("options", "StopPluginsWithTransport", &Configuration::set_plugins_stop_with_transport, &Configuration::get_plugins_stop_with_transport);
+       ActionManager::toggle_config_state ("options", "StopPluginsWithTransport", &RCConfiguration::set_plugins_stop_with_transport, &RCConfiguration::get_plugins_stop_with_transport);
 }
 
 void
 ARDOUR_UI::toggle_LatchedRecordEnable()
 {
-       ActionManager::toggle_config_state ("options", "LatchedRecordEnable", &Configuration::set_latched_record_enable, &Configuration::get_latched_record_enable);
+       ActionManager::toggle_config_state ("options", "LatchedRecordEnable", &RCConfiguration::set_latched_record_enable, &RCConfiguration::get_latched_record_enable);
 }
 
 void
 ARDOUR_UI::toggle_RegionEquivalentsOverlap()
 {
-       ActionManager::toggle_config_state ("options", "RegionEquivalentsOverlap", &Configuration::set_use_overlap_equivalency, &Configuration::get_use_overlap_equivalency);
+       ActionManager::toggle_config_state ("options", "RegionEquivalentsOverlap", &RCConfiguration::set_use_overlap_equivalency, &RCConfiguration::get_use_overlap_equivalency);
 }
 
 void
 ARDOUR_UI::toggle_DoNotRunPluginsWhileRecording()
 {
-       ActionManager::toggle_config_state ("options", "DoNotRunPluginsWhileRecording", &Configuration::set_do_not_record_plugins, &Configuration::get_do_not_record_plugins);
+       ActionManager::toggle_config_state ("options", "DoNotRunPluginsWhileRecording", &RCConfiguration::set_do_not_record_plugins, &RCConfiguration::get_do_not_record_plugins);
 }
 
 void
 ARDOUR_UI::toggle_VerifyRemoveLastCapture()
 {
-       ActionManager::toggle_config_state ("options", "VerifyRemoveLastCapture", &Configuration::set_verify_remove_last_capture, &Configuration::get_verify_remove_last_capture);
+       ActionManager::toggle_config_state ("options", "VerifyRemoveLastCapture", &RCConfiguration::set_verify_remove_last_capture, &RCConfiguration::get_verify_remove_last_capture);
 }
 
 void
 ARDOUR_UI::toggle_PeriodicSafetyBackups()
 {
-       ActionManager::toggle_config_state ("options", "PeriodicSafetyBackups", &Configuration::set_periodic_safety_backups, &Configuration::get_periodic_safety_backups);
+       ActionManager::toggle_config_state ("options", "PeriodicSafetyBackups", &RCConfiguration::set_periodic_safety_backups, &RCConfiguration::get_periodic_safety_backups);
 }
 
 void
 ARDOUR_UI::toggle_StopRecordingOnXrun()
 {
-       ActionManager::toggle_config_state ("options", "StopRecordingOnXrun", &Configuration::set_stop_recording_on_xrun, &Configuration::get_stop_recording_on_xrun);
+       ActionManager::toggle_config_state ("options", "StopRecordingOnXrun", &RCConfiguration::set_stop_recording_on_xrun, &RCConfiguration::get_stop_recording_on_xrun);
 }
 
 void
 ARDOUR_UI::toggle_CreateXrunMarker()
 {
-       ActionManager::toggle_config_state ("options", "CreateXrunMarker", &Configuration::set_create_xrun_marker, &Configuration::get_create_xrun_marker);
+       ActionManager::toggle_config_state ("options", "CreateXrunMarker", &RCConfiguration::set_create_xrun_marker, &RCConfiguration::get_create_xrun_marker);
 }
 
 void
 ARDOUR_UI::toggle_sync_order_keys ()
 {
-       ActionManager::toggle_config_state ("options", "SyncEditorAndMixerTrackOrder", &Configuration::set_sync_all_route_ordering, &Configuration::get_sync_all_route_ordering);
+       ActionManager::toggle_config_state ("options", "SyncEditorAndMixerTrackOrder", &RCConfiguration::set_sync_all_route_ordering, &RCConfiguration::get_sync_all_route_ordering);
 }
 
 void
 ARDOUR_UI::toggle_StopTransportAtEndOfSession()
 {
-       ActionManager::toggle_config_state ("options", "StopTransportAtEndOfSession", &Configuration::set_stop_at_session_end, &Configuration::get_stop_at_session_end);
+       ActionManager::toggle_config_state ("options", "StopTransportAtEndOfSession", &RCConfiguration::set_stop_at_session_end, &RCConfiguration::get_stop_at_session_end);
 }
 
 void
 ARDOUR_UI::toggle_GainReduceFastTransport()
 {
-       ActionManager::toggle_config_state ("options", "GainReduceFastTransport", &Configuration::set_quieten_at_speed, &Configuration::get_quieten_at_speed);
+       ActionManager::toggle_config_state ("options", "GainReduceFastTransport", &RCConfiguration::set_quieten_at_speed, &RCConfiguration::get_quieten_at_speed);
 }
 
 void
 ARDOUR_UI::toggle_LatchedSolo()
 {
-       ActionManager::toggle_config_state ("options", "LatchedSolo", &Configuration::set_solo_latched, &Configuration::get_solo_latched);
+       ActionManager::toggle_config_state ("options", "LatchedSolo", &RCConfiguration::set_solo_latched, &RCConfiguration::get_solo_latched);
 }
 
 void
 ARDOUR_UI::toggle_ShowSoloMutes()
 {
-       ActionManager::toggle_config_state ("options", "ShowSoloMutes", &Configuration::set_show_solo_mutes, &Configuration::get_show_solo_mutes);
+       ActionManager::toggle_config_state ("options", "ShowSoloMutes", &RCConfiguration::set_show_solo_mutes, &RCConfiguration::get_show_solo_mutes);
 }
 
 void
 ARDOUR_UI::toggle_SoloMuteOverride()
 {
-       ActionManager::toggle_config_state ("options", "SoloMuteOverride", &Configuration::set_solo_mute_override, &Configuration::get_solo_mute_override);
+       ActionManager::toggle_config_state ("options", "SoloMuteOverride", &RCConfiguration::set_solo_mute_override, &RCConfiguration::get_solo_mute_override);
 }
 
 void
 ARDOUR_UI::toggle_PrimaryClockDeltaEditCursor()
 {
-       ActionManager::toggle_config_state ("options", "PrimaryClockDeltaEditCursor", &Configuration::set_primary_clock_delta_edit_cursor, &Configuration::get_primary_clock_delta_edit_cursor);
+       ActionManager::toggle_config_state ("options", "PrimaryClockDeltaEditCursor", &RCConfiguration::set_primary_clock_delta_edit_cursor, &RCConfiguration::get_primary_clock_delta_edit_cursor);
 }
 
 void
 ARDOUR_UI::toggle_SecondaryClockDeltaEditCursor()
 {
-       ActionManager::toggle_config_state ("options", "SecondaryClockDeltaEditCursor", &Configuration::set_secondary_clock_delta_edit_cursor, &Configuration::get_secondary_clock_delta_edit_cursor);
+       ActionManager::toggle_config_state ("options", "SecondaryClockDeltaEditCursor", &RCConfiguration::set_secondary_clock_delta_edit_cursor, &RCConfiguration::get_secondary_clock_delta_edit_cursor);
 }
 
 void
 ARDOUR_UI::toggle_ShowTrackMeters()
 {
-       ActionManager::toggle_config_state ("options", "ShowTrackMeters", &Configuration::set_show_track_meters, &Configuration::get_show_track_meters);
+       ActionManager::toggle_config_state ("options", "ShowTrackMeters", &RCConfiguration::set_show_track_meters, &RCConfiguration::get_show_track_meters);
 }
 
 void
 ARDOUR_UI::toggle_TapeMachineMode ()
 {
-       ActionManager::toggle_config_state ("options", "ToggleTapeMachineMode", &Configuration::set_tape_machine_mode, &Configuration::get_tape_machine_mode);
+       ActionManager::toggle_config_state ("options", "ToggleTapeMachineMode", &RCConfiguration::set_tape_machine_mode, &RCConfiguration::get_tape_machine_mode);
 }
 
 void
 ARDOUR_UI::toggle_use_narrow_ms()
 {
-       ActionManager::toggle_config_state ("options", "DefaultNarrowMS", &Configuration::set_default_narrow_ms, &Configuration::get_default_narrow_ms);
+       ActionManager::toggle_config_state ("options", "DefaultNarrowMS", &RCConfiguration::set_default_narrow_ms, &RCConfiguration::get_default_narrow_ms);
 }
 
 void
 ARDOUR_UI::toggle_NameNewMarkers()
 {
-       ActionManager::toggle_config_state ("options", "NameNewMarkers", &Configuration::set_name_new_markers, &Configuration::get_name_new_markers);
+       ActionManager::toggle_config_state ("options", "NameNewMarkers", &RCConfiguration::set_name_new_markers, &RCConfiguration::get_name_new_markers);
 }
 
 void
 ARDOUR_UI::toggle_rubberbanding_snaps_to_grid ()
 {
-       ActionManager::toggle_config_state ("options", "RubberbandingSnapsToGrid", &Configuration::set_rubberbanding_snaps_to_grid, &Configuration::get_rubberbanding_snaps_to_grid);
+       ActionManager::toggle_config_state ("options", "RubberbandingSnapsToGrid", &RCConfiguration::set_rubberbanding_snaps_to_grid, &RCConfiguration::get_rubberbanding_snaps_to_grid);
 }
 
 void
 ARDOUR_UI::toggle_auto_analyse_audio ()
 {
-       ActionManager::toggle_config_state ("options", "AutoAnalyseAudio", &Configuration::set_auto_analyse_audio, &Configuration::get_auto_analyse_audio);
+       ActionManager::toggle_config_state ("options", "AutoAnalyseAudio", &RCConfiguration::set_auto_analyse_audio, &RCConfiguration::get_auto_analyse_audio);
 }
 
 void
@@ -784,7 +784,7 @@ ARDOUR_UI::map_file_header_format ()
 {
        const char* action = 0;
 
-       switch (Config->get_native_file_header_format()) {
+       switch (session->config.get_native_file_header_format()) {
        case BWF:
                action = X_("FileHeaderFormatBWF");
                break;
@@ -811,7 +811,7 @@ ARDOUR_UI::map_file_header_format ()
 
        default:
                fatal << string_compose (_("programming error: unknown file header format passed to ARDOUR_UI::map_file_data_format: %1"),
-                                        Config->get_native_file_header_format()) << endmsg;
+                                        session->config.get_native_file_header_format()) << endmsg;
                /*NOTREACHED*/
        }
 
@@ -832,7 +832,7 @@ ARDOUR_UI::map_file_data_format ()
 {
        const char* action = 0;
 
-       switch (Config->get_native_file_data_format()) {
+       switch (session->config.get_native_file_data_format()) {
        case FormatFloat:
                action = X_("FileDataFormatFloat");
                break;
@@ -847,7 +847,7 @@ ARDOUR_UI::map_file_data_format ()
 
        default:
                fatal << string_compose (_("programming error: unknown file data format passed to ARDOUR_UI::map_file_data_format: %1"),
-                                        Config->get_native_file_data_format()) << endmsg;
+                                        session->config.get_native_file_data_format()) << endmsg;
                /*NOTREACHED*/
        }
 
@@ -1100,11 +1100,11 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
 
        } else if (PARAM_IS ("send-mtc")) {
 
-               ActionManager::map_some_state ("options", "SendMTC", &Configuration::get_send_mtc);
+               ActionManager::map_some_state ("options", "SendMTC", &RCConfiguration::get_send_mtc);
 
        } else if (PARAM_IS ("send-mmc")) {
 
-               ActionManager::map_some_state ("options", "SendMMC", &Configuration::get_send_mmc);
+               ActionManager::map_some_state ("options", "SendMMC", &RCConfiguration::get_send_mmc);
 
        } else if (PARAM_IS ("use-osc")) {
 
@@ -1116,64 +1116,64 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
                }
 #endif
 
-               ActionManager::map_some_state ("options", "UseOSC", &Configuration::get_use_osc);
+               ActionManager::map_some_state ("options", "UseOSC", &RCConfiguration::get_use_osc);
 
        } else if (PARAM_IS ("mmc-control")) {
-               ActionManager::map_some_state ("options", "UseMMC", &Configuration::get_mmc_control);
+               ActionManager::map_some_state ("options", "UseMMC", &RCConfiguration::get_mmc_control);
        } else if (PARAM_IS ("midi-feedback")) {
-               ActionManager::map_some_state ("options", "SendMIDIfeedback", &Configuration::get_midi_feedback);
+               ActionManager::map_some_state ("options", "SendMIDIfeedback", &RCConfiguration::get_midi_feedback);
        } else if (PARAM_IS ("do-not-record-plugins")) {
-               ActionManager::map_some_state ("options", "DoNotRunPluginsWhileRecording", &Configuration::get_do_not_record_plugins);
+               ActionManager::map_some_state ("options", "DoNotRunPluginsWhileRecording", &RCConfiguration::get_do_not_record_plugins);
        } else if (PARAM_IS ("latched-record-enable")) {
-               ActionManager::map_some_state ("options", "LatchedRecordEnable", &Configuration::get_latched_record_enable);
+               ActionManager::map_some_state ("options", "LatchedRecordEnable", &RCConfiguration::get_latched_record_enable);
        } else if (PARAM_IS ("solo-latched")) {
-               ActionManager::map_some_state ("options", "LatchedSolo", &Configuration::get_solo_latched);
+               ActionManager::map_some_state ("options", "LatchedSolo", &RCConfiguration::get_solo_latched);
        } else if (PARAM_IS ("show-solo-mutes")) {
-               ActionManager::map_some_state ("options", "ShowSoloMutes", &Configuration::get_show_solo_mutes);
+               ActionManager::map_some_state ("options", "ShowSoloMutes", &RCConfiguration::get_show_solo_mutes);
        } else if (PARAM_IS ("solo-mute-override")) {
-               ActionManager::map_some_state ("options", "SoloMuteOverride", &Configuration::get_solo_mute_override);
+               ActionManager::map_some_state ("options", "SoloMuteOverride", &RCConfiguration::get_solo_mute_override);
        } else if (PARAM_IS ("solo-model")) {
                map_solo_model ();
        } else if (PARAM_IS ("auto-play")) {
-               ActionManager::map_some_state ("Transport", "ToggleAutoPlay", &Configuration::get_auto_play);
+               ActionManager::map_some_state ("Transport", "ToggleAutoPlay", mem_fun (session->config, &SessionConfiguration::get_auto_play));
        } else if (PARAM_IS ("auto-return")) {
-               ActionManager::map_some_state ("Transport", "ToggleAutoReturn", &Configuration::get_auto_return);
+               ActionManager::map_some_state ("Transport", "ToggleAutoReturn", mem_fun (session->config, &SessionConfiguration::get_auto_return));
        } else if (PARAM_IS ("auto-input")) {
-               ActionManager::map_some_state ("Transport", "ToggleAutoInput", &Configuration::get_auto_input);
+               ActionManager::map_some_state ("Transport", "ToggleAutoInput", mem_fun (session->config, &SessionConfiguration::get_auto_input));
        } else if (PARAM_IS ("tape-machine-mode")) {
-               ActionManager::map_some_state ("options", "ToggleTapeMachineMode", &Configuration::get_tape_machine_mode);
+               ActionManager::map_some_state ("options", "ToggleTapeMachineMode", &RCConfiguration::get_tape_machine_mode);
        } else if (PARAM_IS ("punch-out")) {
-               ActionManager::map_some_state ("Transport", "TogglePunchOut", &Configuration::get_punch_out);
-               if (!Config->get_punch_out()) {
+               ActionManager::map_some_state ("Transport", "TogglePunchOut", mem_fun (session->config, &SessionConfiguration::get_punch_out));
+               if (!session->config.get_punch_out()) {
                        unset_dual_punch ();
                }
        } else if (PARAM_IS ("punch-in")) {
-               ActionManager::map_some_state ("Transport", "TogglePunchIn", &Configuration::get_punch_in);
-               if (!Config->get_punch_in()) {
+               ActionManager::map_some_state ("Transport", "TogglePunchIn", mem_fun (session->config, &SessionConfiguration::get_punch_in));
+               if (!session->config.get_punch_in()) {
                        unset_dual_punch ();
                }
        } else if (PARAM_IS ("clicking")) {
-               ActionManager::map_some_state ("Transport", "ToggleClick", &Configuration::get_clicking);
+               ActionManager::map_some_state ("Transport", "ToggleClick", &RCConfiguration::get_clicking);
        } else if (PARAM_IS ("jack-time-master")) {
-               ActionManager::map_some_state ("Transport",  "ToggleTimeMaster", &Configuration::get_jack_time_master);
+               ActionManager::map_some_state ("Transport",  "ToggleTimeMaster", &RCConfiguration::get_jack_time_master);
        } else if (PARAM_IS ("plugins-stop-with-transport")) {
-               ActionManager::map_some_state ("options",  "StopPluginsWithTransport", &Configuration::get_plugins_stop_with_transport);
+               ActionManager::map_some_state ("options",  "StopPluginsWithTransport", &RCConfiguration::get_plugins_stop_with_transport);
        } else if (PARAM_IS ("new-plugins-active")) {
-               ActionManager::map_some_state ("options",  "NewPluginsActive", &Configuration::get_new_plugins_active);
+               ActionManager::map_some_state ("options",  "NewPluginsActive", &RCConfiguration::get_new_plugins_active);
        } else if (PARAM_IS ("latched-record-enable")) {
-               ActionManager::map_some_state ("options", "LatchedRecordEnable", &Configuration::get_latched_record_enable);
+               ActionManager::map_some_state ("options", "LatchedRecordEnable", &RCConfiguration::get_latched_record_enable);
        } else if (PARAM_IS ("verify-remove-last-capture")) {
-               ActionManager::map_some_state ("options",  "VerifyRemoveLastCapture", &Configuration::get_verify_remove_last_capture);
+               ActionManager::map_some_state ("options",  "VerifyRemoveLastCapture", &RCConfiguration::get_verify_remove_last_capture);
        } else if (PARAM_IS ("periodic-safety-backups")) {
-               ActionManager::map_some_state ("options",  "PeriodicSafetyBackups", &Configuration::get_periodic_safety_backups);
+               ActionManager::map_some_state ("options",  "PeriodicSafetyBackups", &RCConfiguration::get_periodic_safety_backups);
        } else if (PARAM_IS ("stop-recording-on-xrun")) {
-               ActionManager::map_some_state ("options",  "StopRecordingOnXrun", &Configuration::get_stop_recording_on_xrun);
+               ActionManager::map_some_state ("options",  "StopRecordingOnXrun", &RCConfiguration::get_stop_recording_on_xrun);
        } else if (PARAM_IS ("create-xrun-marker")) {
-               ActionManager::map_some_state ("options",  "CreateXrunMarker", &Configuration::get_create_xrun_marker);
+               ActionManager::map_some_state ("options",  "CreateXrunMarker", &RCConfiguration::get_create_xrun_marker);
        } else if (PARAM_IS ("sync-all-route-ordering")) {
-               ActionManager::map_some_state ("options",  "SyncEditorAndMixerTrackOrder", &Configuration::get_sync_all_route_ordering);
+               ActionManager::map_some_state ("options",  "SyncEditorAndMixerTrackOrder", &RCConfiguration::get_sync_all_route_ordering);
        } else if (PARAM_IS ("stop-at-session-end")) {
-               ActionManager::map_some_state ("options",  "StopTransportAtEndOfSession", &Configuration::get_stop_at_session_end);
+               ActionManager::map_some_state ("options",  "StopTransportAtEndOfSession", &RCConfiguration::get_stop_at_session_end);
        } else if (PARAM_IS ("monitoring-model")) {
                map_monitor_model ();
        } else if (PARAM_IS ("denormal-model")) {
@@ -1183,9 +1183,9 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
        } else if (PARAM_IS ("remote-model")) {
                map_remote_model ();
        } else if (PARAM_IS ("use-video-sync")) {
-               ActionManager::map_some_state ("Transport",  "ToggleVideoSync", &Configuration::get_use_video_sync);
+               ActionManager::map_some_state ("Transport",  "ToggleVideoSync", &RCConfiguration::get_use_video_sync);
        } else if (PARAM_IS ("quieten-at-speed")) {
-               ActionManager::map_some_state ("options",  "GainReduceFastTransport", &Configuration::get_quieten_at_speed);
+               ActionManager::map_some_state ("options",  "GainReduceFastTransport", &RCConfiguration::get_quieten_at_speed);
        } else if (PARAM_IS ("shuttle-behaviour")) {
 
                switch (Config->get_shuttle_behaviour ()) {
@@ -1236,20 +1236,20 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
                        secondary_clock.set (0, true);
                }
        } else if (PARAM_IS ("use-overlap-equivalency")) {
-               ActionManager::map_some_state ("options", "RegionEquivalentsOverlap", &Configuration::get_use_overlap_equivalency);
+               ActionManager::map_some_state ("options", "RegionEquivalentsOverlap", &RCConfiguration::get_use_overlap_equivalency);
        } else if (PARAM_IS ("primary-clock-delta-edit-cursor")) {
-               ActionManager::map_some_state ("options",  "PrimaryClockDeltaEditCursor", &Configuration::get_primary_clock_delta_edit_cursor);
+               ActionManager::map_some_state ("options",  "PrimaryClockDeltaEditCursor", &RCConfiguration::get_primary_clock_delta_edit_cursor);
        } else if (PARAM_IS ("secondary-clock-delta-edit-cursor")) {
-               ActionManager::map_some_state ("options",  "SecondaryClockDeltaEditCursor", &Configuration::get_secondary_clock_delta_edit_cursor);
+               ActionManager::map_some_state ("options",  "SecondaryClockDeltaEditCursor", &RCConfiguration::get_secondary_clock_delta_edit_cursor);
        } else if (PARAM_IS ("only-copy-imported-files")) {
                map_only_copy_imported_files ();
        } else if (PARAM_IS ("show-track-meters")) {
-               ActionManager::map_some_state ("options",  "ShowTrackMeters", &Configuration::get_show_track_meters);
+               ActionManager::map_some_state ("options",  "ShowTrackMeters", &RCConfiguration::get_show_track_meters);
                editor->toggle_meter_updating();
        } else if (PARAM_IS ("default-narrow_ms")) {
-               ActionManager::map_some_state ("options",  "DefaultNarrowMS", &Configuration::get_default_narrow_ms);
+               ActionManager::map_some_state ("options",  "DefaultNarrowMS", &RCConfiguration::get_default_narrow_ms);
        } else if (PARAM_IS ("rubberbanding-snaps-to-grid")) {
-               ActionManager::map_some_state ("options", "RubberbandingSnapsToGrid", &Configuration::get_rubberbanding_snaps_to_grid);
+               ActionManager::map_some_state ("options", "RubberbandingSnapsToGrid", &RCConfiguration::get_rubberbanding_snaps_to_grid);
        }
 
 
index 372dd84e41acdf7e2337a497f07f0061d8edde34..ca8090dcc4d2de702db3574997d9a79dbc19c5ff 100644 (file)
@@ -200,7 +200,7 @@ AudioRegionView::init (Gdk::Color& basic_color, bool wfd)
 
        setup_fade_handle_positions ();
 
-       if (!Config->get_show_region_fades()) {
+       if (!trackview.session().config.get_show_region_fades()) {
                set_fade_visibility (false);
        }
 
@@ -415,7 +415,7 @@ AudioRegionView::reset_width_dependent_items (double pixel_width)
                                fade_in_handle->hide();
                                fade_out_handle->hide();
                        } else {
-                               if (Config->get_show_region_fades()) {
+                               if (trackview.session().config.get_show_region_fades()) {
                                        fade_in_handle->show();
                                        fade_out_handle->show();
                                }
@@ -575,7 +575,7 @@ AudioRegionView::reset_fade_in_shape_width (nframes_t width)
                return;
        }
 
-       if (Config->get_show_region_fades()) {
+       if (trackview.session().config.get_show_region_fades()) {
                fade_in_shape->show();
        }
 
@@ -663,7 +663,7 @@ AudioRegionView::reset_fade_out_shape_width (nframes_t width)
                return;
        } 
        
-       if (Config->get_show_region_fades()) {
+       if (trackview.session().config.get_show_region_fades()) {
                fade_out_shape->show();
        }
 
index 772b455f978c898d9c3ba3ab32edf3bce0c349da..19e2e2368b83fc75296cdaa99ace2d62e100d57b 100644 (file)
@@ -356,7 +356,7 @@ AudioStreamView::add_crossfade (boost::shared_ptr<Crossfade> crossfade)
        cv->set_valid (true);
        crossfade->Invalidated.connect (mem_fun (*this, &AudioStreamView::remove_crossfade));
        crossfade_views.push_back (cv);
-       if (!Config->get_xfades_visible() || !crossfades_visible || _layer_display == Stacked) {
+       if (!_trackview.session().config.get_xfades_visible() || !crossfades_visible || _layer_display == Stacked) {
                cv->hide ();
        }
 }
index f1c4e4b18470593e65d8e004803daab69bb57210..e84a4bfffe6605f5e4c618ff87414166e41c350d 100644 (file)
@@ -1036,7 +1036,7 @@ Editor::set_crossfade_model (CrossfadeModel model)
        if (act) {
                RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
                if (ract && ract->get_active()) {
-                       Config->set_xfade_model (model);
+                       session->config.set_xfade_model (model);
                }
        }
 }
@@ -1046,7 +1046,7 @@ Editor::update_crossfade_model ()
 {
        RefPtr<Action> act;
 
-       switch (Config->get_xfade_model()) {
+       switch (session->config.get_xfade_model()) {
        case FullCrossfade:
                act = ActionManager::get_action (X_("Editor"), X_("CrossfadesFull"));
                break;
@@ -1072,7 +1072,7 @@ Editor::update_smpte_mode ()
        RefPtr<Action> act;
        const char* action = 0;
 
-       switch (Config->get_smpte_format()) {
+       switch (session->config.get_smpte_format()) {
        case smpte_23976:
                action = X_("Smpte23976");
                break;
@@ -1160,7 +1160,9 @@ Editor::update_layering_model ()
 {
        RefPtr<Action> act;
 
-       switch (Config->get_layer_model()) {
+       assert (session);
+
+       switch (session->config.get_layer_model()) {
        case LaterHigher:
                act = ActionManager::get_action (X_("Editor"), X_("LayerLaterHigher"));
                break;
@@ -1188,6 +1190,8 @@ Editor::set_layer_model (LayerModel model)
           active.
        */
 
+       assert (session);
+
        RefPtr<Action> act;
 
        switch (model) {
@@ -1204,8 +1208,8 @@ Editor::set_layer_model (LayerModel model)
        
        if (act) {
                RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
-               if (ract && ract->get_active() && Config->get_layer_model() != model) {
-                       Config->set_layer_model (model);
+               if (ract && ract->get_active() && session->config.get_layer_model() != model) {
+                       session->config.set_layer_model (model);
                }
        }
 }
@@ -1668,7 +1672,7 @@ Editor::update_subframes_per_frame ()
        RefPtr<Action> act;
        const char* action = 0;
 
-       uint32_t sfpf = Config->get_subframes_per_frame();
+       uint32_t const sfpf = session->config.get_subframes_per_frame();
 
        if (sfpf == 80) {
                action = X_("Subframes80");
@@ -1716,7 +1720,7 @@ Editor::subframes_per_frame_chosen (uint32_t sfpf)
        if (act) {
                RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
                if (ract && ract->get_active()) {
-                       Config->set_subframes_per_frame ((uint32_t) rint (sfpf));
+                       session->config.set_subframes_per_frame ((uint32_t) rint (sfpf));
                }
                
        } else  {
@@ -1727,43 +1731,43 @@ Editor::subframes_per_frame_chosen (uint32_t sfpf)
 void
 Editor::toggle_region_fades ()
 {
-       ActionManager::toggle_config_state ("Editor", "toggle-region-fades", &Configuration::set_use_region_fades, &Configuration::get_use_region_fades);
+       ActionManager::toggle_config_state_foo ("Editor", "toggle-region-fades", mem_fun (session->config, &SessionConfiguration::set_use_region_fades), mem_fun (session->config, &SessionConfiguration::get_use_region_fades));
 }
 
 void
 Editor::toggle_region_fades_visible ()
 {
-       ActionManager::toggle_config_state ("Editor", "toggle-region-fades-visible", &Configuration::set_show_region_fades, &Configuration::get_show_region_fades);
+       ActionManager::toggle_config_state_foo ("Editor", "toggle-region-fades-visible", mem_fun (session->config, &SessionConfiguration::set_show_region_fades), mem_fun (session->config, &SessionConfiguration::get_show_region_fades));
 }
 
 void
 Editor::toggle_auto_xfade ()
 {
-       ActionManager::toggle_config_state ("Editor", "toggle-auto-xfades", &Configuration::set_auto_xfade, &Configuration::get_auto_xfade);
+       ActionManager::toggle_config_state_foo ("Editor", "toggle-auto-xfades", mem_fun (session->config, &SessionConfiguration::set_auto_xfade), mem_fun (session->config, &SessionConfiguration::get_auto_xfade));
 }
 
 void
 Editor::toggle_xfades_active ()
 {
-       ActionManager::toggle_config_state ("Editor", "toggle-xfades-active", &Configuration::set_xfades_active, &Configuration::get_xfades_active);
+       ActionManager::toggle_config_state_foo ("Editor", "toggle-xfades-active", mem_fun (session->config, &SessionConfiguration::set_xfades_active), mem_fun (session->config, &SessionConfiguration::get_xfades_active));
 }
 
 void
 Editor::toggle_xfade_visibility ()
 {
-       ActionManager::toggle_config_state ("Editor", "toggle-xfades-visible", &Configuration::set_xfades_visible, &Configuration::get_xfades_visible);
+       ActionManager::toggle_config_state_foo ("Editor", "toggle-xfades-visible", mem_fun (session->config, &SessionConfiguration::set_xfades_visible), mem_fun (session->config, &SessionConfiguration::get_xfades_visible));
 }
 
 void
 Editor::toggle_link_region_and_track_selection ()
 {
-       ActionManager::toggle_config_state ("Editor", "link-region-and-track-selection", &Configuration::set_link_region_and_track_selection, &Configuration::get_link_region_and_track_selection);
+       ActionManager::toggle_config_state ("Editor", "link-region-and-track-selection", &RCConfiguration::set_link_region_and_track_selection, &RCConfiguration::get_link_region_and_track_selection);
 }
 
 void
 Editor::toggle_automation_follows_regions ()
 {
-       ActionManager::toggle_config_state ("Editor", "automation-follows-regions", &Configuration::set_automation_follows_regions, &Configuration::get_automation_follows_regions);
+       ActionManager::toggle_config_state ("Editor", "automation-follows-regions", &RCConfiguration::set_automation_follows_regions, &RCConfiguration::get_automation_follows_regions);
 }
 
 /** A Configuration parameter has changed.
@@ -1790,17 +1794,17 @@ Editor::parameter_changed (const char* parameter_name)
        } else if (PARAM_IS ("video-pullup")) {
                update_video_pullup ();
        } else if (PARAM_IS ("xfades-active")) {
-               ActionManager::map_some_state ("Editor", "toggle-xfades-active", &Configuration::get_xfades_active);
+               ActionManager::map_some_state ("Editor", "toggle-xfades-active", mem_fun (session->config, &SessionConfiguration::get_xfades_active));
        } else if (PARAM_IS ("xfades-visible")) {
-               ActionManager::map_some_state ("Editor", "toggle-xfades-visible", &Configuration::get_xfades_visible);
+               ActionManager::map_some_state ("Editor", "toggle-xfades-visible", mem_fun (session->config, &SessionConfiguration::get_xfades_visible));
                update_xfade_visibility ();
        } else if (PARAM_IS ("show-region-fades")) {
-               ActionManager::map_some_state ("Editor", "toggle-region-fades-visible", &Configuration::get_show_region_fades);
+               ActionManager::map_some_state ("Editor", "toggle-region-fades-visible", mem_fun (session->config, &SessionConfiguration::get_show_region_fades));
                update_region_fade_visibility ();
        } else if (PARAM_IS ("use-region-fades")) {
-               ActionManager::map_some_state ("Editor", "toggle-region-fades", &Configuration::get_use_region_fades);
+               ActionManager::map_some_state ("Editor", "toggle-region-fades", mem_fun (session->config, &SessionConfiguration::get_use_region_fades));
        } else if (PARAM_IS ("auto-xfade")) {
-               ActionManager::map_some_state ("Editor", "toggle-auto-xfades", &Configuration::get_auto_xfade);
+               ActionManager::map_some_state ("Editor", "toggle-auto-xfades", mem_fun (session->config, &SessionConfiguration::get_auto_xfade));
        } else if (PARAM_IS ("xfade-model")) {
                update_crossfade_model ();
        } else if (PARAM_IS ("edit-mode")) {
@@ -1811,9 +1815,9 @@ Editor::parameter_changed (const char* parameter_name)
        } else if (PARAM_IS ("show-track-meters")) {
                toggle_meter_updating();
        } else if (PARAM_IS ("link-region-and-track-selection")) {
-               ActionManager::map_some_state ("Editor", "link-region-and-track-selection", &Configuration::get_link_region_and_track_selection);
+               ActionManager::map_some_state ("Editor", "link-region-and-track-selection", &RCConfiguration::get_link_region_and_track_selection);
        } else if (PARAM_IS ("automation-follows-regions")) {
-               ActionManager::map_some_state ("Editor", "automation-follows-regions", &Configuration::get_automation_follows_regions);
+               ActionManager::map_some_state ("Editor", "automation-follows-regions", &RCConfiguration::get_automation_follows_regions);
        }
 
 #undef PARAM_IS
index 489b6e8cbc141a72bc2b694988dc62c00dd775bd..d849f7b971d4891ef56ef15cd29e120886102477 100644 (file)
@@ -1140,15 +1140,15 @@ Editor::update_punch_range_view (bool visibility)
 
        Location* tpl;
 
-       if ((Config->get_punch_in() || Config->get_punch_out()) && ((tpl = transport_punch_location()) != 0)) {
+       if ((session->config.get_punch_in() || session->config.get_punch_out()) && ((tpl = transport_punch_location()) != 0)) {
                guint track_canvas_width,track_canvas_height;
                track_canvas->get_size(track_canvas_width,track_canvas_height);
-               if (Config->get_punch_in()) {
+               if (session->config.get_punch_in()) {
                        transport_punch_range_rect->property_x1() = frame_to_pixel (tpl->start());
-                       transport_punch_range_rect->property_x2() = (Config->get_punch_out() ? frame_to_pixel (tpl->end()) : frame_to_pixel (JACK_MAX_FRAMES));
+                       transport_punch_range_rect->property_x2() = (session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : frame_to_pixel (JACK_MAX_FRAMES));
                } else {
                        transport_punch_range_rect->property_x1() = 0;
-                       transport_punch_range_rect->property_x2() = (Config->get_punch_out() ? frame_to_pixel (tpl->end()) : track_canvas_width);
+                       transport_punch_range_rect->property_x2() = (session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : track_canvas_width);
                }
                
                if (visibility) {
index 7e1a303e73b5d9c34ef9e0ca295b4555eae47a83..a9cc7ae7d6d6b0de1c488bbcde9d02f4419cfaf2 100644 (file)
@@ -5301,7 +5301,7 @@ Editor::toggle_selected_region_fades (int dir)
 void
 Editor::update_region_fade_visibility ()
 {
-       bool _fade_visibility = Config->get_show_region_fades ();
+       bool _fade_visibility = session->config.get_show_region_fades ();
 
        for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
                AudioTimeAxisView* v = dynamic_cast<AudioTimeAxisView*>(*i);
@@ -5319,7 +5319,7 @@ Editor::update_region_fade_visibility ()
 void
 Editor::update_xfade_visibility ()
 {
-       _xfade_visibility = Config->get_xfades_visible ();
+       _xfade_visibility = session->config.get_xfades_visible ();
        
        for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
                AudioTimeAxisView* v = dynamic_cast<AudioTimeAxisView*>(*i);
index 0998b86bd9526aa33b4855d7529a9dd63d4189a7..4daf57d3aed482abb3bc945572c8d8ec2c639c31 100644 (file)
@@ -988,7 +988,7 @@ Editor::set_smpte_ruler_scale (gdouble lower, gdouble upper)
        if (range < (2 * session->frames_per_smpte_frame())) { /* 0 - 2 frames */
                smpte_ruler_scale = smpte_show_bits;
                smpte_mark_modulo = 20;
-               smpte_nmarks = 2 + (2 * Config->get_subframes_per_frame());
+               smpte_nmarks = 2 + (2 * session->config.get_subframes_per_frame());
        } else if (range <= (fr / 4)) { /* 2 frames - 0.250 second */
                smpte_ruler_scale = smpte_show_frames;
                smpte_mark_modulo = 1;
@@ -1111,7 +1111,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
                        (*marks)[n].position = pos;
 
                        // Increment subframes by one
-                       SMPTE::increment_subframes( smpte );
+                       SMPTE::increment_subframes( smpte, session->config.get_subframes_per_frame() );
                }
          break;
        case smpte_show_seconds:
@@ -1138,7 +1138,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
         
                        }
                        (*marks)[n].label = g_strdup (buf);
-                       SMPTE::increment_seconds( smpte );
+                       SMPTE::increment_seconds( smpte, session->config.get_subframes_per_frame() );
                }
          break;
        case smpte_show_minutes:
@@ -1163,7 +1163,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
                        }
                        (*marks)[n].label = g_strdup (buf);
                        (*marks)[n].position = pos;
-                       SMPTE::increment_minutes( smpte );
+                       SMPTE::increment_minutes( smpte, session->config.get_subframes_per_frame() );
                }
 
          break;
@@ -1186,7 +1186,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
                        (*marks)[n].label = g_strdup (buf);
                        (*marks)[n].position = pos;
 
-                       SMPTE::increment_hours( smpte );
+                       SMPTE::increment_hours( smpte, session->config.get_subframes_per_frame() );
                }
          break;
        case smpte_show_frames:
@@ -1212,7 +1212,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
         
                        }
                        (*marks)[n].label = g_strdup (buf);
-                       SMPTE::increment( smpte );
+                       SMPTE::increment( smpte, session->config.get_subframes_per_frame() );
                }
 
          break;
index 8328bc0c062b834e627c98102975b6e1d1696e1a..8b9f0d10931073d905569f2795c4c90cfc1f48ee 100644 (file)
@@ -23,7 +23,6 @@
 #include <vector>
 #include <sigc++/signal.h>
 #include <libgnomecanvasmm.h>
-#include "ardour/configuration.h"
 #include "canvas.h"
 
 namespace Gnome {
index 6e692c6eac2bc86489524c77159f362e0e3b6ac2..d118f1dd8f3171be2eb5521f6de081e5224a7b27 100644 (file)
@@ -39,8 +39,8 @@ MidiPortDialog::MidiPortDialog ()
 
        port_name.signal_activate().connect (mem_fun (*this, &MidiPortDialog::entry_activated));
 
-       add_button (Stock::ADD, RESPONSE_ACCEPT);
        add_button (Stock::CANCEL, RESPONSE_CANCEL);
+       add_button (Stock::ADD, RESPONSE_ACCEPT);
 }
 
 void
index b1bff9c5ffef8fea526a8eb9f3ee5e9196c864d6..5920475bd73c3b4c4966bd1fb3727e4f7dd5b888 100644 (file)
@@ -1,5 +1,5 @@
-/*
-    Copyright (C) 2001-2006 Paul Davis
+ /*
+    Copyright (C) 2001-2009 Paul Davis
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 */
-#include <pango/pangoft2.h> // for fontmap resolution control for GnomeCanvas
-#include <pango/pangocairo.h> // for fontmap resolution control for GnomeCanvas
 
-#include "pbd/whitespace.h"
-
-#include "ardour/ardour.h"
-#include "ardour/session.h"
-#include "ardour/audioengine.h"
+#include <gtkmm/box.h>
+#include <gtkmm/alignment.h>
 #include "ardour/configuration.h"
-#include "ardour/auditioner.h"
-#include "ardour/sndfilesource.h"
-#include "ardour/crossfade.h"
-#include "ardour/profile.h"
-#include "midi++/manager.h"
-#include "midi++/factory.h"
-#include <gtkmm2ext/stop_signal.h>
-#include <gtkmm2ext/utils.h>
-#include <gtkmm2ext/window_title.h>
-
-#include "public_editor.h"
-#include "keyboard.h"
-#include "mixer_ui.h"
-#include "ardour_ui.h"
-#include "io_selector.h"
-#include "gain_meter.h"
-#include "sfdb_ui.h"
-#include "utils.h"
-#include "editing.h"
 #include "option_editor.h"
-#include "midi_port_dialog.h"
 #include "gui_thread.h"
-#include "utils.h"
-
 #include "i18n.h"
 
-using namespace ARDOUR;
-using namespace PBD;
-using namespace Gtk;
-using namespace Editing;
-using namespace Gtkmm2ext;
 using namespace std;
-
-static vector<string> positional_sync_strings;
-
-OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
-       : ArdourDialog ("options editor", false),
-         ui (uip),
-         editor (ed),
-         mixer (mixui),
-
-         /* Paths */
-         path_table (11, 2),
-
-         /* misc */
-
-         short_xfade_adjustment (0, 1.0, 500.0, 5.0, 100.0),
-         short_xfade_slider (short_xfade_adjustment),
-         destructo_xfade_adjustment (1.0, 1.0, 500.0, 1.0, 100.0),
-         destructo_xfade_slider (destructo_xfade_adjustment),
-         history_depth (20, -1, 100, 1.0, 10.0),
-         saved_history_depth (20, 0, 100, 1.0, 10.0),
-         history_depth_spinner (history_depth),
-         saved_history_depth_spinner (saved_history_depth),
-         limit_history_button (_("Limit undo history")),
-         save_history_button (_("Save undo history")),
-
-         /* Sync */
-
-         smpte_offset_clock (X_("smpteoffset"), false, X_("SMPTEOffsetClock"), true, true),
-         smpte_offset_negative_button (_("SMPTE offset is negative")),
-         synced_timecode_button (_("Timecode source is sample-clock synced")),
-
-         /* MIDI */
-
-         midi_port_table (4, 12),
-         mmc_receive_device_id_adjustment (0.0, 0.0, (double) 0x7f, 1.0, 16.0),
-         mmc_receive_device_id_spinner (mmc_receive_device_id_adjustment),
-         mmc_send_device_id_adjustment (0.0, 0.0, (double) 0x7f, 1.0, 16.0),
-         mmc_send_device_id_spinner (mmc_send_device_id_adjustment),
-         add_midi_port_button (_("Add new MIDI port")),
-         initial_program_change_adjustment (0.0, -1.0, (double) 0x7f, 1.0, 16.0),
-         initial_program_change_spinner (initial_program_change_adjustment),
-
-         /* Click */
-
-         click_table (2, 3),
-         click_browse_button (_("Browse")),
-         click_emphasis_browse_button (_("Browse")),
-
-         /* kbd/mouse */
-
-         keyboard_mouse_table (4, 4),
-         delete_button_adjustment (3, 1, 5),
-         delete_button_spin (delete_button_adjustment),
-         edit_button_adjustment (3, 1, 5),
-         edit_button_spin (edit_button_adjustment)
-
-{
-       using namespace Notebook_Helpers;
-
-       first_click_setup = true;
-       click_io_selector = 0;
-       auditioner_io_selector = 0;
-       session = 0;
-
-       WindowTitle title(Glib::get_application_name());
-       title += _("Preferences");
-       set_title(title.get_string());
-
-       set_default_size (300, 300);
-       set_wmclass (X_("ardour_preferences"), "Ardour");
-
-       set_name ("Preferences");
-       add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
-
-       VBox *vbox = get_vbox();
-       set_border_width (3);
-
-       vbox->set_spacing (4);
-       vbox->pack_start(notebook);
-
-       signal_delete_event().connect (mem_fun(*this, &OptionEditor::wm_close));
-
-       notebook.set_show_tabs (true);
-       notebook.set_show_border (true);
-       notebook.set_name ("OptionsNotebook");
-
-       setup_sync_options();
-       setup_path_options();
-       setup_misc_options ();
-       setup_keyboard_options ();
-       setup_auditioner_editor ();
-
-       if (!Profile->get_sae()) {
-               notebook.pages().push_back (TabElem (sync_packer, _("Sync")));
-               notebook.pages().push_back (TabElem (path_table, _("Paths/Files")));
-               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 (misc_packer, _("Misc")));
-
-       setup_midi_options ();
-       notebook.pages().push_back (TabElem (midi_packer, _("MIDI")));
-
-       set_session (0);
-       show_all_children();
-
-       Config->map_parameters (mem_fun (*this, &OptionEditor::parameter_changed));
-       Config->ParameterChanged.connect (mem_fun (*this, &OptionEditor::parameter_changed));
-}
-
-void
-OptionEditor::set_session (Session *s)
-{
-       clear_click_editor ();
-       clear_auditioner_editor ();
-
-       click_path_entry.set_text ("");
-       click_emphasis_path_entry.set_text ("");
-       session_raid_entry.set_text ("");
-
-       click_path_entry.set_sensitive (false);
-       click_emphasis_path_entry.set_sensitive (false);
-       session_raid_entry.set_sensitive (false);
-
-       short_xfade_slider.set_sensitive (false);
-       smpte_offset_negative_button.set_sensitive (false);
-
-       smpte_offset_clock.set_session (s);
-
-       if ((session = s) == 0) {
-               return;
-       }
-
-       click_path_entry.set_sensitive (true);
-       click_emphasis_path_entry.set_sensitive (true);
-       session_raid_entry.set_sensitive (true);
-       short_xfade_slider.set_sensitive (true);
-       smpte_offset_negative_button.set_sensitive (true);
-
-       smpte_offset_clock.set_session (s);
-       smpte_offset_clock.set (s->smpte_offset (), true);
-
-       smpte_offset_negative_button.set_active (session->smpte_offset_negative());
-
-       redisplay_midi_ports ();
-
-       setup_click_editor ();
-       connect_audition_editor ();
-
-       short_xfade_adjustment.set_value ((Crossfade::short_xfade_length() / (float) session->frame_rate()) * 1000.0);
-
-       add_session_paths ();
-}
-
-OptionEditor::~OptionEditor ()
-{
-}
-
-void
-OptionEditor::setup_path_options()
-{
-       Gtk::Label* label;
-
-       path_table.set_homogeneous (false);
-       path_table.set_border_width (12);
-       path_table.set_row_spacings (5);
-
-       session_raid_entry.set_name ("OptionsEntry");
-
-       session_raid_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::raid_path_changed));
-
-       label = manage (new Label (_("Session RAID path")));
-       label->set_name ("OptionsLabel");
-       path_table.attach (*label, 0, 1, 0, 1, FILL|EXPAND, FILL);
-       path_table.attach (session_raid_entry, 1, 3, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
-
-       path_table.show_all();
-}
-
-void
-OptionEditor::add_session_paths ()
-{
-       click_path_entry.set_sensitive (true);
-       click_emphasis_path_entry.set_sensitive (true);
-       session_raid_entry.set_sensitive (true);
-
-       if (Config->get_click_sound().empty()) {
-               click_path_entry.set_text (_("internal"));
-       } else {
-               click_path_entry.set_text (Config->get_click_sound());
-       }
-
-       if (Config->get_click_emphasis_sound().empty()) {
-               click_emphasis_path_entry.set_text (_("internal"));
-       } else {
-               click_emphasis_path_entry.set_text (Config->get_click_emphasis_sound());
-       }
-
-       session_raid_entry.set_text(session->raid_path());
-}
-
-static void
-font_scale_changed (Gtk::Adjustment* adj)
-{
-       Config->set_font_scale((long)floor (adj->get_value() * 1024));
-       reset_dpi();
-}
-
-void
-OptionEditor::setup_misc_options ()
-{
-       Gtk::HBox* hbox;
-       Label* label;
-
-#ifndef GTKOSX
-       /* font scaling does nothing with GDK/Quartz */
-
-       Gtk::Adjustment* dpi_adj = new Gtk::Adjustment ((double)Config->get_font_scale() / 1024, 50, 250, 1, 10);
-       Gtk::HScale * dpi_range = new Gtk::HScale (*dpi_adj);
-
-       label = manage (new Label (_("Font scaling")));
-       label->set_name ("OptionsLabel");
-
-       dpi_range->set_update_policy (Gtk::UPDATE_DISCONTINUOUS);
-       dpi_adj->signal_value_changed().connect (bind (sigc::ptr_fun (font_scale_changed), dpi_adj));
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (5);
-       hbox->set_spacing (10);
-       hbox->pack_start (*label, false, false);
-       hbox->pack_start (*dpi_range, true, true);
-       misc_packer.pack_start (*hbox, false, false);
-#endif
-
-       label = manage (new Label (_("Short crossfade length (msecs)")));
-       label->set_name ("OptionsLabel");
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (5);
-       hbox->set_spacing (10);
-       hbox->pack_start (*label, false, false);
-       hbox->pack_start (short_xfade_slider, true, true);
-       misc_packer.pack_start (*hbox, false, false);
-
-       short_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::short_xfade_adjustment_changed));
-
-       label = manage (new Label (_("Destructive crossfade length (msecs)")));
-       label->set_name ("OptionsLabel");
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (5);
-       hbox->set_spacing (10);
-       hbox->pack_start (*label, false, false);
-       hbox->pack_start (destructo_xfade_slider, true, true);
-       misc_packer.pack_start (*hbox, false, false);
-
-
-       destructo_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::destructo_xfade_adjustment_changed));
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (5);
-       hbox->set_spacing (10);
-       hbox->pack_start (limit_history_button, false, false);
-       misc_packer.pack_start (*hbox, false, false);
-
-       label = manage (new Label (_("History depth (commands)")));
-       label->set_name ("OptionsLabel");
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (5);
-       hbox->set_spacing (10);
-       hbox->pack_start (*label, false, false);
-       hbox->pack_start (history_depth_spinner, false, false);
-       misc_packer.pack_start (*hbox, false, false);
-
-       history_depth.signal_value_changed().connect (mem_fun (*this, &OptionEditor::history_depth_changed));
-       saved_history_depth.signal_value_changed().connect (mem_fun (*this, &OptionEditor::saved_history_depth_changed));
-       save_history_button.signal_toggled().connect (mem_fun (*this, &OptionEditor::save_history_toggled));
-       limit_history_button.signal_toggled().connect (mem_fun (*this, &OptionEditor::limit_history_toggled));
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (5);
-       hbox->set_spacing (10);
-       hbox->pack_start (save_history_button, false, false);
-       misc_packer.pack_start (*hbox, false, false);
-
-       label = manage (new Label (_("Saved history depth (commands)")));
-       label->set_name ("OptionsLabel");
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (5);
-       hbox->set_spacing (10);
-       hbox->pack_start (*label, false, false);
-       hbox->pack_start (saved_history_depth_spinner, false, false);
-       misc_packer.pack_start (*hbox, false, false);
-
-       short_xfade_slider.set_update_policy (UPDATE_DISCONTINUOUS);
-       destructo_xfade_slider.set_update_policy (UPDATE_DISCONTINUOUS);
-
-       destructo_xfade_adjustment.set_value (Config->get_destructive_xfade_msecs());
-
-       misc_packer.show_all ();
-}
-
-void
-OptionEditor::limit_history_toggled ()
-{
-       bool x = limit_history_button.get_active();
-
-       if (!x) {
-               Config->set_history_depth (0);
-               history_depth_spinner.set_sensitive (false);
-       } else {
-               if (Config->get_history_depth() == 0) {
-                       /* get back to a sane default */
-                       Config->set_history_depth (20);
-               }
-               history_depth_spinner.set_sensitive (true);
-       }
-}
-
-void
-OptionEditor::save_history_toggled ()
-{
-       bool x = save_history_button.get_active();
-
-       if (x != Config->get_save_history()) {
-               Config->set_save_history (x);
-               saved_history_depth_spinner.set_sensitive (x);
-       }
-}
-
-void
-OptionEditor::history_depth_changed()
-{
-       Config->set_history_depth ((int32_t) floor (history_depth.get_value()));
-}
-
-void
-OptionEditor::saved_history_depth_changed()
-{
-       Config->set_saved_history_depth ((int32_t) floor (saved_history_depth.get_value()));
-}
-
-void
-OptionEditor::short_xfade_adjustment_changed ()
-{
-       if (session) {
-               float val = short_xfade_adjustment.get_value();
-
-               /* val is in msecs */
-
-               Crossfade::set_short_xfade_length ((nframes_t) floor (session->frame_rate() * (val / 1000.0)));
-       }
-}
-
-void
-OptionEditor::destructo_xfade_adjustment_changed ()
-{
-       float val = destructo_xfade_adjustment.get_value();
-
-       /* val is in msecs */
-
-
-       Config->set_destructive_xfade_msecs ((uint32_t) floor (val));
-
-       if (session) {
-               SndFileSource::setup_standard_crossfades (session->frame_rate());
-       }
-}
-
-void
-OptionEditor::setup_sync_options ()
-{
-       HBox* hbox;
-       vector<string> dumb;
-
-       smpte_offset_clock.set_mode (AudioClock::SMPTE);
-       smpte_offset_clock.ValueChanged.connect (mem_fun(*this, &OptionEditor::smpte_offset_chosen));
-
-       smpte_offset_negative_button.set_name ("OptionEditorToggleButton");
-
-       smpte_offset_negative_button.unset_flags (Gtk::CAN_FOCUS);
-
-       Label *smpte_offset_label = manage (new Label (_("SMPTE Offset")));
-       smpte_offset_label->set_name("OptionsLabel");
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (5);
-       hbox->set_spacing (10);
-       hbox->pack_start (*smpte_offset_label, false, false);
-       hbox->pack_start (smpte_offset_clock, false, false);
-       hbox->pack_start (smpte_offset_negative_button, false, false);
-
-       sync_packer.pack_start (*hbox, false, false);
-       sync_packer.pack_start (synced_timecode_button, false, false);
-
-       smpte_offset_negative_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::smpte_offset_negative_clicked));
-       synced_timecode_button.signal_toggled().connect (mem_fun(*this, &OptionEditor::synced_timecode_toggled));
-}
-
-void
-OptionEditor::smpte_offset_negative_clicked ()
-{
-       if (session) {
-               session->set_smpte_offset_negative (smpte_offset_negative_button.get_active());
-       }
-}
-
-void
-OptionEditor::synced_timecode_toggled ()
-{
-       bool x;
-
-       if ((x = synced_timecode_button.get_active()) != Config->get_timecode_source_is_synced()) {
-               Config->set_timecode_source_is_synced (x);
-               Config->save_state();
-       }
-}
-
-void
-OptionEditor::smpte_offset_chosen()
-{
-       if (session) {
-               nframes_t frames = smpte_offset_clock.current_duration();
-               session->set_smpte_offset (frames);
-       }
-}
-
-
-void
-OptionEditor::setup_midi_options ()
-{
-       HBox* hbox;
-       Label* label;
-
-       midi_port_table.set_row_spacings (6);
-       midi_port_table.set_col_spacings (10);
-
-       redisplay_midi_ports ();
-
-       mmc_receive_device_id_adjustment.set_value (Config->get_mmc_receive_device_id());
-       mmc_send_device_id_adjustment.set_value (Config->get_mmc_send_device_id());
-
-       mmc_receive_device_id_adjustment.signal_value_changed().connect (mem_fun (*this, &OptionEditor::mmc_receive_device_id_adjusted));
-       mmc_send_device_id_adjustment.signal_value_changed().connect (mem_fun (*this, &OptionEditor::mmc_send_device_id_adjusted));
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (6);
-       hbox->pack_start (midi_port_table, true, false);
-
-       midi_packer.pack_start (*hbox, false, false);
-       add_midi_port_button.set_label ("Add MIDI Port");
-       midi_packer.pack_start (add_midi_port_button, false, false);
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (6);
-       hbox->set_spacing (6);
-       label = (manage (new Label (_("Inbound MMC Device ID"))));
-       hbox->pack_start (mmc_receive_device_id_spinner, false, false);
-       hbox->pack_start (*label, false, false);
-       midi_packer.pack_start (*hbox, false, false);
-
-       mmc_receive_device_id_spinner.set_value(Config->get_mmc_receive_device_id ());
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (6);
-       hbox->set_spacing (6);
-       label = (manage (new Label (_("Outbound MMC Device ID"))));
-       hbox->pack_start (mmc_send_device_id_spinner, false, false);
-       hbox->pack_start (*label, false, false);
-       midi_packer.pack_start (*hbox, false, false);
-
-       mmc_send_device_id_spinner.set_value(Config->get_mmc_send_device_id ());
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (6);
-       hbox->set_spacing (6);
-       label = (manage (new Label (_("Startup program change")))); 
-       hbox->pack_start (initial_program_change_spinner, false, false);
-       hbox->pack_start (*label, false, false);
-       midi_packer.pack_start (*hbox, false, false);
-       
-       initial_program_change_spinner.set_value (Config->get_initial_program_change());
-       initial_program_change_adjustment.signal_value_changed().connect (mem_fun (*this, &OptionEditor::initial_program_change_adjusted));
-
-       add_midi_port_button.signal_clicked().connect (mem_fun (*this, &OptionEditor::add_midi_port));
-}
-
-void
-OptionEditor::initial_program_change_adjusted ()
-{
-       Config->set_initial_program_change (((int32_t) floor (initial_program_change_adjustment.get_value())) & 0x7f);
-}
-
-void
-OptionEditor::redisplay_midi_ports ()
-{
-       MIDI::Manager::PortMap::const_iterator i;
-       const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
-       int n;
-
-       /* remove all existing widgets */
-
-       // XXX broken in gtkmm 2.10
-       // midi_port_table.clear ();
-
-       for (vector<Widget*>::iterator w = midi_port_table_widgets.begin(); w != midi_port_table_widgets.end(); ++w) {
-               midi_port_table.remove (**w);
-       }
-
-       midi_port_table_widgets.clear ();
-
-       midi_port_table.resize (ports.size() + 4, 12);
-
-       Gtk::Label* label;
-
-       label = (manage (new Label (_("Port"))));
-       label->show ();
-       midi_port_table_widgets.push_back (label);
-       midi_port_table.attach (*label, 0, 1, 0, 1);
-       label = (manage (new Label (_("Offline"))));
-       label->show ();
-       midi_port_table_widgets.push_back (label);
-       midi_port_table.attach (*label, 1, 2, 0, 1);
-       label = (manage (new Label (_("Trace\ninput"))));
-       label->show ();
-       midi_port_table_widgets.push_back (label);
-       midi_port_table.attach (*label, 2, 3, 0, 1);
-       label = (manage (new Label (_("Trace\noutput"))));
-       label->show ();
-       midi_port_table_widgets.push_back (label);
-       midi_port_table.attach (*label, 3, 4, 0, 1);
-       label = (manage (new Label (_("MTC"))));
-       label->show ();
-       midi_port_table_widgets.push_back (label);
-       midi_port_table.attach (*label, 4, 5, 0, 1);
-       label = (manage (new Label (_("MIDI\nclock"))));
-       label->show ();
-       midi_port_table_widgets.push_back (label);
-       midi_port_table.attach (*label, 6, 7, 0, 1);
-       label = (manage (new Label (_("MMC"))));
-       label->show ();
-       midi_port_table_widgets.push_back (label);
-       midi_port_table.attach (*label, 8, 9, 0, 1);
-       label = (manage (new Label (_("MIDI parameter\ncontrol"))));
-       label->show ();
-       midi_port_table_widgets.push_back (label);
-       midi_port_table.attach (*label, 10, 11, 0, 1);
-
-       Gtk::HSeparator* hsep = (manage (new HSeparator()));
-       hsep->show ();
-       midi_port_table_widgets.push_back (hsep);
-       midi_port_table.attach (*hsep, 0, 11, 1, 2);
-       Gtk::VSeparator* vsep = (manage (new VSeparator()));
-       vsep->show ();
-       midi_port_table_widgets.push_back (vsep);
-       midi_port_table.attach (*vsep, 5, 6, 0, 8);
-       vsep = (manage (new VSeparator()));
-       vsep->show ();
-       midi_port_table_widgets.push_back (vsep);
-       midi_port_table.attach (*vsep, 7, 8, 0, 8);
-       vsep = (manage (new VSeparator()));
-       vsep->show ();
-       midi_port_table_widgets.push_back (vsep);
-       midi_port_table.attach (*vsep, 9, 10, 0, 8);
-
-       for (n = 0, i = ports.begin(); i != ports.end(); ++n, ++i) {
-
-               ToggleButton* tb;
-               RadioButton* rb;
-               Button* bb;
-
-               /* the remove button. create early so we can pass it to various callbacks */
-
-               bb = manage (new Button (Stock::REMOVE));
-               bb->set_name ("OptionEditorToggleButton");
-               bb->show ();
-               midi_port_table_widgets.push_back (bb);
-               midi_port_table.attach (*bb, 11, 12, n+2, n+3, FILL|EXPAND, FILL);
-               bb->signal_clicked().connect (bind (mem_fun(*this, &OptionEditor::remove_midi_port), i->second));
-               bb->set_sensitive (port_removable (i->second));
-
-               label = (manage (new Label (i->first)));
-               label->show ();
-               midi_port_table_widgets.push_back (label);
-               midi_port_table.attach (*label, 0, 1, n+2, n+3,FILL|EXPAND, FILL );
-
-               tb = manage (new ToggleButton (_("online")));
-               tb->set_name ("OptionEditorToggleButton");
-
-               /* remember, we have to handle the i18n case where the relative
-                  lengths of the strings in language N is different than in english.
-               */
-
-               if (strlen (_("offline")) > strlen (_("online"))) {
-                       set_size_request_to_display_given_text (*tb, _("offline"), 15, 12);
-               } else {
-                       set_size_request_to_display_given_text (*tb, _("online"), 15, 12);
-               }
-
-               if (i->second->input()) {
-                       tb->set_active (!i->second->input()->offline());
-                       tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_online_toggled), i->second, tb));
-                       i->second->input()->OfflineStatusChanged.connect (bind (mem_fun(*this, &OptionEditor::map_port_online), (*i).second, tb));
-               }
-               tb->show ();
-               midi_port_table_widgets.push_back (tb);
-               midi_port_table.attach (*tb, 1, 2, n+2, n+3, FILL|EXPAND, FILL);
-
-               // Trace MIDI Input
-               tb = manage (new ToggleButton ());
-               tb->set_name ("OptionEditorToggleButton");
-               tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb));
-               tb->set_size_request (10, 10);
-               tb->show ();
-               midi_port_table_widgets.push_back (tb);
-               midi_port_table.attach (*tb, 2, 3, n+2, n+3, FILL|EXPAND, FILL);
-
-               // Trace MIDI Output
-               tb = manage (new ToggleButton ());
-               tb->set_name ("OptionEditorToggleButton");
-               tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb));
-               tb->set_size_request (10, 10);
-               tb->show ();
-               midi_port_table_widgets.push_back (tb);
-               midi_port_table.attach (*tb, 3, 4, n+2, n+3, FILL|EXPAND, FILL);
-
-               // MTC Radio Button
-               rb = manage (new RadioButton ());
-               rb->set_name ("OptionEditorToggleButton");
-               if (n == 0) {
-                       mtc_button_group = rb->get_group();
-               } else {
-                       rb->set_group (mtc_button_group);
-               }
-               rb->show ();
-               midi_port_table_widgets.push_back (rb);
-               midi_port_table.attach (*rb, 4, 5, n+2, n+3, FILL|EXPAND, FILL);
-               rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::mtc_port_chosen), (*i).second, rb, bb));
-
-               if (session && i->second == session->mtc_port()) {
-                       rb->set_active (true);
-               }
-
-               // MIDI Clock Radio Button
-               rb = manage (new RadioButton ());
-               rb->set_name ("OptionEditorToggleButton");
-               if (n == 0) {
-                       midi_clock_button_group = rb->get_group();
-               } else {
-                       rb->set_group (midi_clock_button_group);
-               }
-               rb->show ();
-               midi_port_table_widgets.push_back (rb);
-               midi_port_table.attach (*rb, 6, 7, n+2, n+3, FILL|EXPAND, FILL);
-               rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::midi_clock_port_chosen), (*i).second, rb, bb));
-
-               if (session && i->second == session->midi_clock_port()) {
-                       rb->set_active (true);
-               }
-
-               rb = manage (new RadioButton ());
-               rb->set_name ("OptionEditorToggleButton");
-               if (n == 0) {
-                       mmc_button_group = rb->get_group();
-               } else {
-                       rb->set_group (mmc_button_group);
-               }
-               rb->show ();
-               midi_port_table_widgets.push_back (rb);
-               midi_port_table.attach (*rb, 8, 9, n+2, n+3, FILL|EXPAND, FILL);
-               rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::mmc_port_chosen), (*i).second, rb, bb));
-
-               if (session && i->second == session->mmc_port()) {
-                       rb->set_active (true);
-               }
-
-               rb = manage (new RadioButton ());
-               rb->set_name ("OptionEditorToggleButton");
-               if (n == 0) {
-                       midi_button_group = rb->get_group();
-               } else {
-                       rb->set_group (midi_button_group);
-               }
-               rb->show ();
-               midi_port_table_widgets.push_back (rb);
-               midi_port_table.attach (*rb, 10, 11, n+2, n+3, FILL|EXPAND, FILL);
-               rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::midi_port_chosen), (*i).second, rb, bb));
-
-               if (session && i->second == session->midi_port()) {
-                       rb->set_active (true);
-               }
-
-       }
-
-       midi_port_table.show();
-}
-
-void
-OptionEditor::remove_midi_port (MIDI::Port* port)
-{
-       MIDI::Manager::instance()->remove_port (port);
-       redisplay_midi_ports ();
-}
-
-void
-OptionEditor::add_midi_port ()
-{
-       MidiPortDialog dialog;
-
-       dialog.set_position (WIN_POS_MOUSE);
-       dialog.set_transient_for (*this);
-
-       dialog.show ();
-
-       int ret = dialog.run ();
-
-       switch (ret) {
-       case RESPONSE_ACCEPT:
-               break;
-       default:
-               return;
-               break;
-       }
-
-       Glib::ustring mode = dialog.port_mode_combo.get_active_text();
-       std::string smod;
-
-       if (mode == _("input")) {
-               smod = X_("input");
-       } else if (mode == (_("output"))) {
-               smod = X_("output");
-       } else {
-               smod = "duplex";
-       }
-
-
-       XMLNode node (X_("MIDI-port"));
-
-       node.add_property ("tag", dialog.port_name.get_text());
-       node.add_property ("device", X_("ardour")); // XXX this can't be right for all types
-       node.add_property ("type", MIDI::PortFactory::default_port_type());
-       node.add_property ("mode", smod);
-
-       if (MIDI::Manager::instance()->add_port (node) != 0) {
-               redisplay_midi_ports ();
-       }
-}
-
-bool
-OptionEditor::port_removable (MIDI::Port *port)
-{
-       if (!session) {
-               return true;
-       }
-
-       if (port == session->mtc_port() ||
-           port == session->mmc_port() ||
-           port == session->midi_port()) {
-               return false;
-       }
-       return true;
-}
-
-void
-OptionEditor::mtc_port_chosen (MIDI::Port *port, Gtk::RadioButton* rb, Gtk::Button* bb)
-{
-       if (session) {
-               if (rb->get_active()) {
-                       session->set_mtc_port (port->name());
-                       Config->set_mtc_port_name (port->name());
-               } else {
-                       session->set_mtc_port ("");
-               }
-               bb->set_sensitive (port_removable (port));
-       }
-}
-
-void
-OptionEditor::mmc_port_chosen (MIDI::Port* port, Gtk::RadioButton* rb, Gtk::Button* bb)
-{
-       if (session) {
-               if (rb->get_active()) {
-                       session->set_mmc_port (port->name());
-                       Config->set_mtc_port_name (port->name());
-               } else {
-                       session->set_mmc_port ("");
-               }
-               bb->set_sensitive (port_removable (port));
-       }
-}
-
-void
-OptionEditor::midi_port_chosen (MIDI::Port* port, Gtk::RadioButton* rb, Gtk::Button* bb)
-{
-       if (session) {
-               if (rb->get_active()) {
-                       session->set_midi_port (port->name());
-                       Config->set_midi_port_name (port->name());
-               } else {
-                       session->set_midi_port ("");
-               }
-               bb->set_sensitive (port_removable (port));
-       }
-}
-
-void
-OptionEditor::midi_clock_port_chosen (MIDI::Port *port, Gtk::RadioButton* rb, Gtk::Button* bb)
-{
-       if (session) {
-               if (rb->get_active()) {
-                       session->set_midi_clock_port (port->name());
-                       Config->set_midi_clock_port_name (port->name());
-               } else {
-                       session->set_midi_clock_port ("");
-               }
-               bb->set_sensitive (port_removable (port));
-       }
-}
-
-void
-OptionEditor::port_online_toggled (MIDI::Port* port, ToggleButton* tb)
-{
-       bool wanted = tb->get_active();
-
-       if (port->input()) {
-               if (wanted != port->input()->offline()) {
-                       port->input()->set_offline (wanted);
-               }
-       }
-}
-
-void
-OptionEditor::map_port_online (MIDI::Port* port, ToggleButton* tb)
-{
-       bool bstate = tb->get_active ();
-
-       if (port->input()) {
-               if (bstate != port->input()->offline()) {
-                       if (port->input()->offline()) {
-                               tb->set_label (_("offline"));
-                               tb->set_active (false);
-                       } else {
-                               tb->set_label (_("online"));
-                               tb->set_active (true);
-                       }
-               }
-       }
-}
-
-void
-OptionEditor::mmc_receive_device_id_adjusted ()
-{
-       uint8_t id = (uint8_t) mmc_receive_device_id_spinner.get_value();
-       Config->set_mmc_receive_device_id (id);
-}
-
-void
-OptionEditor::mmc_send_device_id_adjusted ()
-{
-       uint8_t id = (uint8_t) mmc_send_device_id_spinner.get_value();
-       Config->set_mmc_send_device_id (id);
-}
-
-void
-OptionEditor::port_trace_in_toggled (MIDI::Port* port, ToggleButton* tb)
-{
-       bool trace = tb->get_active();
-
-       if (port->input()) {
-               if (port->input()->tracing() != trace) {
-                       port->input()->trace (trace, &cerr, string (port->name()) + string (" input: "));
-               }
-       }
-}
-
-void
-OptionEditor::port_trace_out_toggled (MIDI::Port* port, ToggleButton* tb)
-{
-       bool trace = tb->get_active();
-
-       if (port->output()) {
-               if (port->output()->tracing() != trace) {
-                       port->output()->trace (trace, &cerr, string (port->name()) + string (" output: "));
-               }
-       }
-}
-
-void
-OptionEditor::save ()
-{
-       /* XXX a bit odd that we save the entire session state here */
-
-       ui.save_state ("");
-}
-
-gint
-OptionEditor::wm_close (GdkEventAny *ev)
-{
-       save ();
-       hide ();
-       return TRUE;
-}
-
-void
-OptionEditor::raid_path_changed ()
-{
-       if (session) {
-               Config->set_raid_path (session_raid_entry.get_text());
-       }
-}
-
-void
-OptionEditor::click_browse_clicked ()
-{
-       SoundFileChooser sfdb (*this, _("Choose Click"), session);
-
-       sfdb.show_all ();
-       sfdb.present ();
-
-       int result = sfdb.run ();
-
-       if (result == Gtk::RESPONSE_OK) {
-               click_chosen(sfdb.get_filename());
-       }
-}
+using namespace sigc;
+using namespace Gtk;
+using namespace ARDOUR;
 
 void
-OptionEditor::click_chosen (const string & path)
+OptionEditorComponent::add_widget_to_page (OptionEditorPage* p, Gtk::Widget* w)
 {
-       click_path_entry.set_text (path);
-       click_sound_changed ();
+       int const n = p->table.property_n_rows();
+       p->table.resize (n + 1, 3);
+       p->table.attach (*w, 1, 3, n, n + 1, FILL | EXPAND);
 }
 
 void
-OptionEditor::click_emphasis_browse_clicked ()
+OptionEditorComponent::add_widgets_to_page (OptionEditorPage* p, Gtk::Widget* wa, Gtk::Widget* wb)
 {
-       SoundFileChooser sfdb (*this, _("Choose Click Emphasis"), session);
-
-       sfdb.show_all ();
-       sfdb.present ();
-
-       int result = sfdb.run ();
-
-       if (result == Gtk::RESPONSE_OK) {
-               click_emphasis_chosen (sfdb.get_filename());
-       }
+       int const n = p->table.property_n_rows();
+       p->table.resize (n + 1, 3);
+       p->table.attach (*wa, 1, 2, n, n + 1, FILL | EXPAND);
+       p->table.attach (*wb, 2, 3, n, n + 1, FILL | EXPAND);
 }
 
-void
-OptionEditor::click_emphasis_chosen (const string & path)
+OptionEditorHeading::OptionEditorHeading (string const & h)
 {
-       click_emphasis_path_entry.set_text (path);
-       click_emphasis_sound_changed ();
+       std::stringstream s;
+       s << "<b>" << h << "</b>";
+       _label = manage (new Label (s.str()));
+       _label->set_alignment (0, 0.5);
+       _label->set_use_markup (true);
 }
 
 void
-OptionEditor::click_sound_changed ()
+OptionEditorHeading::add_to_page (OptionEditorPage* p)
 {
-       if (session) {
-               string path = click_path_entry.get_text();
+       int const n = p->table.property_n_rows();
+       p->table.resize (n + 2, 3);
 
-               if (path == Config->get_click_sound()) {
-                       return;
-               }
-
-               strip_whitespace_edges (path);
-
-               if (path == _("internal")) {
-                       Config->set_click_sound ("");
-               } else {
-                       Config->set_click_sound (path);
-               }
-       }
+       p->table.attach (*manage (new Label ("")), 0, 3, n, n + 1, FILL | EXPAND);
+       p->table.attach (*_label, 0, 3, n + 1, n + 2, FILL | EXPAND);
 }
 
 void
-OptionEditor::click_emphasis_sound_changed ()
+OptionEditorBox::add_to_page (OptionEditorPage* p)
 {
-       if (session) {
-               string path = click_emphasis_path_entry.get_text();
-
-               if (path == Config->get_click_emphasis_sound()) {
-                       return;
-               }
-
-               strip_whitespace_edges (path);
-
-               if (path == _("internal")) {
-                       Config->set_click_emphasis_sound ("");
-               } else {
-                       Config->set_click_emphasis_sound (path);
-               }
-       }
-}
-
-void
-OptionEditor::clear_click_editor ()
-{
-       if (click_io_selector) {
-               click_hpacker.remove (*click_io_selector);
-               click_hpacker.remove (*click_gpm);
-               delete click_io_selector;
-               delete click_gpm;
-               click_io_selector = 0;
-               click_gpm = 0;
-       }
+       add_widget_to_page (p, _box);
 }
 
-void
-OptionEditor::setup_click_editor ()
+BoolOption::BoolOption (string const & i, string const & n, slot<bool> g, slot<bool, bool> s)
+       : Option (i, n),
+         _get (g),
+         _set (s)
 {
-       Label* label;
-
-       if (first_click_setup) {
-               
-               click_path_entry.set_name ("OptionsEntry");
-               click_emphasis_path_entry.set_name ("OptionsEntry");
-               
-               click_path_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::click_sound_changed));
-               click_emphasis_path_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::click_emphasis_sound_changed));
-               
-               click_path_entry.signal_focus_out_event().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::click_sound_changed));
-               click_emphasis_path_entry.signal_focus_out_event().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::click_emphasis_sound_changed));
-               
-               click_browse_button.set_name ("EditorGTKButton");
-               click_emphasis_browse_button.set_name ("EditorGTKButton");
-
-               click_browse_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::click_browse_clicked));
-               click_emphasis_browse_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::click_emphasis_browse_clicked));
-
-               click_packer.set_border_width (12);
-               click_packer.set_spacing (5);
-
-               click_table.set_col_spacings (10);
-               
-               label = manage(new Label(_("Click audio file:")));
-               label->set_name ("OptionsLabel");
-               label->set_alignment (0, 0.5);
-               click_table.attach (*label, 0, 1, 0, 1, FILL|EXPAND, FILL);
-               click_table.attach (click_path_entry, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
-               click_table.attach (click_browse_button, 2, 3, 0, 1, FILL|EXPAND, FILL);
-               
-               label = manage(new Label(_("Click emphasis audiofile:")));
-               label->set_name ("OptionsLabel");
-               label->set_alignment (0, 0.5);
-               click_table.attach (*label, 0, 1, 1, 2, FILL|EXPAND, FILL);
-               click_table.attach (click_emphasis_path_entry, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
-               click_table.attach (click_emphasis_browse_button, 2, 3, 1, 2, FILL|EXPAND, FILL);
-
-               click_packer.pack_start (click_table, false, false);
-               click_packer.pack_start (click_hpacker, false, false);
-
-               click_hpacker.set_spacing (10);
-
-               first_click_setup = false;
-       }
-
-       click_path_entry.set_sensitive (true);
-       click_emphasis_path_entry.set_sensitive (true);
-
-       click_io_selector = new IOSelector (*session, session->click_io(), true);
-       click_gpm = new GainMeter (*session);
-       click_gpm->set_io (session->click_io());
-
-       click_hpacker.pack_start (*click_io_selector, true, true);
-       click_hpacker.pack_start (*click_gpm, false, false);
-
-       click_packer.show_all ();
+       _button = manage (new CheckButton (n));
+       _button->set_active (_get ());
+       _button->signal_toggled().connect (mem_fun (*this, &BoolOption::toggled));
 }
 
 void
-OptionEditor::clear_auditioner_editor ()
+BoolOption::add_to_page (OptionEditorPage* p)
 {
-       if (auditioner_io_selector) {
-               audition_hpacker.remove (*auditioner_io_selector);
-               audition_hpacker.remove (*auditioner_gpm);
-               delete auditioner_io_selector;
-               delete auditioner_gpm;
-               auditioner_io_selector = 0;
-               auditioner_gpm = 0;
-       }
+       add_widget_to_page (p, _button);
 }
 
 void
-OptionEditor::setup_auditioner_editor ()
+BoolOption::set_state_from_config ()
 {
-       audition_packer.set_border_width (12);
-       audition_packer.set_spacing (5);
-       audition_hpacker.set_spacing (10);
-
-       audition_label.set_name ("OptionEditorAuditionerLabel");
-       audition_label.set_text (_("The auditioner is a dedicated mixer strip used\n"
-                                  "for listening to specific regions outside the context\n"
-                                  "of the overall mix. It can be connected just like any\n"
-                                  "other mixer strip."));
-
-       audition_packer.pack_start (audition_label, false, false, 10);
-       audition_packer.pack_start (audition_hpacker, false, false);
+       _button->set_active (_get ());
 }
 
 void
-OptionEditor::connect_audition_editor ()
+BoolOption::toggled ()
 {
-       auditioner_io_selector = new IOSelector (*session, session->the_auditioner(), true);
-       auditioner_gpm = new GainMeter (*session);
-       auditioner_gpm->set_io (session->the_auditioner());
-
-       audition_hpacker.pack_start (*auditioner_io_selector, true, true);
-       audition_hpacker.pack_start (*auditioner_gpm, false, false);
-
-       auditioner_io_selector->show_all ();
-       auditioner_gpm->show_all ();
+       _set (_button->get_active ());
 }
 
-bool
-OptionEditor::focus_out_event_handler (GdkEventFocus* ev, void (OptionEditor::*pmf)())
+OptionEditorPage::OptionEditorPage (Gtk::Notebook& n, std::string const & t)
+       : table (1, 3)
 {
-       (this->*pmf)();
-       return false;
+       table.set_spacings (4);
+       table.set_col_spacing (0, 32);
+       box.pack_start (table, false, false);
+       box.set_border_width (4);
+       n.append_page (box, t);
 }
 
-static const struct {
-    const char *name;
-    guint   modifier;
-} modifiers[] = {
-
-#ifdef GTKOSX
-
-       /* Command = Meta
-          Option/Alt = Mod1
-       */
-
-       { "Shift", GDK_SHIFT_MASK },
-       { "Command", GDK_META_MASK },
-       { "Control", GDK_CONTROL_MASK },
-       { "Option", GDK_MOD1_MASK },
-       { "Command-Shift", GDK_MOD1_MASK|GDK_SHIFT_MASK },
-       { "Command-Option", GDK_MOD1_MASK|GDK_MOD5_MASK },
-       { "Shift-Option", GDK_SHIFT_MASK|GDK_MOD5_MASK },
-       { "Shift-Command-Option", GDK_MOD5_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK },
-
-#else
-       { "Shift", GDK_SHIFT_MASK },
-       { "Control", GDK_CONTROL_MASK },
-       { "Alt (Mod1)", GDK_MOD1_MASK },
-       { "Control-Shift", GDK_CONTROL_MASK|GDK_SHIFT_MASK },
-       { "Control-Alt", GDK_CONTROL_MASK|GDK_MOD1_MASK },
-       { "Shift-Alt", GDK_SHIFT_MASK|GDK_MOD1_MASK },
-       { "Control-Shift-Alt", GDK_CONTROL_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK },
-       { "Mod2", GDK_MOD2_MASK },
-       { "Mod3", GDK_MOD3_MASK },
-       { "Mod4", GDK_MOD4_MASK },
-       { "Mod5", GDK_MOD5_MASK },
-#endif
-       { 0, 0 }
-};
-
-void
-OptionEditor::setup_keyboard_options ()
+/** Construct an OptionEditor.
+ *  @param o Configuration to edit.
+ *  @param t Title for the dialog.
+ */
+OptionEditor::OptionEditor (Configuration* c, std::string const & t)
+       : ArdourDialog (t, false), _config (c)
 {
-       vector<string> dumb;
-       Label* label;
-
-       keyboard_mouse_table.set_border_width (12);
-       keyboard_mouse_table.set_row_spacings (5);
-       keyboard_mouse_table.set_col_spacings (5);
-
-       /* internationalize and prepare for use with combos */
-
-       for (int i = 0; modifiers[i].name; ++i) {
-               dumb.push_back (_(modifiers[i].name));
-       }
-
-       set_popdown_strings (edit_modifier_combo, dumb);
-       edit_modifier_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::edit_modifier_chosen));
-
-       for (int x = 0; modifiers[x].name; ++x) {
-               if (modifiers[x].modifier == Keyboard::edit_modifier ()) {
-                       edit_modifier_combo.set_active_text (_(modifiers[x].name));
-                       break;
-               }
-       }
-
-       label = manage (new Label (_("Edit using:")));
-       label->set_name ("OptionsLabel");
-       label->set_alignment (1.0, 0.5);
-
-       keyboard_mouse_table.attach (*label, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
-       keyboard_mouse_table.attach (edit_modifier_combo, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
-
-       label = manage (new Label (_("+ button")));
-       label->set_name ("OptionsLabel");
-
-       keyboard_mouse_table.attach (*label, 3, 4, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
-       keyboard_mouse_table.attach (edit_button_spin, 4, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
-
-       edit_button_spin.set_name ("OptionsEntry");
-       edit_button_adjustment.set_value (Keyboard::edit_button());
-       edit_button_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::edit_button_changed));
-
-       set_popdown_strings (delete_modifier_combo, dumb);
-       delete_modifier_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::delete_modifier_chosen));
-
-       for (int x = 0; modifiers[x].name; ++x) {
-               if (modifiers[x].modifier == Keyboard::delete_modifier ()) {
-                       delete_modifier_combo.set_active_text (_(modifiers[x].name));
-                       break;
-               }
-       }
-
-       label = manage (new Label (_("Delete using:")));
-       label->set_name ("OptionsLabel");
-       label->set_alignment (1.0, 0.5);
-
-       keyboard_mouse_table.attach (*label, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
-       keyboard_mouse_table.attach (delete_modifier_combo, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
-
-       label = manage (new Label (_("+ button")));
-       label->set_name ("OptionsLabel");
-
-       keyboard_mouse_table.attach (*label, 3, 4, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
-       keyboard_mouse_table.attach (delete_button_spin, 4, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
-
-       delete_button_spin.set_name ("OptionsEntry");
-       delete_button_adjustment.set_value (Keyboard::delete_button());
-       delete_button_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::delete_button_changed));
-
-       set_popdown_strings (snap_modifier_combo, dumb);
-       snap_modifier_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::snap_modifier_chosen));
-
-       for (int x = 0; modifiers[x].name; ++x) {
-               if (modifiers[x].modifier == (guint) Keyboard::snap_modifier ()) {
-                       snap_modifier_combo.set_active_text (_(modifiers[x].name));
-                       break;
-               }
-       }
+       using namespace Notebook_Helpers;
 
-       label = manage (new Label (_("Ignore snap using:")));
-       label->set_name ("OptionsLabel");
-       label->set_alignment (1.0, 0.5);
+       set_default_size (300, 300);
+       set_wmclass (X_("ardour_preferences"), "Ardour");
 
-       keyboard_mouse_table.attach (*label, 0, 1, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
-       keyboard_mouse_table.attach (snap_modifier_combo, 1, 2, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
+       set_name ("Preferences");
+       add_events (Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK);
 
-       vector<string> strs;
+       set_border_width (4);
 
-       for (std::map<std::string,std::string>::iterator bf = Keyboard::binding_files.begin(); bf != Keyboard::binding_files.end(); ++bf) {
-               strs.push_back (bf->first);
-       }
+       get_vbox()->set_spacing (4);
+       get_vbox()->pack_start (_notebook);
 
-       set_popdown_strings (keyboard_layout_selector, strs);
-       keyboard_layout_selector.set_active_text (Keyboard::current_binding_name());
-       keyboard_layout_selector.signal_changed().connect (mem_fun (*this, &OptionEditor::bindings_changed));
+       _notebook.set_show_tabs (true);
+       _notebook.set_show_border (true);
+       _notebook.set_name ("OptionsNotebook");
 
-       label = manage (new Label (_("Keyboard layout:")));
-       label->set_name ("OptionsLabel");
-       label->set_alignment (1.0, 0.5);
+       show_all_children();
 
-       keyboard_mouse_table.attach (*label, 0, 1, 3, 4, Gtk::FILL|Gtk::EXPAND, FILL);
-       keyboard_mouse_table.attach (keyboard_layout_selector, 1, 2, 3, 4, Gtk::FILL|Gtk::EXPAND, FILL);
+       /* Watch out for changes to parameters */
+       _config->ParameterChanged.connect (mem_fun (*this, &OptionEditor::parameter_changed));
 }
 
-void
-OptionEditor::bindings_changed ()
-{
-       string txt;
-
-       txt = keyboard_layout_selector.get_active_text();
-
-       for (std::map<string,string>::iterator i = Keyboard::binding_files.begin(); i != Keyboard::binding_files.end(); ++i) {
-               if (txt == i->first) {
-                       if (Keyboard::load_keybindings (i->second)) {
-                               Keyboard::save_keybindings ();
-                       }
-               }
-       }
-}
-
-void
-OptionEditor::edit_modifier_chosen ()
+OptionEditor::~OptionEditor ()
 {
-       string txt;
-
-       txt = edit_modifier_combo.get_active_text();
-
-       for (int i = 0; modifiers[i].name; ++i) {
-               if (txt == _(modifiers[i].name)) {
-                       Keyboard::set_edit_modifier (modifiers[i].modifier);
-                       break;
+       for (std::map<std::string, OptionEditorPage*>::iterator i = _pages.begin(); i != _pages.end(); ++i) {
+               for (std::list<OptionEditorComponent*>::iterator j = i->second->components.begin(); j != i->second->components.end(); ++j) {
+                       delete *j;
                }
+               delete i->second;
        }
 }
 
+/** Called when a configuration parameter has been changed.
+ *  @param p Parameter name.
+ */
 void
-OptionEditor::delete_modifier_chosen ()
+OptionEditor::parameter_changed (std::string const & p)
 {
-       string txt;
-
-       txt = delete_modifier_combo.get_active_text();
+       ENSURE_GUI_THREAD (bind (mem_fun (*this, &OptionEditor::parameter_changed), p));
 
-       for (int i = 0; modifiers[i].name; ++i) {
-               if (txt == _(modifiers[i].name)) {
-                       Keyboard::set_delete_modifier (modifiers[i].modifier);
-                       break;
+       for (std::map<std::string, OptionEditorPage*>::iterator i = _pages.begin(); i != _pages.end(); ++i) {
+               for (std::list<OptionEditorComponent*>::iterator j = i->second->components.begin(); j != i->second->components.end(); ++j) {
+                       (*j)->parameter_changed (p);
                }
        }
 }
 
+/** Add a component to a given page.
+ *  @param pn Page name (will be created if it doesn't already exist)
+ *  @param o Component.
+ */
 void
-OptionEditor::snap_modifier_chosen ()
+OptionEditor::add (std::string const & pn, OptionEditorComponent* o)
 {
-       string txt;
-
-       txt = snap_modifier_combo.get_active_text();
-
-       for (int i = 0; modifiers[i].name; ++i) {
-               if (txt == _(modifiers[i].name)) {
-                       Keyboard::set_snap_modifier (modifiers[i].modifier);
-                       break;
-               }
+       if (_pages.find (pn) == _pages.end()) {
+               _pages[pn] = new OptionEditorPage (_notebook, pn);
        }
-}
-
-void
-OptionEditor::delete_button_changed ()
-{
-       Keyboard::set_delete_button ((guint) delete_button_adjustment.get_value());
-}
 
-void
-OptionEditor::edit_button_changed ()
-{
-       Keyboard::set_edit_button ((guint) edit_button_adjustment.get_value());
-}
-
-void
-OptionEditor::parameter_changed (const char* parameter_name)
-{
-       ENSURE_GUI_THREAD (bind (mem_fun (*this, &OptionEditor::parameter_changed), parameter_name));
-
-#define PARAM_IS(x) (!strcmp (parameter_name, (x)))
+       OptionEditorPage* p = _pages[pn];
+       p->components.push_back (o);
 
-       if (PARAM_IS ("timecode-source-is-synced")) {
-               synced_timecode_button.set_active (Config->get_timecode_source_is_synced());
-       } else if (PARAM_IS ("history-depth")) {
-               int32_t depth = Config->get_history_depth();
-
-               history_depth.set_value (depth);
-               history_depth_spinner.set_sensitive (depth != 0);
-               limit_history_button.set_active (depth != 0);
-
-       } else if (PARAM_IS ("saved-history-depth")) {
-
-               saved_history_depth.set_value (Config->get_saved_history_depth());
-
-       } else if (PARAM_IS ("save-history")) {
-
-               bool x = Config->get_save_history();
-
-               save_history_button.set_active (x);
-               saved_history_depth_spinner.set_sensitive (x);
-       } else if (PARAM_IS ("font-scale")) {
-               reset_dpi();
-       }
+       o->add_to_page (p);
+       o->set_state_from_config ();
 }
index 802a088e20d8834b37bd229411b6bccd956fe1b0..5b22cf4cc51fe239590c5f202cdcd286651ecfec 100644 (file)
@@ -1,8 +1,5 @@
-#ifndef __gtk_ardour_option_editor_h__
-#define __gtk_ardour_option_editor_h__
-
 /*
-    Copyright (C) 2001 Paul Davis
+    Copyright (C) 2009 Paul Davis
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 */
 
-#include <vector>
+#ifndef __gtk_ardour_option_editor_h__
+#define __gtk_ardour_option_editor_h__
 
 #include <gtkmm/notebook.h>
 #include <gtkmm/checkbutton.h>
-#include <gtkmm/table.h>
-#include <gtkmm/entry.h>
-#include <gtkmm/box.h>
-#include <gtkmm/label.h>
-#include <gtkmm/adjustment.h>
-#include <gtkmm/scale.h>
-#include <gtkmm/spinbutton.h>
-#include <gtkmm/radiobutton.h>
 #include <gtkmm/comboboxtext.h>
-
-#include "ardour/session.h"
-
+#include <gtkmm/spinbutton.h>
+#include <gtkmm/table.h>
 #include "ardour_dialog.h"
-#include "editing.h"
-#include "audio_clock.h"
-
-class ARDOUR_UI;
-class PublicEditor;
-class Mixer_UI;
-class IOSelector;
-class GainMeter;
-class PannerUI;
 
-class OptionEditor : public ArdourDialog
+/** @file option_editor.h
+ *  @brief Base class for option editing dialog boxes.
+ *
+ *  Code to provided the basis for dialogs which allow the user to edit options
+ *  from an ARDOUR::Configuration class.
+ *
+ *  The idea is that we have an OptionEditor class which is the dialog box.
+ *  This is essentially a GTK Notebook.  OptionEditorComponent objects can
+ *  then be added to the OptionEditor, and these components are arranged on
+ *  the pages of the Notebook.  There is also an OptionEditorComponent hierarchy
+ *  here, providing things like boolean and combobox option components.
+ *
+ *  It is intended that OptionEditor be subclassed to implement a particular
+ *  options dialog.
+ */
+
+namespace ARDOUR {
+       class Configuration;
+}
+
+class OptionEditorPage;
+
+/** Base class for components of an OptionEditor dialog */
+class OptionEditorComponent
 {
-  public:
-       OptionEditor (ARDOUR_UI&, PublicEditor&, Mixer_UI&);
-       ~OptionEditor ();
-
-       void set_session (ARDOUR::Session *);
-       void save ();
-
-  private:
-       ARDOUR::Session *session;
-       ARDOUR_UI& ui;
-       PublicEditor& editor;
-       Mixer_UI& mixer;
-
-       Gtk::Notebook notebook;
-
-       /* Generic */
-
-       gint wm_close (GdkEventAny *);
-       bool focus_out_event_handler (GdkEventFocus*, void (OptionEditor::*pmf)());
-       void parameter_changed (const char* name);
-
-       /* paths */
-
-       Gtk::Table      path_table;
-       Gtk::Entry      session_raid_entry;
-
-       void setup_path_options();
-       void add_session_paths ();
-       void remove_session_paths ();
-       void raid_path_changed ();
-
-       /* misc */
+public:
+       /** Called when a configuration parameter's value has changed.
+        *  @param p parameter name
+        */
+       virtual void parameter_changed (std::string const & p) = 0;
 
-       Gtk::VBox        misc_packer;
+       /** Called to instruct the object to set its UI state from the configuration */
+       virtual void set_state_from_config () = 0;
 
-       Gtk::Adjustment  short_xfade_adjustment;
-       Gtk::HScale      short_xfade_slider;
-       Gtk::Adjustment  destructo_xfade_adjustment;
-       Gtk::HScale      destructo_xfade_slider;
+       /** Called to instruct the object to add itself to an OptionEditorPage */
+       virtual void add_to_page (OptionEditorPage *) = 0;
 
-       void setup_misc_options();
-
-       void short_xfade_adjustment_changed ();
-       void destructo_xfade_adjustment_changed ();
-
-       Gtk::Adjustment history_depth;
-       Gtk::Adjustment saved_history_depth;
-       Gtk::SpinButton     history_depth_spinner;
-       Gtk::SpinButton     saved_history_depth_spinner;
-       Gtk::CheckButton    limit_history_button;
-       Gtk::CheckButton    save_history_button;
-
-       void history_depth_changed();
-       void saved_history_depth_changed();
-       void save_history_toggled ();
-       void limit_history_toggled ();
-
-       /* Sync */
-
-       Gtk::VBox sync_packer;
-
-       Gtk::ComboBoxText slave_type_combo;
-       AudioClock smpte_offset_clock;
-       Gtk::CheckButton smpte_offset_negative_button;
-       Gtk::CheckButton synced_timecode_button;
-
-       void setup_sync_options ();
-
-       void smpte_offset_chosen ();
-       void smpte_offset_negative_clicked ();
-       void synced_timecode_toggled ();
+       void add_widget_to_page (OptionEditorPage*, Gtk::Widget*);
+       void add_widgets_to_page (OptionEditorPage*, Gtk::Widget*, Gtk::Widget*);
+};
 
-       /* MIDI */
+/** A component which provides a subheading within the dialog */
+class OptionEditorHeading : public OptionEditorComponent
+{
+public:
+       OptionEditorHeading (std::string const &);
 
-       Gtk::VBox  midi_packer;
+       void parameter_changed (std::string const &) {}
+       void set_state_from_config () {}
+       void add_to_page (OptionEditorPage *);
 
-       Gtk::RadioButton::Group mtc_button_group;
-       Gtk::RadioButton::Group mmc_button_group;
-       Gtk::RadioButton::Group midi_button_group;
-       Gtk::RadioButton::Group midi_clock_button_group;
+private:
+       Gtk::Label* _label; ///< the label used for the heading
+};
 
-       Gtk::Table      midi_port_table;
-       std::vector<Gtk::Widget*> midi_port_table_widgets;
-       Gtk::Adjustment mmc_receive_device_id_adjustment;
-       Gtk::SpinButton mmc_receive_device_id_spinner;
-       Gtk::Adjustment mmc_send_device_id_adjustment;
-       Gtk::SpinButton mmc_send_device_id_spinner;
-       Gtk::Button     add_midi_port_button;
-       Gtk::Adjustment initial_program_change_adjustment;
-       Gtk::SpinButton initial_program_change_spinner;
+/** A component which provides a box into which a subclass can put arbitrary widgets */
+class OptionEditorBox : public OptionEditorComponent
+{
+public:
+
+       /** Construct an OpenEditorBox */
+       OptionEditorBox ()
+       {
+               _box = Gtk::manage (new Gtk::VBox);
+               _box->set_spacing (4);
+       }
+
+       void parameter_changed (std::string const &) = 0;
+       void set_state_from_config () = 0;
+       void add_to_page (OptionEditorPage *);
+
+protected:
+       
+       Gtk::VBox* _box; ///< constituent box for subclasses to add widgets to
+};
 
-       void add_midi_port ();
-       void remove_midi_port (MIDI::Port*);
-       void redisplay_midi_ports ();
+/** Base class for components which provide UI to change an option */
+class Option : public OptionEditorComponent {
+       
+public:
+       /** Construct an Option.
+        *  @param i Option id (e.g. "plugins-stop-with-transport")
+        *  @param n User-visible name (e.g. "Stop plugins when the transport is stopped")
+        */
+       Option (std::string const & i,
+               std::string const & n
+               )
+               : _id (i),
+                 _name (n)
+       {}
+
+       void parameter_changed (std::string const & p)
+       {
+               if (p == _id) {
+                       set_state_from_config ();
+               }
+       }
+       
+       virtual void set_state_from_config () = 0;
+       virtual void add_to_page (OptionEditorPage*) = 0;
+
+       std::string id () const {
+               return _id;
+       }
+       
+private:
+       
+       std::string _id;
+       std::string _name;
+};
 
-       void port_online_toggled (MIDI::Port*,Gtk::ToggleButton*);
-       void port_trace_in_toggled (MIDI::Port*,Gtk::ToggleButton*);
-       void port_trace_out_toggled (MIDI::Port*,Gtk::ToggleButton*);
+/** Component which provides the UI to handle a boolean option using a GTK CheckButton */
+class BoolOption : public Option {
+
+public:
+       
+       BoolOption (std::string const &, std::string const &, sigc::slot<bool>, sigc::slot<bool, bool>);
+       void set_state_from_config ();
+       void toggled ();
+       void add_to_page (OptionEditorPage*);
+       
+private:
+       
+       sigc::slot<bool> _get; ///< slot to get the configuration variable's value
+       sigc::slot<bool, bool> _set;  ///< slot to set the configuration variable's value
+       Gtk::CheckButton* _button; ///< UI button
+};
 
-       void mmc_port_chosen (MIDI::Port*,Gtk::RadioButton*, Gtk::Button*);
-       void mtc_port_chosen (MIDI::Port*,Gtk::RadioButton*, Gtk::Button*);
-       void midi_port_chosen (MIDI::Port*,Gtk::RadioButton*, Gtk::Button*);
-       void midi_clock_port_chosen (MIDI::Port*,Gtk::RadioButton*, Gtk::Button*);
-       bool port_removable (MIDI::Port*);
+/** Component which provides the UI to handle an enumerated option using a GTK CheckButton.
+ *  The template parameter is the enumeration.
+ */
+template <class T>
+class ComboOption : public Option {
+       
+public:
+
+       /** Construct an ComboOption.
+        *  @param i id
+        *  @param n User-visible name.
+        *  @param g Slot to get the variable's value.
+        *  @param s Slot to set the variable's value.
+        */
+       ComboOption (
+               std::string const & i,
+               std::string const & n,
+               sigc::slot<T> g,
+               sigc::slot<bool, T> s
+               )
+               : Option (i, n),
+                 _get (g),
+                 _set (s)
+       {
+               _label = manage (new Gtk::Label (n + ":"));
+               _label->set_alignment (1, 0.5);
+               _combo = manage (new Gtk::ComboBoxText);
+               _combo->signal_changed().connect (sigc::mem_fun (*this, &ComboOption::changed));
+       }
+
+       void set_state_from_config () {
+               uint32_t r = 0;
+               while (r < _options.size() && _get () != _options[r]) {
+                       ++r;
+               }
+               
+               if (r < _options.size()) {
+                       _combo->set_active (r);
+               }
+       }
+
+       void add_to_page (OptionEditorPage* p)
+       {
+               add_widgets_to_page (p, _label, _combo);
+       }
+
+       /** Add an allowed value for this option.
+        *  @param e Enumeration.
+        *  @param o User-visible name for this value.
+        */
+       void add (T e, std::string const & o) {
+               _options.push_back (e);
+               _combo->append_text (o);
+       }
+       
+       void changed () {
+               uint32_t const r = _combo->get_active_row_number ();
+               if (r < _options.size()) {
+                       _set (_options[r]);
+               }
+       }
+
+private:
+       
+       sigc::slot<T> _get;
+       sigc::slot<bool, T> _set;
+       Gtk::Label* _label;
+       Gtk::ComboBoxText* _combo;
+       std::vector<T> _options;
+};
 
-       void mmc_receive_device_id_adjusted ();
-       void mmc_send_device_id_adjusted ();
 
-       void initial_program_change_adjusted ();
+/** Component which provides the UI to handle an numeric option using a GTK SpinButton */
+template <class T>
+class SpinOption : public Option
+{
+public:
+       /** Construct an SpinOption.
+        *  @param i id
+        *  @param n User-visible name.
+        *  @param g Slot to get the variable's value.
+        *  @param s Slot to set the variable's value.
+        *  @param min Variable minimum value.
+        *  @param max Variable maximum value.
+        *  @param step Step for the spin button.
+        *  @param page Page step for the spin button.
+        */
+       SpinOption (
+               std::string const & i,
+               std::string const & n,
+               sigc::slot<T> g,
+               sigc::slot<bool, T> s,
+               T min,
+               T max,
+               T step,
+               T page
+               )
+               : Option (i, n),
+                 _get (g),
+                 _set (s)
+       {
+               _label = manage (new Gtk::Label (n + ":"));
+               _label->set_alignment (1, 0.5);
+               _spin = manage (new Gtk::SpinButton);
+               _spin->set_range (min, max);
+               _spin->set_increments (step, page);
+               _spin->signal_value_changed().connect (sigc::mem_fun (*this, &SpinOption::changed));
+       }
+
+       void set_state_from_config ()
+       {
+               _spin->set_value (_get ());
+       }
+
+       void add_to_page (OptionEditorPage* p)
+       {
+               add_widgets_to_page (p, _label, _spin);
+       }
+       
+       void changed ()
+       {
+               _set (static_cast<T> (_spin->get_value ()));
+       }
+       
+private:
+       sigc::slot<T> _get;
+       sigc::slot<bool, T> _set;
+       Gtk::Label* _label;
+       Gtk::SpinButton* _spin;
+};
 
-       void map_port_online (MIDI::Port*, Gtk::ToggleButton*);
+/** Class to represent a single page in an OptionEditor's notebook.
+ *  Pages are laid out using a 3-column table; the 1st column is used
+ *  to indent non-headings, and the 2nd and 3rd for actual content.
+ */
+class OptionEditorPage
+{
+public:
+       OptionEditorPage (Gtk::Notebook&, std::string const &);
 
-       void setup_midi_options();
+       Gtk::VBox box;
+       Gtk::Table table;
+       std::list<OptionEditorComponent*> components;
+};
 
-       enum PortIndex {
-               MtcIndex = 0,
-               MmcIndex = 1,
-               MidiIndex = 2,
-               MidiClockIndex = 3
-       };
+/** The OptionEditor dialog base class */
+class OptionEditor : public ArdourDialog
+{
+public:
+       OptionEditor (ARDOUR::Configuration *, std::string const &);
+       ~OptionEditor ();
 
-       std::map<MIDI::Port*,std::vector<Gtk::RadioButton*> > port_toggle_buttons;
+       void add (std::string const &, OptionEditorComponent *);
 
-       /* Click */
+protected:
+       
+       ARDOUR::Configuration* _config;
+       
+private:
+       void parameter_changed (std::string const &);
 
-       IOSelector*   click_io_selector;
-       GainMeter* click_gpm;
-       PannerUI*     click_panner;
-       bool          first_click_setup;
-       Gtk::HBox     click_hpacker;
-       Gtk::VBox     click_packer;
-       Gtk::Table    click_table;
-       Gtk::Entry    click_path_entry;
-       Gtk::Entry    click_emphasis_path_entry;
-       Gtk::Button   click_browse_button;
-       Gtk::Button   click_emphasis_browse_button;
-
-       void setup_click_editor ();
-       void clear_click_editor ();
-
-       void click_chosen (const std::string & paths);
-       void click_emphasis_chosen (const std::string & paths);
-
-       void click_browse_clicked ();
-       void click_emphasis_browse_clicked ();
-
-       void click_sound_changed ();
-       void click_emphasis_sound_changed ();
-
-       /* Auditioner */
-
-       Gtk::VBox     audition_packer;
-       Gtk::HBox     audition_hpacker;
-       Gtk::Label    audition_label;
-       IOSelector*   auditioner_io_selector;
-       GainMeter* auditioner_gpm;
-       PannerUI* auditioner_panner;
-
-       void setup_auditioner_editor ();
-       void clear_auditioner_editor ();
-       void connect_audition_editor ();
-
-       /* keyboard/mouse */
-
-       Gtk::Table keyboard_mouse_table;
-       Gtk::ComboBoxText keyboard_layout_selector;
-       Gtk::ComboBoxText edit_modifier_combo;
-       Gtk::ComboBoxText delete_modifier_combo;
-       Gtk::ComboBoxText snap_modifier_combo;
-       Gtk::Adjustment delete_button_adjustment;
-       Gtk::SpinButton delete_button_spin;
-       Gtk::Adjustment edit_button_adjustment;
-       Gtk::SpinButton edit_button_spin;
-
-       std::map<std::string,std::string> bindings_files;
-
-       void setup_keyboard_options ();
-       void delete_modifier_chosen ();
-       void edit_modifier_chosen ();
-       void snap_modifier_chosen ();
-       void edit_button_changed ();
-       void delete_button_changed ();
-       void bindings_changed ();
+       Gtk::Notebook _notebook;
+       std::map<std::string, OptionEditorPage*> _pages;
 };
 
 #endif /* __gtk_ardour_option_editor_h__ */
index 92546e5ef45186a4cc243b00f5f230d8fbac1404..28b5934c2214dd6d8133bcf6a7641f5d8c70c3f0 100644 (file)
@@ -23,6 +23,7 @@
 #include "pbd/stacktrace.h"
 
 #include "ardour/playlist.h"
+#include "ardour/rc_configuration.h"
 
 #include "region_view.h"
 #include "selection.h"
index 8ca66fb530784eba292f8dde7960f105c6841017..98dd328f55f1e1dd75fafee7dd0566de9677edff 100644 (file)
@@ -262,7 +262,8 @@ SoundFileBox::setup_labels (const ustring& filename)
                samplerate.set_name ("NewSessionSR2Label");
        }
 
-       double src_coef = (double) _session->nominal_frame_rate() / sf_info.samplerate;
+       nframes_t const nfr = _session ? _session->nominal_frame_rate() : 25;
+       double src_coef = (double) nfr / sf_info.samplerate;
 
        length_clock.set (sf_info.length * src_coef + 0.5, true);
        timecode_clock.set (sf_info.timecode * src_coef + 0.5, true);
index 52676c2d4bfe03e0cefe2a595ebc3161ce26b7be..d9d03225323f96e6878ada6f1223a28745c4f21e 100644 (file)
 #include <gtkmm/filechooserwidget.h>
 #include <gtkmm/frame.h>
 #include <gtkmm/label.h>
+#include <gtkmm/textview.h>
 
 #include "ardour/session.h"
 #include "ardour/audiofilesource.h"
 
 #include "ardour_dialog.h"
 #include "editing.h"
+#include "audio_clock.h"
 
 namespace ARDOUR {
        class Session;
index e3b7d26cd3eeca45d8da6008ac1f720a91a08bf2..da1ebd3784bec73ea597d790395493337e7e0189 100644 (file)
 
 #include "pbd/stateful.h" 
 #include "pbd/xml++.h"
+#include "ardour/configuration_variable.h"
 
 template<class T>
-class UIConfigVariable 
+class UIConfigVariable : public ARDOUR::ConfigVariableBase
 {
   public:
-       UIConfigVariable (std::string str) : _name (str) {}
-       UIConfigVariable (std::string str, T val) : _name (str), value(val) {}
-
-       std::string name() const { return _name; }
+       UIConfigVariable (std::string str) : ARDOUR::ConfigVariableBase (str) {}
+       UIConfigVariable (std::string str, T val) : ARDOUR::ConfigVariableBase (str), value (val) {}
 
        bool set (T val) {
                if (val == value) {
@@ -48,54 +47,25 @@ class UIConfigVariable
                return value;
        }
 
-       void add_to_node (XMLNode& node) {
+       std::string get_as_string () const {
                std::stringstream ss;
                ss << std::hex;
                ss.fill('0');
                ss.width(8);
                ss << value;
-               XMLNode* child = new XMLNode ("Option");
-               child->add_property ("name", _name);
-               child->add_property ("value", ss.str());
-               node.add_child_nocopy (*child);
+               return ss.str ();
        }
-       
-       bool set_from_node (const XMLNode& node) {
-
-               const XMLProperty* prop;
-               XMLNodeList nlist;
-               XMLNodeConstIterator niter;
-               XMLNode* child;
-                       
-               nlist = node.children();
-                       
-               for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
-                               
-                       child = *niter;
-                               
-                       if (child->name() == "Option") {
-                               if ((prop = child->property ("name")) != 0) {
-                                       if (prop->value() == _name) {
-                                               if ((prop = child->property ("value")) != 0) {
-                                                       std::stringstream ss;
-                                                       ss << std::hex;
-                                                       ss << prop->value();
-                                                       ss >> value;
-
-                                                       return true;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               return false;
+
+       void set_from_string (std::string const & s) {
+               std::stringstream ss;
+               ss << std::hex;
+               ss << s;
+               ss >> value;
        }
 
   protected:
        T get_for_save() { return value; }
-       std::string _name;
        T value;
-       
 };
 
 class UIConfiguration : public PBD::Stateful
index e404672a216b60783b09b06d08eb80968b335550..85e5299b5174a210797c2c32ffb2d59aee8ef4ee 100644 (file)
@@ -179,6 +179,7 @@ def build(bld):
                processor_box.cc
                prompter.cc
                public_editor.cc
+               rc_option_editor.cc
                region_gain_line.cc
                region_selection.cc
                region_view.cc
index 7358a7bddbaf837c41fe05b2a738833246071e1b..630bde675c6c784a21b5a304091fc5c95ba5e3bb 100644 (file)
@@ -29,7 +29,6 @@
 #include "pbd/error.h"
 #include "pbd/failed_constructor.h"
 
-#include "ardour/configuration.h"
 #include "ardour/types.h"
 
 // #include <jack/jack.h> need this to inline jack_get_microseconds
index be95d737fb9146e5da274a69a43e2cd412334e8d..187c97b3e6f5f8b6b8c592b3a7bc5e307c8043ed 100644 (file)
@@ -35,7 +35,6 @@
 #include "pbd/rcu.h" 
 
 #include "ardour/ardour.h"
-#include "ardour/configuration.h"
 #include "ardour/utils.h"
 #include "ardour/diskstream.h"
 #include "ardour/audioplaylist.h"
index 8dfb697d083bb9bf85bfb036157413e06107afb1..39ea96c590ea147e01b9293e701fb7ff767234ab 100644 (file)
@@ -68,7 +68,7 @@ class BroadcastInfo
        void set_time_reference (int64_t when);
        void set_origination_time (struct tm * now = 0); // if 0, use time generated at construction
        void set_originator (std::string const & str = "");
-       void set_originator_ref (std::string const & str = "");
+       void set_originator_ref (Session const &, std::string const & str = "");
        
        /* State info */
        
index e8d2685aa1f03b59a1e0311cd537cbcd7dcef2f1..68944e92e6f01d35dc18fffee638d6bf9c53e6de 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 1999 Paul Davis 
+    Copyright (C) 2009 Paul Davis 
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 #ifndef __ardour_configuration_h__
 #define __ardour_configuration_h__
 
-#include <map>
-#include <vector>
-
-#include <sys/types.h>
-#include <string>
-
-#include "pbd/stateful.h" 
-
-#include "ardour/types.h"
-#include "ardour/utils.h"
+#include "pbd/stateful.h"
 #include "ardour/configuration_variable.h"
 
 class XMLNode;
@@ -42,65 +33,15 @@ class Configuration : public PBD::Stateful
        Configuration();
        virtual ~Configuration();
 
-       std::map<std::string,XMLNode> midi_ports;
-
-       void map_parameters (sigc::slot<void,const char*> theSlot);
-
-       int load_state ();
-       int save_state ();
-
-       /// calls Stateful::*instant_xml methods using 
-       /// ARDOUR::user_config_directory for the directory argument
-       void add_instant_xml (XMLNode&);
-       XMLNode * instant_xml (const std::string& str);
-
-       int set_state (const XMLNode&);
-       XMLNode& get_state (void);
-       XMLNode& get_variables (sigc::slot<bool,ConfigVariableBase::Owner>, std::string which_node = "Config");
-       void set_variables (const XMLNode&, ConfigVariableBase::Owner owner);
-
-       void set_current_owner (ConfigVariableBase::Owner);
-
-       XMLNode* control_protocol_state () { return _control_protocol_state; }
+       virtual void map_parameters (sigc::slot<void, const char *> s) = 0;
+       virtual int set_state (XMLNode const &) = 0;
+       virtual XMLNode & get_state () = 0;
+       virtual XMLNode & get_variables () = 0;
+       virtual void set_variables (XMLNode const &) = 0;
 
        sigc::signal<void,const char*> ParameterChanged;
-
-       /* define accessor methods */
-
-#undef  CONFIG_VARIABLE
-#undef  CONFIG_VARIABLE_SPECIAL
-#define CONFIG_VARIABLE(Type,var,name,value) \
-        Type get_##var () const { return var.get(); } \
-        bool set_##var (Type val) { bool ret = var.set (val, current_owner); if (ret) { ParameterChanged (name); } return ret;  }
-#define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) \
-        Type get_##var () const { return var.get(); } \
-        bool set_##var (Type val) { bool ret = var.set (val, current_owner); if (ret) { ParameterChanged (name); } return ret; }
-#include "ardour/configuration_vars.h"
-#undef  CONFIG_VARIABLE
-#undef  CONFIG_VARIABLE_SPECIAL
-
-  private:
-
-       /* declare variables */
-
-#undef  CONFIG_VARIABLE
-#undef  CONFIG_VARIABLE_SPECIAL        
-#define CONFIG_VARIABLE(Type,var,name,value) ConfigVariable<Type> var;
-#define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) ConfigVariableWithMutation<Type> var;
-#include "ardour/configuration_vars.h"
-#undef  CONFIG_VARIABLE
-#undef  CONFIG_VARIABLE_SPECIAL        
-
-       ConfigVariableBase::Owner current_owner;
-       XMLNode* _control_protocol_state;
-
-       XMLNode& state (sigc::slot<bool,ConfigVariableBase::Owner>);
-       bool     save_config_options_predicate (ConfigVariableBase::Owner owner);
 };
 
-extern Configuration *Config;
-extern gain_t speed_quietning; /* see comment in configuration.cc */
-
 } // namespace ARDOUR
 
 #endif /* __ardour_configuration_h__ */
index 57db5250174f602eec8ee02310bcf114e352eb21..6282da2c54d4ffbc4d788e5133e574ffb2afea4f 100644 (file)
@@ -30,29 +30,23 @@ namespace ARDOUR {
 
 class ConfigVariableBase {
   public:
-       enum Owner {
-               Default = 0x1,
-               System = 0x2,
-               Config = 0x4,
-               Session = 0x8,
-               Interface = 0x10
-       };
-
-       ConfigVariableBase (std::string str) : _name (str), _owner (Default) {}
-       virtual ~ConfigVariableBase() {}
 
-       std::string name() const { return _name; }
-       Owner owner() const { return _owner; }
+       ConfigVariableBase (std::string str) : _name (str) {}
+       virtual ~ConfigVariableBase() {}
 
-       virtual void add_to_node (XMLNode& node) = 0;
-       virtual bool set_from_node (const XMLNode& node, Owner owner) = 0;
+       std::string name () const { return _name; }
+       void add_to_node (XMLNode&);
+       bool set_from_node (XMLNode const &);
+       
+       virtual std::string get_as_string () const = 0;
+       virtual void set_from_string (std::string const &) = 0;
 
        void show_stored_value (const std::string&);
-       static void set_show_stored_values (bool yn);
+       
+       static void set_show_stored_values (bool);
 
   protected:
        std::string _name;
-       Owner _owner;
        static bool show_stores;
 
        void notify ();
@@ -63,94 +57,34 @@ template<class T>
 class ConfigVariable : public ConfigVariableBase
 {
   public:
+
        ConfigVariable (std::string str) : ConfigVariableBase (str) {}
        ConfigVariable (std::string str, T val) : ConfigVariableBase (str), value (val) {}
 
-       virtual bool set (T val, Owner owner = ARDOUR::ConfigVariableBase::Config) {
+       T get() const {
+               return value;
+       }
+
+       std::string get_as_string () const {
+               std::stringstream ss;
+               ss << value;
+               return ss.str ();
+       }
+
+       virtual bool set (T val) {
                if (val == value) {
                        miss ();
                        return false;
                }
                value = val;
-               _owner = (ConfigVariableBase::Owner)(_owner |owner);
                notify ();
                return true;
        }
 
-       T get() const {
-               return value;
-       }
-
-       void add_to_node (XMLNode& node) {
+       void set_from_string (std::string const & s) {
                std::stringstream ss;
-               ss << value;
-               show_stored_value (ss.str());
-               XMLNode* child = new XMLNode ("Option");
-               child->add_property ("name", _name);
-               child->add_property ("value", ss.str());
-               node.add_child_nocopy (*child);
-       }
-       
-       bool set_from_node (const XMLNode& node, Owner owner) {
-
-               if (node.name() == "Config") {
-
-                       /* ardour.rc */
-
-                       const XMLProperty* prop;
-                       XMLNodeList nlist;
-                       XMLNodeConstIterator niter;
-                       XMLNode* child;
-                       
-                       nlist = node.children();
-                       
-                       for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
-                               
-                               child = *niter;
-                               
-                               if (child->name() == "Option") {
-                                       if ((prop = child->property ("name")) != 0) {
-                                               if (prop->value() == _name) {
-                                                       if ((prop = child->property ("value")) != 0) {
-                                                               std::stringstream ss;
-                                                               ss << prop->value();
-                                                               ss >> value;
-                                                               _owner = (ConfigVariableBase::Owner)(_owner |owner);
-                                                               return true;
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-                       
-               } else if (node.name() == "Options") {
-
-                       /* session file */
-
-                       XMLNodeList olist;
-                       XMLNodeConstIterator oiter;
-                       XMLNode* option;
-                       const XMLProperty* opt_prop;
-                       
-                       olist = node.children();
-                       
-                       for (oiter = olist.begin(); oiter != olist.end(); ++oiter) {
-                               
-                               option = *oiter;
-                               
-                               if (option->name() == _name) {
-                                       if ((opt_prop = option->property ("val")) != 0) {
-                                               std::stringstream ss;
-                                               ss << opt_prop->value();
-                                               ss >> value;
-                                               _owner = (ConfigVariableBase::Owner)(_owner |owner);
-                                               return true;
-                                       }
-                               }
-                       }
-               }
-
-               return false;
+               ss << s;
+               ss >> value;
        }
 
   protected:
@@ -165,10 +99,10 @@ class ConfigVariableWithMutation : public ConfigVariable<T>
        ConfigVariableWithMutation (std::string name, T val, T (*m)(T)) 
                : ConfigVariable<T> (name, val), mutator (m) {}
 
-       bool set (T val, ConfigVariableBase::Owner owner) {
+       bool set (T val) {
                if (unmutated_value != val) {
                        unmutated_value = val;
-                       return ConfigVariable<T>::set (mutator (val), owner);
+                       return ConfigVariable<T>::set (mutator (val));
                } 
                return false;
        }
index a78f2e23a7558763d98a5da3f618e100e1532edf..f6471e300a0abd92e40b8da54c7a076e14633d7b 100644 (file)
@@ -39,7 +39,6 @@
 #include "pbd/statefuldestructible.h" 
 
 #include "ardour/ardour.h"
-#include "ardour/configuration.h"
 #include "ardour/location.h"
 #include "ardour/session_object.h"
 #include "ardour/types.h"
index d5c2d0cdb3c52880aa3c1f8c62775c27601912bd..872ffb78e3872498e46da9fbb5b3de2a251e9645 100644 (file)
@@ -36,7 +36,6 @@
 #include "pbd/ringbufferNPT.h"
 
 #include "ardour/ardour.h"
-#include "ardour/configuration.h"
 #include "ardour/diskstream.h"
 #include "ardour/midi_playlist.h"
 #include "ardour/midi_ring_buffer.h"
index 344b79bcd1a80985e3059f25e53f5a3b6848bbac..fc879b45a382773eadefc43a319bdb415d2db8b1 100644 (file)
@@ -51,7 +51,8 @@
 
 #include "ardour/ardour.h"
 #include "ardour/chan_count.h"
-#include "ardour/configuration.h"
+#include "ardour/rc_configuration.h"
+#include "ardour/session_configuration.h"
 #include "ardour/location.h"
 #include "ardour/smpte.h"
 
@@ -388,7 +389,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        void goto_end ()   { request_locate (end_location->start(), false);}
        void goto_start () { request_locate (start_location->start(), false); }
        void set_session_start (nframes_t start) { start_location->set_start(start); }
-       void set_session_end (nframes_t end) { end_location->set_start(end); _end_location_is_free = false; }
+       void set_session_end (nframes_t end) { end_location->set_start(end); config.set_end_marker_is_free (false); }
        void use_rf_shuttle_speed ();
        void allow_auto_play (bool yn);
        void request_transport_speed (double speed);
@@ -967,6 +968,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        SessionMetadata & metadata () { return *_metadata; }
 
+       SessionConfiguration config;
+
   protected:
        friend class AudioEngine;
        void set_block_size (nframes_t nframes);
@@ -1038,7 +1041,6 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        bool                    _have_captured;
        float                   _meter_hold;
        float                   _meter_falloff;
-       bool                    _end_location_is_free;
 
        void set_worst_io_latencies ();
        void set_worst_io_latencies_x (IOChange asifwecare, void *ignored) {
@@ -1111,7 +1113,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
                if (actively_recording()) {
                        return true;
                } else {
-                       if (Config->get_auto_input()) {
+                       if (config.get_auto_input()) {
                                return false;
                        } else {
                                return true;
@@ -1173,9 +1175,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        void     auto_save();
        int      load_options (const XMLNode&);
-       XMLNode& get_options () const;
        int      load_state (std::string snapshot_name);
-       bool     save_config_options_predicate (ConfigVariableBase::Owner owner) const;
 
        nframes_t _last_roll_location;
        nframes_t _last_record_location;
index 1a6a79ceee0227a9c325b076f7198d36db4f99b4..7a05ab16b035fef53732e8913d55bc7c4f04bcbe 100644 (file)
@@ -27,7 +27,6 @@ namespace ARDOUR {
 
 class Session;
 
-
 /** An object associated with a Session.
  *
  * This is a few common things factored out of IO which weren't IO specific
index d50dbad664082d87550c00fada3b588d6e9a5795..7d04e7de259f8c6f2f6e1d8fe2b94a4c3ec54785 100644 (file)
@@ -57,7 +57,7 @@ class SndFileSource : public AudioFileSource {
 
        bool one_of_several_channels () const;
 
-       static void setup_standard_crossfades (nframes_t sample_rate);
+       static void setup_standard_crossfades (Session const &, nframes_t sample_rate);
        static const Source::Flag default_writable_flags;
 
        static int get_soundfile_info (const Glib::ustring& path, SoundFileInfo& _info, std::string& error_msg);
index 2ed5e0e36539068d29e04fe2a3a429f66ee958f3..cdec0c5fab242183cfa056b9d9ccb1616f5711d2 100644 (file)
@@ -336,6 +336,7 @@ namespace ARDOUR {
        };
 
        enum AutoConnectOption {
+               ManualConnect = 0x0,
                AutoConnectPhysical = 0x1,
                AutoConnectMaster = 0x2
        };
index eecde2e85f0bc37c80bad475955bcbab6b1f9fc3..fc5d98115fef84d8abdc04ee73d7e0ac60933119 100644 (file)
@@ -63,6 +63,20 @@ ARDOUR::SlaveSource string_to_slave_source (std::string str);
 const char* edit_mode_to_string (ARDOUR::EditMode);
 ARDOUR::EditMode string_to_edit_mode (std::string);
 
+
+/* I don't really like hard-coding these falloff rates here
+ * Probably should use a map of some kind that could be configured
+ * These rates are db/sec.
+*/
+
+#define METER_FALLOFF_OFF     0.0f
+#define METER_FALLOFF_SLOWEST 6.6f // BBC standard
+#define METER_FALLOFF_SLOW    8.6f // BBC standard
+#define METER_FALLOFF_MEDIUM  20.0f
+#define METER_FALLOFF_FAST    32.0f
+#define METER_FALLOFF_FASTER  46.0f
+#define METER_FALLOFF_FASTEST 70.0f
+
 float meter_falloff_to_float (ARDOUR::MeterFalloff);
 ARDOUR::MeterFalloff meter_falloff_from_float (float);
 float meter_falloff_to_db_per_sec (float);
index bb74d5fc1689dd0b03e8aa1f88352f23db2c6793..910239f6305e1ca59fa64cb61c8258b871281af8 100644 (file)
@@ -438,7 +438,7 @@ AudioDiskstream::check_record_status (nframes_t transport_frame, nframes_t nfram
 
                        if (_alignment_style == ExistingMaterial) {
 
-                               if (!Config->get_punch_in()) {
+                               if (!_session.config.get_punch_in()) {
 
                                        /* manual punch in happens at the correct transport frame
                                           because the user hit a button. but to get alignment correct 
@@ -467,7 +467,7 @@ AudioDiskstream::check_record_status (nframes_t transport_frame, nframes_t nfram
 
                        } else {
 
-                               if (Config->get_punch_in()) {
+                               if (_session.config.get_punch_in()) {
                                        first_recordable_frame += _roll_delay;
                                } else {
                                        capture_start_frame -= _roll_delay;
@@ -570,7 +570,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can
                (*chan)->current_playback_buffer = 0;
        }
 
-       if (nominally_recording || (_session.get_record_enabled() && Config->get_punch_in())) {
+       if (nominally_recording || (_session.get_record_enabled() && _session.config.get_punch_in())) {
                OverlapType ot;
                
                // Safeguard against situations where process() goes haywire when autopunching and last_recordable_frame < first_recordable_frame
@@ -1867,7 +1867,7 @@ AudioDiskstream::engage_record_enable ()
 
                for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
                        if ((*chan)->source) {
-                               (*chan)->source->ensure_monitor_input (!(Config->get_auto_input() && rolling));
+                               (*chan)->source->ensure_monitor_input (!(_session.config.get_auto_input() && rolling));
                        }
                        capturing_sources.push_back ((*chan)->write_source);
                        (*chan)->write_source->mark_streaming_write_started ();
@@ -1936,7 +1936,7 @@ AudioDiskstream::get_state ()
 
                Location* pi;
 
-               if (Config->get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) {
+               if (_session.config.get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) {
                        snprintf (buf, sizeof (buf), "%" PRIu32, pi->start());
                } else {
                        snprintf (buf, sizeof (buf), "%" PRIu32, _session.transport_frame());
index ef2cf281efcbfe1eda1d0485d6e08bc545edf9c7..6439c1b91776dec6f96d9ebdcaa5ef5e3eb81a89 100644 (file)
@@ -368,7 +368,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
        }
 
 
-       if (!Config->get_auto_xfade()) {
+       if (!_session.config.get_auto_xfade()) {
                return;
        }
 
@@ -450,19 +450,19 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
                                 *   [---- bottom -------------------] 
                                 */
 
-                               if (Config->get_xfade_model() == FullCrossfade) {
+                               if (_session.config.get_xfade_model() == FullCrossfade) {
                                        touched_regions = regions_touched (top->first_frame(), bottom->last_frame());
                                        if (touched_regions->size() <= 2) {
-                                               xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, Config->get_xfade_model(), Config->get_xfades_active()));
+                                               xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, _session.config.get_xfade_model(), _session.config.get_xfades_active()));
                                                add_crossfade (xfade);
                                        }
                                } else {
 
                                        touched_regions = regions_touched (top->first_frame(), 
-                                                                          top->first_frame() + min ((nframes_t)Config->get_short_xfade_seconds() * _session.frame_rate(), 
+                                                                          top->first_frame() + min ((nframes_t)_session.config.get_short_xfade_seconds() * _session.frame_rate(), 
                                                                                                     top->length()));
                                        if (touched_regions->size() <= 2) {
-                                               xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, Config->get_xfade_model(), Config->get_xfades_active()));
+                                               xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, _session.config.get_xfade_model(), _session.config.get_xfades_active()));
                                                add_crossfade (xfade);
                                        }
                                }
@@ -474,28 +474,28 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
                                 *                { ==== bottom ============ } 
                                 */ 
 
-                               if (Config->get_xfade_model() == FullCrossfade) {
+                               if (_session.config.get_xfade_model() == FullCrossfade) {
 
                                        touched_regions = regions_touched (bottom->first_frame(), top->last_frame());
                                        if (touched_regions->size() <= 2) {
                                                xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, 
-                                                                                                    Config->get_xfade_model(), Config->get_xfades_active()));
+                                                                                                    _session.config.get_xfade_model(), _session.config.get_xfades_active()));
                                                add_crossfade (xfade);
                                        }
 
                                } else {
                                        touched_regions = regions_touched (bottom->first_frame(), 
-                                                                          bottom->first_frame() + min ((nframes_t)Config->get_short_xfade_seconds() * _session.frame_rate(), 
+                                                                          bottom->first_frame() + min ((nframes_t)_session.config.get_short_xfade_seconds() * _session.frame_rate(), 
                                                                                                        bottom->length()));
                                        if (touched_regions->size() <= 2) {
-                                               xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, Config->get_xfade_model(), Config->get_xfades_active()));
+                                               xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, _session.config.get_xfade_model(), _session.config.get_xfades_active()));
                                                add_crossfade (xfade);
                                        }
                                }
                                break;
                        default:
                                xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, 
-                                                                                    Config->get_xfade_model(), Config->get_xfades_active()));
+                                                                                    _session.config.get_xfade_model(), _session.config.get_xfades_active()));
                                add_crossfade (xfade);
                        }
                }
index 4a3fa04d1c8c338344f4873f1ae8f89d561a0539..878ad1118fdfc6127decdb0bccb6204a536dae61 100644 (file)
@@ -509,7 +509,7 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame,
                just_meter_input (start_frame, end_frame, nframes);
        }
 
-       if (diskstream->record_enabled() && !can_record && !Config->get_auto_input()) {
+       if (diskstream->record_enabled() && !can_record && !_session.config.get_auto_input()) {
 
                /* not actually recording, but we want to hear the input material anyway,
                   at least potentially (depending on monitoring options)
index f3fbbe6c1ceb120260cf30ee8cbfcbc5338fcc45..197af86d132e155f87040e30e39201fcabc74cf1 100644 (file)
@@ -434,7 +434,7 @@ AudioRegion::_read_at (const SourceList& srcs, nframes_t limit,
        
                /* fade in */
 
-               if ((_flags & FadeIn) && Config->get_use_region_fades()) {
+               if ((_flags & FadeIn) && _session.config.get_use_region_fades()) {
                        
                        nframes_t fade_in_length = (nframes_t) _fade_in->back()->when;
                        
@@ -457,7 +457,7 @@ AudioRegion::_read_at (const SourceList& srcs, nframes_t limit,
                
                /* fade out */
                
-               if ((_flags & FadeOut) && Config->get_use_region_fades()) {
+               if ((_flags & FadeOut) && _session.config.get_use_region_fades()) {
 
                        /* see if some part of this read is within the fade out */
                        
index a0abe860fb631e3c33c06e5609aea4fe6d282934..b62d0f340665a7912a63463e78596832a45a992d 100644 (file)
@@ -41,8 +41,8 @@ using namespace PBD;
 Auditioner::Auditioner (Session& s)
        : AudioTrack (s, "auditioner", Route::Hidden)
 {
-       string left = Config->get_auditioner_output_left();
-       string right = Config->get_auditioner_output_right();
+       string left = _session.config.get_auditioner_output_left();
+       string right = _session.config.get_auditioner_output_right();
 
        if (left == "default") {
                left = _session.engine().get_nth_physical_output (DataType::AUDIO, 0);  
@@ -209,12 +209,12 @@ Auditioner::output_changed (IOChange change, void* src)
                if (output (0)->get_connections (connections)) {
                        phys = _session.engine().get_nth_physical_output (DataType::AUDIO, 0);
                        if (phys != connections[0]) {
-                               Config->set_auditioner_output_left (connections[0]);
+                               _session.config.set_auditioner_output_left (connections[0]);
                        } else {
-                               Config->set_auditioner_output_left ("default");
+                               _session.config.set_auditioner_output_left ("default");
                        }
                } else {
-                       Config->set_auditioner_output_left ("");
+                       _session.config.set_auditioner_output_left ("");
                }
                
                connections.clear ();
@@ -222,12 +222,12 @@ Auditioner::output_changed (IOChange change, void* src)
                if (output (1)->get_connections (connections)) {
                        phys = _session.engine().get_nth_physical_output (DataType::AUDIO, 1);
                        if (phys != connections[0]) {
-                               Config->set_auditioner_output_right (connections[0]);
+                               _session.config.set_auditioner_output_right (connections[0]);
                        } else {
-                               Config->set_auditioner_output_right ("default");
+                               _session.config.set_auditioner_output_right ("default");
                        }
                } else {
-                       Config->set_auditioner_output_right ("");
+                       _session.config.set_auditioner_output_right ("");
                }
        }
 }
index bb8aedae882936af008e0a4480e7aca90bcdd6fd..1144aaa2cd668f5df9155957d76935c7f4fd3316 100644 (file)
@@ -77,7 +77,7 @@ BroadcastInfo::set_from_session (Session const & session, int64_t time_ref)
        set_time_reference (time_ref);
        set_origination_time ();
        set_originator ();
-       set_originator_ref ();
+       set_originator_ref (session);
 }
 
 bool
@@ -242,7 +242,7 @@ BroadcastInfo::set_originator (std::string const & str)
 }
 
 void
-BroadcastInfo::set_originator_ref (std::string const & str)
+BroadcastInfo::set_originator_ref (Session const & session, std::string const & str)
 {
        _has_info = true;
        
@@ -261,8 +261,8 @@ BroadcastInfo::set_originator_ref (std::string const & str)
        serial_number << "ARDOUR" << "r" <<  std::setfill('0') << std::right << std::setw(5) << svn_revision;
        
        snprintf_bounded_null_filled (info->originator_reference, sizeof (info->originator_reference), "%2s%3s%12s%02d%02d%02d%9d",
-                 Config->get_bwf_country_code().c_str(),
-                 Config->get_bwf_organization_code().c_str(),
+                 session.config.get_bwf_country_code().c_str(),
+                 session.config.get_bwf_organization_code().c_str(),
                  serial_number.str().c_str(),
                  _time.tm_hour,
                  _time.tm_min,
index bff9fb16d63fd3b560a255ae790e9072f9bec6b6..79f36c86d8a570f1ff00ccee5b929bc88cef2de6 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 1999-2006 Paul Davis 
+    Copyright (C) 1999-2009 Paul Davis 
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 */
 
-#include <unistd.h>
-#include <cstdio> /* for snprintf, grrr */
-
-#include <glib.h>  
-#include <glib/gstdio.h> /* for g_stat() */
-#include <glibmm/miscutils.h>
-
-#include "pbd/failed_constructor.h"
-#include "pbd/xml++.h"
-#include "pbd/filesystem.h"
-#include "pbd/file_utils.h"
-
-#include "midi++/manager.h"
-
-#include "ardour/ardour.h"
 #include "ardour/configuration.h"
-#include "ardour/audio_diskstream.h"
-#include "ardour/control_protocol_manager.h"
-#include "ardour/filesystem_paths.h"
-
-#include "i18n.h"
 
 using namespace ARDOUR;
 using namespace std;
 using namespace PBD;
 
-/* this is global so that we do not have to indirect through an object pointer
-   to reference it.
-*/
-
-namespace ARDOUR {
-    float speed_quietning = 0.251189; // -12dB reduction for ffwd or rewind
-}
-
 Configuration::Configuration ()
-       :
-/* construct variables */
-#undef  CONFIG_VARIABLE
-#undef  CONFIG_VARIABLE_SPECIAL        
-#define CONFIG_VARIABLE(Type,var,name,value) var (name,value),
-#define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) var (name,value,mutator),
-#include "ardour/configuration_vars.h"
-#undef  CONFIG_VARIABLE
-#undef  CONFIG_VARIABLE_SPECIAL
-
-
-       current_owner (ConfigVariableBase::Default)
 {
-       _control_protocol_state = 0;
 }
 
 Configuration::~Configuration ()
 {
 }
 
+bool ConfigVariableBase::show_stores = false;
+
 void
-Configuration::set_current_owner (ConfigVariableBase::Owner owner)
+ConfigVariableBase::add_to_node (XMLNode& node)
 {
-       current_owner = owner;
+       std::string const v = get_as_string ();
+       show_stored_value (v);
+       XMLNode* child = new XMLNode ("Option");
+       child->add_property ("name", _name);
+       child->add_property ("value", v);
+       node.add_child_nocopy (*child);
 }
 
-int
-Configuration::load_state ()
+bool
+ConfigVariableBase::set_from_node (XMLNode const & node)
 {
-       bool found = false;
-
-       sys::path system_rc_file;
-       struct stat statbuf;
-
-       /* load system configuration first */
-       
-       if (find_file_in_search_path (ardour_search_path() + system_config_search_path(),
-                       "ardour_system.rc", system_rc_file) )
-       {
-               XMLTree tree;
-               found = true;
-
-               string rcfile = system_rc_file.to_string();
-
-               /* stupid XML Parser hates empty files */
+       if (node.name() == "Config" || node.name() == "Canvas" || node.name() == "UI") {
                
-               if (g_stat (rcfile.c_str(), &statbuf)) {
-                       return -1;
-               }
-
-               if (statbuf.st_size != 0) {
-                       cerr << string_compose (_("Loading system configuration file %1"), rcfile) << endl;
-                       
-                       if (!tree.read (rcfile.c_str())) {
-                               error << string_compose(_("Ardour: cannot read system configuration file \"%1\""), rcfile) << endmsg;
-                               return -1;
-                       }
+               /* ardour.rc */
+               
+               const XMLProperty* prop;
+               XMLNodeList nlist;
+               XMLNodeConstIterator niter;
+               XMLNode* child;
+               
+               nlist = node.children();
+               
+               for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
                        
-                       current_owner = ConfigVariableBase::System;
+                       child = *niter;
                        
-                       if (set_state (*tree.root())) {
-                               error << string_compose(_("Ardour: system configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
-                               return -1;
+                       if (child->name() == "Option") {
+                               if ((prop = child->property ("name")) != 0) {
+                                       if (prop->value() == _name) {
+                                               if ((prop = child->property ("value")) != 0) {
+                                                       set_from_string (prop->value());
+                                                       return true;
+                                               }
+                                       }
+                               }
                        }
-               } else {
-                       error << _("your system Ardour configuration file is empty. This probably means that there as an error installing Ardour") << endmsg;
                }
-       }
-
-       /* now load configuration file for user */
-
-       sys::path user_rc_file;
-
-       if (find_file_in_search_path (ardour_search_path() + user_config_directory(),
-                       "ardour.rc", user_rc_file))
-       {
-               XMLTree tree;
-               found = true;
-
-               string rcfile = user_rc_file.to_string();
-
-               /* stupid XML parser hates empty files */
+                       
+       } else if (node.name() == "Options") {
 
-               if (g_stat (rcfile.c_str(), &statbuf)) {
-                       return -1;
-               }
+               /* session file */
 
-               if (statbuf.st_size != 0) {
-                       cerr << string_compose (_("Loading user configuration file %1"), rcfile) << endl;
-                       
-                       if (!tree.read (rcfile)) {
-                               error << string_compose(_("Ardour: cannot read configuration file \"%1\""), rcfile) << endmsg;
-                               return -1;
-                       }
+               XMLNodeList olist;
+               XMLNodeConstIterator oiter;
+               XMLNode* option;
+               const XMLProperty* opt_prop;
+               
+               olist = node.children();
+               
+               for (oiter = olist.begin(); oiter != olist.end(); ++oiter) {
                        
-                       current_owner = ConfigVariableBase::Config;
+                       option = *oiter;
                        
-                       if (set_state (*tree.root())) {
-                               error << string_compose(_("Ardour: user configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
-                               return -1;
-                       }
-               } else {
-                       warning << _("your Ardour configuration file is empty. This is not normal.") << endmsg;
-               }       
-       }
-
-       if (!found)
-               error << "Ardour: could not find configuration file (ardour.rc), canvas will look broken." << endmsg;
-
-       return 0;
-}
-
-int
-Configuration::save_state()
-{
-       XMLTree tree;
-
-       try
-       {
-               sys::create_directories (user_config_directory ());
-       }
-       catch (const sys::filesystem_error& ex)
-       {
-               error << "Could not create user configuration directory" << endmsg;
-               return -1;
-       }
-       
-       sys::path rcfile_path(user_config_directory());
-
-       rcfile_path /= "ardour.rc";
-       const string rcfile = rcfile_path.to_string();
-
-       // this test seems bogus?
-       if (rcfile.length()) {
-               tree.set_root (&get_state());
-               if (!tree.write (rcfile.c_str())){
-                       error << string_compose (_("Config file %1 not saved"), rcfile) << endmsg;
-                       return -1;
-               }
-       }
-
-       return 0;
-}
-
-void
-Configuration::add_instant_xml(XMLNode& node)
-{
-       Stateful::add_instant_xml (node, user_config_directory ());
-}
-
-XMLNode*
-Configuration::instant_xml(const string& node_name)
-{
-       return Stateful::instant_xml (node_name, user_config_directory ());
-}
-
-
-bool
-Configuration::save_config_options_predicate (ConfigVariableBase::Owner owner)
-{
-       /* only save things that were in the config file to start with */
-       return owner & ConfigVariableBase::Config;
-}
-
-XMLNode&
-Configuration::get_state ()
-{
-       XMLNode* root;
-       LocaleGuard lg (X_("POSIX"));
-
-       root = new XMLNode("Ardour");
-
-       MIDI::Manager::PortMap::const_iterator i;
-       const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
-       
-       for (i = ports.begin(); i != ports.end(); ++i) {
-               root->add_child_nocopy(i->second->get_state());
-       }
-       
-       root->add_child_nocopy (get_variables (sigc::mem_fun (*this, &Configuration::save_config_options_predicate), "Config"));
-       
-       if (_extra_xml) {
-               root->add_child_copy (*_extra_xml);
-       }
-       
-       root->add_child_nocopy (ControlProtocolManager::instance().get_state());
-       
-       return *root;
-}
-
-XMLNode&
-Configuration::get_variables (sigc::slot<bool,ConfigVariableBase::Owner> predicate, std::string which_node)
-{
-       XMLNode* node;
-       LocaleGuard lg (X_("POSIX"));
-
-       node = new XMLNode(which_node);
-
-#undef  CONFIG_VARIABLE
-#undef  CONFIG_VARIABLE_SPECIAL        
-#define CONFIG_VARIABLE(type,var,Name,value) \
-         if (node->name() == "Config") { if (predicate (var.owner())) { var.add_to_node (*node); }}
-#define CONFIG_VARIABLE_SPECIAL(type,var,Name,value,mutator) \
-         if (node->name() == "Config") { if (predicate (var.owner())) { var.add_to_node (*node); }}
-#include "ardour/configuration_vars.h"
-#undef  CONFIG_VARIABLE
-#undef  CONFIG_VARIABLE_SPECIAL        
-
-       return *node;
-}
-
-int
-Configuration::set_state (const XMLNode& root)
-{
-       if (root.name() != "Ardour") {
-               return -1;
-       }
-
-       XMLNodeList nlist = root.children();
-       XMLNodeConstIterator niter;
-       XMLNode *node;
-
-       for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
-
-               node = *niter;
-
-               if (node->name() == "MIDI-port") {
-
-                       try {
-
-                               MIDI::Port::Descriptor desc (*node);
-                               map<string,XMLNode>::iterator x;
-                               if ((x = midi_ports.find (desc.tag)) != midi_ports.end()) {
-                                       midi_ports.erase (x);
+                       if (option->name() == _name) {
+                               if ((opt_prop = option->property ("val")) != 0) {
+                                       set_from_string (opt_prop->value());
+                                       return true;
                                }
-                               midi_ports.insert (pair<string,XMLNode>(desc.tag,*node));
                        }
-
-                       catch (failed_constructor& err) {
-                               warning << _("ill-formed MIDI port specification in ardour rcfile (ignored)") << endmsg;
-                       }
-
-               } else if (node->name() == "Config") {
-                       
-                       set_variables (*node, ConfigVariableBase::Config);
-                       
-               } else if (node->name() == "Extra") {
-                       _extra_xml = new XMLNode (*node);
-
-               } else if (node->name() == ControlProtocolManager::state_node_name) {
-                       _control_protocol_state = new XMLNode (*node);
                }
        }
-
-       Diskstream::set_disk_io_chunk_frames (minimum_disk_io_bytes.get() / sizeof (Sample));
-
-       return 0;
-}
-
-void
-Configuration::set_variables (const XMLNode& node, ConfigVariableBase::Owner owner)
-{
-#undef  CONFIG_VARIABLE
-#undef  CONFIG_VARIABLE_SPECIAL        
-#define CONFIG_VARIABLE(type,var,name,value) \
-         if (var.set_from_node (node, owner)) { \
-                ParameterChanged (name); \
-        }
-#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) \
-         if (var.set_from_node (node, owner)) { \
-                ParameterChanged (name); \
-        }
-
-#include "ardour/configuration_vars.h"
-#undef  CONFIG_VARIABLE
-#undef  CONFIG_VARIABLE_SPECIAL
        
-}
-void
-Configuration::map_parameters (sigc::slot<void,const char*> theSlot)
-{
-#undef  CONFIG_VARIABLE
-#undef  CONFIG_VARIABLE_SPECIAL        
-#define CONFIG_VARIABLE(type,var,name,value)                 theSlot (name);
-#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) theSlot (name);
-#include "ardour/configuration_vars.h"
-#undef  CONFIG_VARIABLE
-#undef  CONFIG_VARIABLE_SPECIAL        
+       return false;
 }
 
-bool ConfigVariableBase::show_stores = false;
 
 void
 ConfigVariableBase::set_show_stored_values (bool yn)
index c258a9bf73274f265bb7d6f038cd94c23b68f306..62169a48df8c27734bd499c65d2be00b2ca5b4ab 100644 (file)
@@ -83,7 +83,7 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<Audio
        _anchor_point = ap;
        _follow_overlap = false;
 
-       _active = Config->get_xfades_active ();
+       _active = _session.config.get_xfades_active ();
        _fixed = true;
 
        initialize ();
@@ -428,7 +428,7 @@ Crossfade::refresh ()
                if (_follow_overlap) {
 
                        try {
-                               compute (_in, _out, Config->get_xfade_model());
+                               compute (_in, _out, _session.config.get_xfade_model());
                        } 
 
                        catch (NoCrossfadeHere& err) {
index 722c0fad49cc0f071625eb3d554604d794169b39..1e17b3aeb9edbc59e3f4a999aa55792410ef403c 100644 (file)
@@ -56,7 +56,7 @@
 #include "ardour/ardour.h"
 #include "ardour/analyser.h"
 #include "ardour/audio_library.h"
-#include "ardour/configuration.h"
+#include "ardour/rc_configuration.h"
 #include "ardour/profile.h"
 #include "ardour/plugin_manager.h"
 #include "ardour/audiosource.h"
@@ -76,7 +76,7 @@
 
 #include "i18n.h"
 
-ARDOUR::Configuration* ARDOUR::Config = 0;
+ARDOUR::RCConfiguration* ARDOUR::Config = 0;
 ARDOUR::RuntimeProfile* ARDOUR::Profile = 0;
 ARDOUR::AudioLibrary* ARDOUR::Library = 0;
 
@@ -303,7 +303,7 @@ ARDOUR::init (bool use_vst, bool try_optimization)
 
        BootMessage (_("Loading configuration"));
 
-       Config = new Configuration;
+       Config = new RCConfiguration;
 
        if (Config->load_state ()) {
                return -1;
index 6eaf01c819444b0c2613d92ecfbda61f085cdd15..30b1542974531dd99ca623466051af411ad6f259 100644 (file)
@@ -367,7 +367,7 @@ MidiDiskstream::check_record_status (nframes_t transport_frame, nframes_t nframe
                        if (_alignment_style == ExistingMaterial) {
 
 
-                               if (!Config->get_punch_in()) {
+                               if (!_session.config.get_punch_in()) {
 
                                        /* manual punch in happens at the correct transport frame
                                           because the user hit a button. but to get alignment correct 
@@ -396,7 +396,7 @@ MidiDiskstream::check_record_status (nframes_t transport_frame, nframes_t nframe
 
                        } else {
 
-                               if (Config->get_punch_in()) {
+                               if (_session.config.get_punch_in()) {
                                        first_recordable_frame += _roll_delay;
                                } else {
                                        capture_start_frame -= _roll_delay;
@@ -634,7 +634,7 @@ MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_
        commit_should_unlock = true;
        adjust_capture_position = 0;
 
-       if (nominally_recording || (_session.get_record_enabled() && Config->get_punch_in())) {
+       if (nominally_recording || (_session.get_record_enabled() && _session.config.get_punch_in())) {
                OverlapType ot;
 
                ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes);
@@ -1325,7 +1325,7 @@ MidiDiskstream::engage_record_enable ()
        g_atomic_int_set (&_record_enabled, 1);
        
        if (_source_port && Config->get_monitoring_model() == HardwareMonitoring) {
-               _source_port->request_monitor_input (!(Config->get_auto_input() && rolling));
+               _source_port->request_monitor_input (!(_session.config.get_auto_input() && rolling));
        }
 
        // FIXME: Why is this necessary?  Isn't needed for AudioDiskstream...
@@ -1387,7 +1387,7 @@ MidiDiskstream::get_state ()
 
                Location* pi;
 
-               if (Config->get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) {
+               if (_session.config.get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) {
                        snprintf (buf, sizeof (buf), "%" PRIu32, pi->start());
                } else {
                        snprintf (buf, sizeof (buf), "%" PRIu32, _session.transport_frame());
index 6697e3b70476980a8505de996f1f5c9042eb10bd..6feb3253ce7cd5ae99b56cd89fa73b451a6442cd 100644 (file)
@@ -414,7 +414,7 @@ MidiTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame,
                just_meter_input (start_frame, end_frame, nframes);
        }
 
-       if (diskstream->record_enabled() && !can_record && !Config->get_auto_input()) {
+       if (diskstream->record_enabled() && !can_record && !_session.config.get_auto_input()) {
 
                /* not actually recording, but we want to hear the input material anyway,
                   at least potentially (depending on monitoring options)
index a78addf4810181f80b33ab36cd769b1db8cd0270..4942485a70ffc3a620cb56426fcc7a6be17bad14 100644 (file)
@@ -421,8 +421,7 @@ Playlist::flush_notifications ()
        // pending_bounds.sort (cmp);
 
        for (RegionList::iterator r = pending_bounds.begin(); r != pending_bounds.end(); ++r) {
-
-               if (Config->get_layer_model() == MoveAddHigher) {
+               if (_session.config.get_layer_model() == MoveAddHigher) {
                        timestamp_layer_op (*r);
                }
 
@@ -1277,7 +1276,7 @@ Playlist::region_bounds_changed (Change what_changed, boost::shared_ptr<Region>
                if (holding_state ()) {
                        pending_bounds.push_back (region);
                } else {
-                       if (Config->get_layer_model() == MoveAddHigher) {
+                       if (_session.config.get_layer_model() == MoveAddHigher) {
                                /* it moved or changed length, so change the timestamp */
                                timestamp_layer_op (region);
                        }
@@ -1964,7 +1963,7 @@ Playlist::relayer ()
 
        /* sort according to the model */
 
-       if (Config->get_layer_model() == MoveAddHigher || Config->get_layer_model() == AddHigher) {
+       if (_session.config.get_layer_model() == MoveAddHigher || _session.config.get_layer_model() == AddHigher) {
                RegionSortByLastLayerOp cmp;
                copy.sort (cmp);
        }
@@ -2054,8 +2053,8 @@ void
 Playlist::raise_region_to_top (boost::shared_ptr<Region> region)
 {
        /* does nothing useful if layering mode is later=higher */
-       if ((Config->get_layer_model() == MoveAddHigher) ||
-           (Config->get_layer_model() == AddHigher)) {
+       if ((_session.config.get_layer_model() == MoveAddHigher) ||
+           (_session.config.get_layer_model() == AddHigher)) {
                timestamp_layer_op (region);
                relayer ();
        }
@@ -2065,8 +2064,8 @@ void
 Playlist::lower_region_to_bottom (boost::shared_ptr<Region> region)
 {
        /* does nothing useful if layering mode is later=higher */
-       if ((Config->get_layer_model() == MoveAddHigher) ||
-           (Config->get_layer_model() == AddHigher)) {
+       if ((_session.config.get_layer_model() == MoveAddHigher) ||
+           (_session.config.get_layer_model() == AddHigher)) {
                region->set_last_layer_op (0);
                relayer ();
        }
index 4da4c1b192db1ca4b56fd68ef248d6b18a517870..7088fa67a35477254cf7ffd9c9f035e0b904bcac 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "pbd/error.h"
+#include "pbd/xml++.h"
 
 #include "ardour/playlist.h"
 #include "ardour/audioplaylist.h"
index db06368371031cc124b5043e6124abb0fc7166f4..06b9308d3563c6af5b32d92fe953d8fab99ce424 100644 (file)
@@ -325,7 +325,7 @@ Route::process_output_buffers (BufferSet& bufs,
        declick = _pending_declick;
        
        const bool recording_without_monitoring = no_monitor && record_enabled()
-                       && (!Config->get_auto_input() || _session.actively_recording());
+                       && (!_session.config.get_auto_input() || _session.actively_recording());
        
 
        /* -------------------------------------------------------------------------------------------
index 3105b776dc86da8e2774a318666725afbdd676dc..02f868a4c07e4ed2b9d6e4f60e3cea1f7f6d66f9 100644 (file)
@@ -865,7 +865,7 @@ Session::reset_input_monitor_state ()
                for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
                        if ((*i)->record_enabled ()) {
                                //cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
-                               (*i)->monitor_input (Config->get_monitoring_model() == HardwareMonitoring && !Config->get_auto_input());
+                               (*i)->monitor_input (Config->get_monitoring_model() == HardwareMonitoring && !config.get_auto_input());
                        }
                }
        } else {
@@ -885,7 +885,7 @@ Session::auto_punch_start_changed (Location* location)
 {
        replace_event (Event::PunchIn, location->start());
 
-       if (get_record_enabled() && Config->get_punch_in()) {
+       if (get_record_enabled() && config.get_punch_in()) {
                /* capture start has been changed, so save new pending state */
                save_state ("", true);
        }
@@ -1091,7 +1091,7 @@ Session::enable_record ()
                _last_record_location = _transport_frame;
                deliver_mmc(MIDI::MachineControl::cmdRecordStrobe, _last_record_location);
 
-               if (Config->get_monitoring_model() == HardwareMonitoring && Config->get_auto_input()) {
+               if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
                        boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
                        for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
                                if ((*i)->record_enabled ()) {
@@ -1125,7 +1125,7 @@ Session::disable_record (bool rt_context, bool force)
                if (rt_context)
                        deliver_mmc (MIDI::MachineControl::cmdRecordExit, _transport_frame);
 
-               if (Config->get_monitoring_model() == HardwareMonitoring && Config->get_auto_input()) {
+               if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
                        boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
 
                        for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
@@ -1150,7 +1150,7 @@ Session::step_back_from_record ()
        if (g_atomic_int_get (&_record_status) == Recording) {
                g_atomic_int_set (&_record_status, Enabled);
 
-               if (Config->get_monitoring_model() == HardwareMonitoring && Config->get_auto_input()) {
+               if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
                        boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
 
                        for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
@@ -1175,7 +1175,7 @@ Session::maybe_enable_record ()
        save_state ("", true);
 
        if (_transport_speed) {
-               if (!Config->get_punch_in()) {
+               if (!config.get_punch_in()) {
                        enable_record ();
                }
        } else {
@@ -3726,7 +3726,7 @@ Session::available_capture_duration ()
 {
        float sample_bytes_on_disk = 4.0; // keep gcc happy
 
-       switch (Config->get_native_file_data_format()) {
+       switch (config.get_native_file_data_format()) {
        case FormatFloat:
                sample_bytes_on_disk = 4.0;
                break;
index 06f4598af7f42d836df7341ea85cee3411b5ef95..d631eda710a8a0bd34d49e0baf7f78e0c1f5bef0 100644 (file)
@@ -366,7 +366,7 @@ Session::process_event (Event* ev)
                
        case Event::PunchIn:
                // cerr << "PunchIN at " << transport_frame() << endl;
-               if (Config->get_punch_in() && record_status() == Enabled) {
+               if (config.get_punch_in() && record_status() == Enabled) {
                        enable_record ();
                }
                remove = false;
@@ -375,7 +375,7 @@ Session::process_event (Event* ev)
                
        case Event::PunchOut:
                // cerr << "PunchOUT at " << transport_frame() << endl;
-               if (Config->get_punch_out()) {
+               if (config.get_punch_out()) {
                        step_back_from_record ();
                }
                remove = false;
index b0d6ed93472aba7b0485abec7232002deac80ee2..6c0c48f50ec18b6f3e1585f6bae61ab244671872 100644 (file)
@@ -801,7 +801,7 @@ Session::send_full_time_code(nframes_t nframes)
        // I don't understand this bit yet.. [DR]
        if (((mtc_smpte_bits >> 5) != MIDI::MTC_25_FPS) && (transmitting_smpte_time.frames % 2)) {
                // start MTC quarter frame transmission on an even frame
-               SMPTE::increment( transmitting_smpte_time );
+               SMPTE::increment( transmitting_smpte_time, config.get_subframes_per_frame() );
                outbound_mtc_smpte_frame += (nframes_t) _frames_per_smpte_frame;
        }
 
@@ -928,8 +928,8 @@ Session::send_midi_time_code_for_cycle(nframes_t nframes)
                        // Wrap quarter frame counter
                        next_quarter_frame_to_send = 0;
                        // Increment smpte time twice
-                       SMPTE::increment( transmitting_smpte_time );
-                       SMPTE::increment( transmitting_smpte_time );
+                       SMPTE::increment( transmitting_smpte_time, config.get_subframes_per_frame() );
+                       SMPTE::increment( transmitting_smpte_time, config.get_subframes_per_frame() );
                        // Re-calculate timing of first quarter frame
                        //smpte_to_sample( transmitting_smpte_time, outbound_mtc_smpte_frame, true /* use_offset */, false );
                        outbound_mtc_smpte_frame += 8 * quarter_frame_duration;
index eb192f6dc90fb0f60ca06853bc212309df6523dd..eb986a3d8346d1573f36425cee263ede2db4cbe9 100644 (file)
@@ -508,7 +508,7 @@ Session::follow_slave (nframes_t nframes)
                slave_speed = 0.0f;
        }
 
-       if (_slave->is_always_synced() || Config->get_timecode_source_is_synced()) {
+       if (_slave->is_always_synced() || config.get_timecode_source_is_synced()) {
 
                /* if the TC source is synced, then we assume that its 
                   speed is binary: 0.0 or 1.0
@@ -530,7 +530,7 @@ Session::follow_slave (nframes_t nframes)
        
        track_slave_state(slave_speed, slave_transport_frame, this_delta, starting);
 
-       if (slave_state == Running && !_slave->is_always_synced() && !Config->get_timecode_source_is_synced()) {
+       if (slave_state == Running && !_slave->is_always_synced() && !config.get_timecode_source_is_synced()) {
 
                if (_transport_speed != 0.0f) {
                        
index 7d14035c93e1aeae30e71535756cd5a5c5edd95b..c7cb3fc5a1c807da64c6be916769ab681b7dffc2 100644 (file)
@@ -163,7 +163,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        _transport_frame = 0;
        end_location = new Location (0, 0, _("end"), Location::Flags ((Location::IsMark|Location::IsEnd)));
        start_location = new Location (0, 0, _("start"), Location::Flags ((Location::IsMark|Location::IsStart)));
-       _end_location_is_free = true;
        g_atomic_int_set (&_record_status, Disabled);
        loop_changing = false;
        play_loop = false;
@@ -214,8 +213,8 @@ Session::first_stage_init (string fullpath, string snapshot_name)
 
        /* default short fade = 15ms */
 
-       Crossfade::set_short_xfade_length ((nframes_t) floor (Config->get_short_xfade_seconds() * frame_rate()));
-       SndFileSource::setup_standard_crossfades (frame_rate());
+       Crossfade::set_short_xfade_length ((nframes_t) floor (config.get_short_xfade_seconds() * frame_rate()));
+       SndFileSource::setup_standard_crossfades (*this, frame_rate());
 
        last_mmc_step.tv_sec = 0;
        last_mmc_step.tv_usec = 0;
@@ -363,11 +362,7 @@ Session::second_stage_init (bool new_session)
 
        ControlProtocolManager::instance().set_session (*this);
 
-       if (new_session) {
-               _end_location_is_free = true;
-       } else {
-               _end_location_is_free = false;
-       }
+       config.set_end_marker_is_free (new_session);
 
        _state_of_the_state = Clean;
        
@@ -861,7 +856,7 @@ Session::load_options (const XMLNode& node)
        XMLProperty* prop;
        LocaleGuard lg (X_("POSIX"));
 
-       Config->set_variables (node, ConfigVariableBase::Session);
+       config.set_variables (node);
 
        /* now reset MIDI ports because the session can have its own 
           MIDI configuration.
@@ -869,38 +864,9 @@ Session::load_options (const XMLNode& node)
 
        setup_midi ();
 
-       if ((child = find_named_node (node, "end-marker-is-free")) != 0) {
-               if ((prop = child->property ("val")) != 0) {
-                       _end_location_is_free = (prop->value() == "yes");
-               }
-       }
-
        return 0;
 }
 
-bool
-Session::save_config_options_predicate (ConfigVariableBase::Owner owner) const
-{
-       const ConfigVariableBase::Owner modified_by_session_or_user = (ConfigVariableBase::Owner)
-               (ConfigVariableBase::Session|ConfigVariableBase::Interface);
-
-       return owner & modified_by_session_or_user;
-}
-
-XMLNode&
-Session::get_options () const
-{
-       XMLNode* child;
-       LocaleGuard lg (X_("POSIX"));
-
-       XMLNode& option_root = Config->get_variables (mem_fun (*this, &Session::save_config_options_predicate));
-
-       child = option_root.add_child ("end-marker-is-free");
-       child->add_property ("val", _end_location_is_free ? "yes" : "no");
-
-       return option_root;
-}
-
 XMLNode&
 Session::get_state()
 {
@@ -976,7 +942,7 @@ Session::state(bool full_state)
 
        /* various options */
 
-       node->add_child_nocopy (get_options());
+       node->add_child_nocopy (config.get_variables ());
 
        node->add_child_nocopy (_metadata->get_state());
 
@@ -3055,7 +3021,7 @@ Session::config_changed (const char* parameter_name)
                        
                        for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
                                if ((*i)->record_enabled ()) {
-                                       (*i)->monitor_input (!Config->get_auto_input());
+                                       (*i)->monitor_input (!config.get_auto_input());
                                }
                        }
                }
@@ -3066,7 +3032,7 @@ Session::config_changed (const char* parameter_name)
                
                if ((location = _locations.auto_punch_location()) != 0) {
                        
-                       if (Config->get_punch_in ()) {
+                       if (config.get_punch_in ()) {
                                replace_event (Event::PunchIn, location->start());
                        } else {
                                remove_event (location->start(), Event::PunchIn);
@@ -3079,7 +3045,7 @@ Session::config_changed (const char* parameter_name)
                
                if ((location = _locations.auto_punch_location()) != 0) {
                        
-                       if (Config->get_punch_out()) {
+                       if (config.get_punch_out()) {
                                replace_event (Event::PunchOut, location->end());
                        } else {
                                clear_events (Event::PunchOut);
@@ -3120,7 +3086,7 @@ Session::config_changed (const char* parameter_name)
 
        } else if (PARAM_IS ("raid-path")) {
 
-               setup_raid_path (Config->get_raid_path());
+               setup_raid_path (config.get_raid_path());
 
        } else if (PARAM_IS ("smpte-format")) {
 
index 264ce10c82ba5dcc2fd04d1c91c8ae73efea5cd0..223c30bd1a3dc8d8c9995fd84a9f52f895b1f7c2 100644 (file)
@@ -52,7 +52,7 @@ Session::bbt_time (nframes_t when, BBT_Time& bbt)
 float
 Session::smpte_frames_per_second() const
 {
-       switch (Config->get_smpte_format()) {
+       switch (config.get_smpte_format()) {
                case smpte_23976: 
                        return 23.976;
 
@@ -101,7 +101,7 @@ Session::smpte_frames_per_second() const
 bool
 Session::smpte_drop_frames() const
 {
-       switch (Config->get_smpte_format()) {
+       switch (config.get_smpte_format()) {
                case smpte_23976: 
                        return false;
 
@@ -185,7 +185,7 @@ int
 Session::set_smpte_format (SmpteFormat format)
 {
        /* this will trigger any other changes needed */
-       Config->set_smpte_format (format);
+       config.set_smpte_format (format);
        return 0;
 }
 
@@ -272,7 +272,7 @@ Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset
        }
   
        if (use_subframes) {
-               sample += (long) (((double)smpte.subframes * _frames_per_smpte_frame) / Config->get_subframes_per_frame());
+               sample += (long) (((double)smpte.subframes * _frames_per_smpte_frame) / config.get_subframes_per_frame());
        }
   
        if (use_offset) {
@@ -334,10 +334,10 @@ Session::sample_to_smpte( nframes_t sample, SMPTE::Time& smpte, bool use_offset,
        // Calculate exact number of (exceeding) smpte frames and fractional frames
        smpte_frames_left_exact = (double) offset_sample / _frames_per_smpte_frame;
        smpte_frames_fraction = smpte_frames_left_exact - floor( smpte_frames_left_exact );
-       smpte.subframes = (long) rint(smpte_frames_fraction * Config->get_subframes_per_frame());
+       smpte.subframes = (long) rint(smpte_frames_fraction * config.get_subframes_per_frame());
   
        // XXX Not sure if this is necessary anymore...
-       if (smpte.subframes == Config->get_subframes_per_frame()) {
+       if (smpte.subframes == config.get_subframes_per_frame()) {
                // This can happen with 24 fps (and 29.97 fps ?)
                smpte_frames_left_exact = ceil( smpte_frames_left_exact );
                smpte.subframes = 0;
index 790d990bc2b6d768a92ce7bb6bc3b01f77e44634..ccdbbb3ef6d55cc0525673b354b35939a7e140fa 100644 (file)
@@ -184,7 +184,7 @@ Session::realtime_stop (bool abort)
                waiting_for_sync_offset = true;
        }
 
-       transport_sub_state = ((Config->get_slave_source() == None && Config->get_auto_return()) ? AutoReturning : 0);
+       transport_sub_state = ((Config->get_slave_source() == None && config.get_auto_return()) ? AutoReturning : 0);
 }
 
 void
@@ -345,7 +345,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
 
                        /* stopped recording before current end */
 
-                       if (_end_location_is_free) {
+                       if (config.get_end_marker_is_free()) {
 
                                /* first capture for this session, move end back to where we are */
 
@@ -366,7 +366,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
                         add_command (new MementoCommand<Location>(*loc, &before, &after));
                }
 
-               _end_location_is_free = false;
+               config.set_end_marker_is_free (false);
                _have_captured = true;
        }
 
@@ -391,7 +391,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
        }
 
        bool const auto_return_enabled =
-               (Config->get_slave_source() == None && Config->get_auto_return());
+               (Config->get_slave_source() == None && config.get_auto_return());
        
        if (auto_return_enabled ||
            (post_transport_work & PostTransportLocate) ||
@@ -705,7 +705,7 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w
                }
        }
 
-       if (transport_rolling() && (!auto_play_legal || !Config->get_auto_play()) && !with_roll && !(synced_to_jack() && play_loop)) {
+       if (transport_rolling() && (!auto_play_legal || !config.get_auto_play()) && !with_roll && !(synced_to_jack() && play_loop)) {
                realtime_stop (false);
        }
 
@@ -744,7 +744,7 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w
                        for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
                                if ((*i)->record_enabled ()) {
                                        //cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
-                                       (*i)->monitor_input (!Config->get_auto_input());
+                                       (*i)->monitor_input (!config.get_auto_input());
                                }
                        }
                }
@@ -851,7 +851,7 @@ Session::set_transport_speed (double speed, bool abort)
                        boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
 
                        for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
-                               if (Config->get_auto_input() && (*i)->record_enabled ()) {
+                               if (config.get_auto_input() && (*i)->record_enabled ()) {
                                        //cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
                                        (*i)->monitor_input (false);
                                }
@@ -969,7 +969,7 @@ Session::start_transport ()
 
        switch (record_status()) {
        case Enabled:
-               if (!Config->get_punch_in()) {
+               if (!config.get_punch_in()) {
                        enable_record ();
                }
                break;
@@ -1022,7 +1022,7 @@ Session::post_transport ()
 
        if (post_transport_work & PostTransportLocate) {
 
-               if (((Config->get_slave_source() == None && (auto_play_legal && Config->get_auto_play())) && !_exporting) || (post_transport_work & PostTransportRoll)) {
+               if (((Config->get_slave_source() == None && (auto_play_legal && config.get_auto_play())) && !_exporting) || (post_transport_work & PostTransportRoll)) {
                        start_transport ();
 
                } else {
index 6002f95cb992983dcd03eb3f4ff3ef0a251c1ef8..234f55f30b0a0029d4b9a272eca7fa3166c1713b 100644 (file)
@@ -32,6 +32,8 @@
 #include "ardour/sndfile_helpers.h"
 #include "ardour/utils.h"
 #include "ardour/version.h"
+#include "ardour/rc_configuration.h"
+#include "ardour/session.h"
 
 #include "i18n.h"
 
@@ -517,7 +519,7 @@ SndFileSource::setup_broadcast_info (sframes_t when, struct tm& now, time_t tnow
                return 0;
        }
 
-       _broadcast_info->set_originator_ref ();
+       _broadcast_info->set_originator_ref (_session);
        _broadcast_info->set_origination_time (&now);
        
        /* now update header position taking header offset into account */
@@ -773,13 +775,13 @@ SndFileSource::handle_header_position_change ()
 }
 
 void
-SndFileSource::setup_standard_crossfades (nframes_t rate)
+SndFileSource::setup_standard_crossfades (Session const & s, nframes_t rate)
 {
        /* This static method is assumed to have been called by the Session
           before any DFS's are created.
        */
 
-       xfade_frames = (nframes_t) floor ((Config->get_destructive_xfade_msecs () / 1000.0) * rate);
+       xfade_frames = (nframes_t) floor ((s.config.get_destructive_xfade_msecs () / 1000.0) * rate);
 
        delete [] out_coefficient;
        delete [] in_coefficient;
index d6ce7ba033482b6219fccbd8c4cbbb77cdcf54ac..544b04e1c742afc60d4134e37f41629117c9adee 100644 (file)
@@ -26,8 +26,9 @@
 #include "ardour/source_factory.h"
 #include "ardour/sndfilesource.h"
 #include "ardour/silentfilesource.h"
-#include "ardour/configuration.h"
+#include "ardour/rc_configuration.h"
 #include "ardour/smf_source.h"
+#include "ardour/session.h"
 
 #ifdef  HAVE_COREAUDIO
 #define USE_COREAUDIO_FOR_FILES
@@ -246,8 +247,8 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat
        
        if (type == DataType::AUDIO) {
                boost::shared_ptr<Source> ret (new SndFileSource (s, path, embedded,
-                               Config->get_native_file_data_format(),
-                               Config->get_native_file_header_format(),
+                               s.config.get_native_file_data_format(),
+                               s.config.get_native_file_header_format(),
                                rate,
                                (destructive
                                        ? Source::Flag (SndFileSource::default_writable_flags | Source::Destructive)
index fd9267ede420d6d74b8a703fdaa9a7b2732ab7f0..fa3193cba36c9183452d0bedd6d48bd973b38287 100644 (file)
@@ -275,7 +275,7 @@ Track::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame,
                           they monitor input always when stopped.and auto-input is engaged. 
                        */
                        if ((Config->get_monitoring_model() == SoftwareMonitoring)
-                                       && (Config->get_auto_input () || _diskstream->record_enabled())) {
+                                       && (_session.config.get_auto_input () || _diskstream->record_enabled())) {
                                send_silence = false;
                        } else {
                                send_silence = true;
index 7320f3c7f3f6ad0c3bb3d7480977848778f51d7f..052d583976013dafc7858cd918b064112ef5eac9 100644 (file)
@@ -378,19 +378,6 @@ slave_source_to_string (SlaveSource src)
        }
 }
 
-/* I don't really like hard-coding these falloff rates here
- * Probably should use a map of some kind that could be configured
- * These rates are db/sec.
-*/
-
-#define METER_FALLOFF_OFF     0.0f
-#define METER_FALLOFF_SLOWEST 6.6f // BBC standard
-#define METER_FALLOFF_SLOW    8.6f // BBC standard
-#define METER_FALLOFF_MEDIUM  20.0f
-#define METER_FALLOFF_FAST    32.0f
-#define METER_FALLOFF_FASTER  46.0f
-#define METER_FALLOFF_FASTEST 70.0f
-
 float
 meter_falloff_to_float (MeterFalloff falloff)
 {
index 85187680d87d06ffb86a9c4151263ec2d2a8f035..7079a64a0832ecfa232694097a98f1fb73136e73 100644 (file)
@@ -171,6 +171,7 @@ def build(bld):
                port_set.cc
                processor.cc
                quantize.cc
+               rc_configuration.cc
                recent_sessions.cc
                region.cc
                region_factory.cc
@@ -184,6 +185,7 @@ def build(bld):
                session_butler.cc
                session_click.cc
                session_command.cc
+               session_configuration.cc
                session_directory.cc
                session_events.cc
                session_export.cc
index a0eeda5a96b2bc7fb82d92a5bfa8046b16644d6b..2eda08acf71fa03ff78f41f04c2dc7edcb19f127 100644 (file)
@@ -220,13 +220,13 @@ BasicUI::toggle_all_rec_enables ()
 void
 BasicUI::toggle_punch_in ()
 {
-       Config->set_punch_in (!Config->get_punch_in());
+       session->config.set_punch_in (!session->config.get_punch_in());
 }
 
 void
 BasicUI::toggle_punch_out ()
 {
-       Config->set_punch_out (!Config->get_punch_out());
+       session->config.set_punch_out (!session->config.get_punch_out());
 }
 
 bool
index b25a268aac45009c800885627dbb8b8753dbf5f9..7493ccf85ff5055b2543fc7a0c675baef09d15ea 100644 (file)
@@ -53,13 +53,13 @@ struct Time {
        }
 };
 
-Wrap increment( Time& smpte );
-Wrap decrement( Time& smpte );
-Wrap increment_subframes( Time& smpte );
-Wrap decrement_subframes( Time& smpte );
-Wrap increment_seconds( Time& smpte );
-Wrap increment_minutes( Time& smpte );
-Wrap increment_hours( Time& smpte );
+Wrap increment( Time& smpte, uint32_t );
+Wrap decrement( Time& smpte, uint32_t );
+Wrap increment_subframes( Time& smpte, uint32_t );
+Wrap decrement_subframes( Time& smpte, uint32_t );
+Wrap increment_seconds( Time& smpte, uint32_t );
+Wrap increment_minutes( Time& smpte, uint32_t );
+Wrap increment_hours( Time& smpte, uint32_t );
 void frames_floor( Time& smpte );
 void seconds_floor( Time& smpte );
 void minutes_floor( Time& smpte );
index 5df159a52bf45760253cec76258a783e9ce39709..969c3385bc95c85e94486405c868d6cce9210219 100644 (file)
@@ -19,8 +19,8 @@
 #define SMPTE_IS_AROUND_ZERO( sm ) (!(sm).frames && !(sm).seconds && !(sm).minutes && !(sm).hours)
 #define SMPTE_IS_ZERO( sm ) (!(sm).frames && !(sm).seconds && !(sm).minutes && !(sm).hours && !(sm.subframes))
 
-#include <control_protocol/smpte.h>
-#include <ardour/configuration.h>
+#include "control_protocol/smpte.h"
+#include "ardour/rc_configuration.h"
 
 namespace SMPTE {
 
@@ -32,20 +32,20 @@ float Time::default_rate = 30.0;
  * @return true if seconds wrap.
  */
 Wrap
-increment( Time& smpte )
+increment( Time& smpte, uint32_t subframes_per_frame )
 {
        Wrap wrap = NONE;
 
        if (smpte.negative) {
                if (SMPTE_IS_AROUND_ZERO(smpte) && smpte.subframes) {
                        // We have a zero transition involving only subframes
-                       smpte.subframes = ARDOUR::Config->get_subframes_per_frame() - smpte.subframes;
+                       smpte.subframes = subframes_per_frame - smpte.subframes;
                        smpte.negative = false;
                        return SECONDS;
                }
     
                smpte.negative = false;
-               wrap = decrement( smpte );
+               wrap = decrement( smpte, subframes_per_frame );
                if (!SMPTE_IS_ZERO( smpte )) {
                        smpte.negative = true;
                }
@@ -118,19 +118,19 @@ increment( Time& smpte )
  * Realtime safe.
  * @return true if seconds wrap. */
 Wrap
-decrement( Time& smpte )
+decrement( Time& smpte, uint32_t subframes_per_frame )
 {
        Wrap wrap = NONE;
   
   
        if (smpte.negative || SMPTE_IS_ZERO(smpte)) {
                smpte.negative = false;
-               wrap = increment( smpte );
+               wrap = increment( smpte, subframes_per_frame );
                smpte.negative = true;
                return wrap;
        } else if (SMPTE_IS_AROUND_ZERO(smpte) && smpte.subframes) {
                // We have a zero transition involving only subframes
-               smpte.subframes = ARDOUR::Config->get_subframes_per_frame() - smpte.subframes;
+               smpte.subframes = subframes_per_frame - smpte.subframes;
                smpte.negative = true;
                return SECONDS;
        }
@@ -215,13 +215,13 @@ frames_floor( Time& smpte )
 
 /** Increment @a smpte by one subframe */
 Wrap
-increment_subframes( Time& smpte )
+increment_subframes( Time& smpte, uint32_t subframes_per_frame )
 {
        Wrap wrap = NONE;
   
        if (smpte.negative) {
                smpte.negative = false;
-               wrap = decrement_subframes( smpte );
+               wrap = decrement_subframes( smpte, subframes_per_frame );
                if (!SMPTE_IS_ZERO(smpte)) {
                        smpte.negative = true;
                }
@@ -229,9 +229,9 @@ increment_subframes( Time& smpte )
        }
   
        smpte.subframes++;
-       if (smpte.subframes >= ARDOUR::Config->get_subframes_per_frame()) {
+       if (smpte.subframes >= subframes_per_frame) {
                smpte.subframes = 0;
-               increment( smpte );
+               increment( smpte, subframes_per_frame );
                return FRAMES;
        }
        return NONE;
@@ -240,13 +240,13 @@ increment_subframes( Time& smpte )
 
 /** Decrement @a smpte by one subframe */
 Wrap
-decrement_subframes( Time& smpte )
+decrement_subframes( Time& smpte, uint32_t subframes_per_frame )
 {
        Wrap wrap = NONE;
   
        if (smpte.negative) {
                smpte.negative = false;
-               wrap = increment_subframes( smpte );
+               wrap = increment_subframes( smpte, subframes_per_frame );
                smpte.negative = true;
                return wrap;
        }
@@ -258,7 +258,7 @@ decrement_subframes( Time& smpte )
                        smpte.subframes = 1;
                        return FRAMES;
                } else {
-                       decrement( smpte );
+                       decrement( smpte, subframes_per_frame );
                        smpte.subframes = 79;
                        return FRAMES;
                }
@@ -274,7 +274,7 @@ decrement_subframes( Time& smpte )
 
 /** Go to next whole second (frames == 0 or frames == 2) */
 Wrap
-increment_seconds( Time& smpte )
+increment_seconds( Time& smpte, uint32_t subframes_per_frame )
 {
        Wrap wrap = NONE;
   
@@ -283,7 +283,7 @@ increment_seconds( Time& smpte )
   
        if (smpte.negative) {
                // Wrap second if on second boundary
-               wrap = increment(smpte);
+               wrap = increment(smpte, subframes_per_frame);
                // Go to lowest absolute frame value
                seconds_floor( smpte );
                if (SMPTE_IS_ZERO(smpte)) {
@@ -307,7 +307,7 @@ increment_seconds( Time& smpte )
                }
     
                // Increment by one frame
-               wrap = increment( smpte );
+               wrap = increment( smpte, subframes_per_frame );
        }
   
        return wrap;
@@ -349,7 +349,7 @@ seconds_floor( Time& smpte )
 
 /** Go to next whole minute (seconds == 0, frames == 0 or frames == 2) */
 Wrap
-increment_minutes( Time& smpte )
+increment_minutes( Time& smpte, uint32_t subframes_per_frame )
 {
        Wrap wrap = NONE;
   
@@ -358,14 +358,14 @@ increment_minutes( Time& smpte )
   
        if (smpte.negative) {
                // Wrap if on minute boundary
-               wrap = increment_seconds( smpte );
+               wrap = increment_seconds( smpte, subframes_per_frame );
                // Go to lowest possible value in this minute
                minutes_floor( smpte );
        } else {
                // Go to highest possible second
                smpte.seconds = 59;
                // Wrap minute by incrementing second
-               wrap = increment_seconds( smpte );
+               wrap = increment_seconds( smpte, subframes_per_frame );
        }
   
        return wrap;
@@ -389,7 +389,7 @@ minutes_floor( Time& smpte )
 
 /** Go to next whole hour (minute = 0, second = 0, frame = 0) */
 Wrap
-increment_hours( Time& smpte )
+increment_hours( Time& smpte, uint32_t subframes_per_frame )
 {
        Wrap wrap = NONE;
   
@@ -398,12 +398,12 @@ increment_hours( Time& smpte )
   
        if (smpte.negative) {
                // Wrap if on hour boundary
-               wrap = increment_minutes( smpte );
+               wrap = increment_minutes( smpte, subframes_per_frame );
                // Go to lowest possible value in this hour
                hours_floor( smpte );
        } else {
                smpte.minutes = 59;
-               wrap = increment_minutes( smpte );
+               wrap = increment_minutes( smpte, subframes_per_frame );
        }
   
        return wrap;