summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--gtk2_ardour/actions.cc30
-rw-r--r--gtk2_ardour/actions.h9
-rw-r--r--gtk2_ardour/ardour_ui.cc17
-rw-r--r--gtk2_ardour/ardour_ui.h9
-rw-r--r--gtk2_ardour/ardour_ui2.cc2
-rw-r--r--gtk2_ardour/ardour_ui_dialogs.cc26
-rw-r--r--gtk2_ardour/ardour_ui_ed.cc6
-rw-r--r--gtk2_ardour/ardour_ui_options.cc166
-rw-r--r--gtk2_ardour/audio_region_view.cc8
-rw-r--r--gtk2_ardour/audio_streamview.cc2
-rw-r--r--gtk2_ardour/editor_actions.cc48
-rw-r--r--gtk2_ardour/editor_markers.cc8
-rw-r--r--gtk2_ardour/editor_ops.cc4
-rw-r--r--gtk2_ardour/editor_rulers.cc12
-rw-r--r--gtk2_ardour/ghostregion.h1
-rw-r--r--gtk2_ardour/midi_port_dialog.cc2
-rw-r--r--gtk2_ardour/option_editor.cc1430
-rw-r--r--gtk2_ardour/option_editor.h468
-rw-r--r--gtk2_ardour/selection.cc1
-rw-r--r--gtk2_ardour/sfdb_ui.cc3
-rw-r--r--gtk2_ardour/sfdb_ui.h2
-rw-r--r--gtk2_ardour/ui_config.h54
-rw-r--r--gtk2_ardour/wscript1
-rw-r--r--libs/ardour/ardour/ardour.h1
-rw-r--r--libs/ardour/ardour/audio_diskstream.h1
-rw-r--r--libs/ardour/ardour/broadcast_info.h2
-rw-r--r--libs/ardour/ardour/configuration.h73
-rw-r--r--libs/ardour/ardour/configuration_variable.h120
-rw-r--r--libs/ardour/ardour/diskstream.h1
-rw-r--r--libs/ardour/ardour/midi_diskstream.h1
-rw-r--r--libs/ardour/ardour/session.h12
-rw-r--r--libs/ardour/ardour/session_object.h1
-rw-r--r--libs/ardour/ardour/sndfilesource.h2
-rw-r--r--libs/ardour/ardour/types.h1
-rw-r--r--libs/ardour/ardour/utils.h14
-rw-r--r--libs/ardour/audio_diskstream.cc10
-rw-r--r--libs/ardour/audio_playlist.cc20
-rw-r--r--libs/ardour/audio_track.cc2
-rw-r--r--libs/ardour/audioregion.cc4
-rw-r--r--libs/ardour/auditioner.cc16
-rw-r--r--libs/ardour/broadcast_info.cc8
-rw-r--r--libs/ardour/configuration.cc342
-rw-r--r--libs/ardour/crossfade.cc4
-rw-r--r--libs/ardour/globals.cc6
-rw-r--r--libs/ardour/midi_diskstream.cc10
-rw-r--r--libs/ardour/midi_track.cc2
-rw-r--r--libs/ardour/playlist.cc15
-rw-r--r--libs/ardour/playlist_factory.cc1
-rw-r--r--libs/ardour/route.cc2
-rw-r--r--libs/ardour/session.cc14
-rw-r--r--libs/ardour/session_events.cc4
-rw-r--r--libs/ardour/session_midi.cc6
-rw-r--r--libs/ardour/session_process.cc4
-rw-r--r--libs/ardour/session_state.cc52
-rw-r--r--libs/ardour/session_time.cc12
-rw-r--r--libs/ardour/session_transport.cc18
-rw-r--r--libs/ardour/sndfilesource.cc8
-rw-r--r--libs/ardour/source_factory.cc7
-rw-r--r--libs/ardour/track.cc2
-rw-r--r--libs/ardour/utils.cc13
-rw-r--r--libs/ardour/wscript2
-rw-r--r--libs/surfaces/control_protocol/basic_ui.cc4
-rw-r--r--libs/surfaces/control_protocol/control_protocol/smpte.h14
-rw-r--r--libs/surfaces/control_protocol/smpte.cc48
65 files changed, 812 insertions, 2378 deletions
diff --git a/.gitignore b/.gitignore
index 94ff974360..c63535e8d0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc
index 9059ba2776..74daa23a9a 100644
--- a/gtk2_ardour/actions.cc
+++ b/gtk2_ardour/actions.cc
@@ -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);
+ }
+ }
+ }
+}
diff --git a/gtk2_ardour/actions.h b/gtk2_ardour/actions.h
index c7175d1891..3a20f4d542 100644
--- a/gtk2_ardour/actions.h
+++ b/gtk2_ardour/actions.h
@@ -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);
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index b8478d222a..999f3d3872 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -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;
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index 81e0e0da5c..f01e2a6bf9 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -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 */
diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc
index f2fb31ddbf..92fadd198b 100644
--- a/gtk2_ardour/ardour_ui2.cc
+++ b/gtk2_ardour/ardour_ui2.cc
@@ -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);
diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc
index 3fa662d589..37e1a23c21 100644
--- a/gtk2_ardour/ardour_ui_dialogs.cc
+++ b/gtk2_ardour/ardour_ui_dialogs.cc
@@ -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 ();
}
}
}
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc
index 870cb5ff97..1e6381ed67 100644
--- a/gtk2_ardour/ardour_ui_ed.cc
+++ b/gtk2_ardour/ardour_ui_ed.cc
@@ -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");
diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc
index f47f4c9079..d5ad849a9c 100644
--- a/gtk2_ardour/ardour_ui_options.cc
+++ b/gtk2_ardour/ardour_ui_options.cc
@@ -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);
}
diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc
index 372dd84e41..ca8090dcc4 100644
--- a/gtk2_ardour/audio_region_view.cc
+++ b/gtk2_ardour/audio_region_view.cc
@@ -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();
}
diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc
index 772b455f97..19e2e2368b 100644
--- a/gtk2_ardour/audio_streamview.cc
+++ b/gtk2_ardour/audio_streamview.cc
@@ -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 ();
}
}
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index f1c4e4b184..e84a4bfffe 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -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
diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc
index 489b6e8cbc..d849f7b971 100644
--- a/gtk2_ardour/editor_markers.cc
+++ b/gtk2_ardour/editor_markers.cc
@@ -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) {
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 7e1a303e73..a9cc7ae7d6 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -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);
diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc
index 0998b86bd9..4daf57d3ae 100644
--- a/gtk2_ardour/editor_rulers.cc
+++ b/gtk2_ardour/editor_rulers.cc
@@ -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;
diff --git a/gtk2_ardour/ghostregion.h b/gtk2_ardour/ghostregion.h
index 8328bc0c06..8b9f0d1093 100644
--- a/gtk2_ardour/ghostregion.h
+++ b/gtk2_ardour/ghostregion.h
@@ -23,7 +23,6 @@
#include <vector>
#include <sigc++/signal.h>
#include <libgnomecanvasmm.h>
-#include "ardour/configuration.h"
#include "canvas.h"
namespace Gnome {
diff --git a/gtk2_ardour/midi_port_dialog.cc b/gtk2_ardour/midi_port_dialog.cc
index 6e692c6eac..d118f1dd8f 100644
--- a/gtk2_ardour/midi_port_dialog.cc
+++ b/gtk2_ardour/midi_port_dialog.cc
@@ -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
diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc
index b1bff9c5ff..5920475bd7 100644
--- a/gtk2_ardour/option_editor.cc
+++ b/gtk2_ardour/option_editor.cc
@@ -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
@@ -16,1412 +16,168 @@
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 ();
}
diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h
index 802a088e20..5b22cf4cc5 100644
--- a/gtk2_ardour/option_editor.h
+++ b/gtk2_ardour/option_editor.h
@@ -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
@@ -20,218 +17,307 @@
*/
-#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__ */
diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc
index 92546e5ef4..28b5934c22 100644
--- a/gtk2_ardour/selection.cc
+++ b/gtk2_ardour/selection.cc
@@ -23,6 +23,7 @@
#include "pbd/stacktrace.h"
#include "ardour/playlist.h"
+#include "ardour/rc_configuration.h"
#include "region_view.h"
#include "selection.h"
diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc
index 8ca66fb530..98dd328f55 100644
--- a/gtk2_ardour/sfdb_ui.cc
+++ b/gtk2_ardour/sfdb_ui.cc
@@ -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);
diff --git a/gtk2_ardour/sfdb_ui.h b/gtk2_ardour/sfdb_ui.h
index 52676c2d4b..d9d0322532 100644
--- a/gtk2_ardour/sfdb_ui.h
+++ b/gtk2_ardour/sfdb_ui.h
@@ -36,12 +36,14 @@
#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;
diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h
index e3b7d26cd3..da1ebd3784 100644
--- a/gtk2_ardour/ui_config.h
+++ b/gtk2_ardour/ui_config.h
@@ -26,15 +26,14 @@
#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
diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript
index e404672a21..85e5299b51 100644
--- a/gtk2_ardour/wscript
+++ b/gtk2_ardour/wscript
@@ -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
diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h
index 7358a7bddb..630bde675c 100644
--- a/libs/ardour/ardour/ardour.h
+++ b/libs/ardour/ardour/ardour.h
@@ -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
diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h
index be95d737fb..187c97b3e6 100644
--- a/libs/ardour/ardour/audio_diskstream.h
+++ b/libs/ardour/ardour/audio_diskstream.h
@@ -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"
diff --git a/libs/ardour/ardour/broadcast_info.h b/libs/ardour/ardour/broadcast_info.h
index 8dfb697d08..39ea96c590 100644
--- a/libs/ardour/ardour/broadcast_info.h
+++ b/libs/ardour/ardour/broadcast_info.h
@@ -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 */
diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h
index e8d2685aa1..68944e92e6 100644
--- a/libs/ardour/ardour/configuration.h
+++ b/libs/ardour/ardour/configuration.h
@@ -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
@@ -20,16 +20,7 @@
#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__ */
diff --git a/libs/ardour/ardour/configuration_variable.h b/libs/ardour/ardour/configuration_variable.h
index 57db525017..6282da2c54 100644
--- a/libs/ardour/ardour/configuration_variable.h
+++ b/libs/ardour/ardour/configuration_variable.h
@@ -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;
}
diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h
index a78f2e23a7..f6471e300a 100644
--- a/libs/ardour/ardour/diskstream.h
+++ b/libs/ardour/ardour/diskstream.h
@@ -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"
diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h
index d5c2d0cdb3..872ffb78e3 100644
--- a/libs/ardour/ardour/midi_diskstream.h
+++ b/libs/ardour/ardour/midi_diskstream.h
@@ -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"
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 344b79bcd1..fc879b45a3 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -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;
diff --git a/libs/ardour/ardour/session_object.h b/libs/ardour/ardour/session_object.h
index 1a6a79ceee..7a05ab16b0 100644
--- a/libs/ardour/ardour/session_object.h
+++ b/libs/ardour/ardour/session_object.h
@@ -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
diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h
index d50dbad664..7d04e7de25 100644
--- a/libs/ardour/ardour/sndfilesource.h
+++ b/libs/ardour/ardour/sndfilesource.h
@@ -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);
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index 2ed5e0e365..cdec0c5fab 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -336,6 +336,7 @@ namespace ARDOUR {
};
enum AutoConnectOption {
+ ManualConnect = 0x0,
AutoConnectPhysical = 0x1,
AutoConnectMaster = 0x2
};
diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h
index eecde2e85f..fc5d98115f 100644
--- a/libs/ardour/ardour/utils.h
+++ b/libs/ardour/ardour/utils.h
@@ -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);
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index bb74d5fc16..910239f630 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -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());
diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc
index ef2cf281ef..6439c1b917 100644
--- a/libs/ardour/audio_playlist.cc
+++ b/libs/ardour/audio_playlist.cc
@@ -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);
}
}
diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc
index 4a3fa04d1c..878ad1118f 100644
--- a/libs/ardour/audio_track.cc
+++ b/libs/ardour/audio_track.cc
@@ -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)
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index f3fbbe6c1c..197af86d13 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -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 */
diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc
index a0abe860fb..b62d0f3406 100644
--- a/libs/ardour/auditioner.cc
+++ b/libs/ardour/auditioner.cc
@@ -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 ("");
}
}
}
diff --git a/libs/ardour/broadcast_info.cc b/libs/ardour/broadcast_info.cc
index bb8aedae88..1144aaa2cd 100644
--- a/libs/ardour/broadcast_info.cc
+++ b/libs/ardour/broadcast_info.cc
@@ -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,
diff --git a/libs/ardour/configuration.cc b/libs/ardour/configuration.cc
index bff9fb16d6..79f36c86d8 100644
--- a/libs/ardour/configuration.cc
+++ b/libs/ardour/configuration.cc
@@ -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
@@ -17,332 +17,90 @@
*/
-#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)
diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc
index c258a9bf73..62169a48df 100644
--- a/libs/ardour/crossfade.cc
+++ b/libs/ardour/crossfade.cc
@@ -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) {
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index 722c0fad49..1e17b3aeb9 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -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;
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc
index 6eaf01c819..30b1542974 100644
--- a/libs/ardour/midi_diskstream.cc
+++ b/libs/ardour/midi_diskstream.cc
@@ -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());
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index 6697e3b704..6feb3253ce 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -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)
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index a78addf481..4942485a70 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -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 ();
}
diff --git a/libs/ardour/playlist_factory.cc b/libs/ardour/playlist_factory.cc
index 4da4c1b192..7088fa67a3 100644
--- a/libs/ardour/playlist_factory.cc
+++ b/libs/ardour/playlist_factory.cc
@@ -18,6 +18,7 @@
*/
#include "pbd/error.h"
+#include "pbd/xml++.h"
#include "ardour/playlist.h"
#include "ardour/audioplaylist.h"
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index db06368371..06b9308d35 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -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());
/* -------------------------------------------------------------------------------------------
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 3105b776dc..02f868a4c0 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -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;
diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc
index 06f4598af7..d631eda710 100644
--- a/libs/ardour/session_events.cc
+++ b/libs/ardour/session_events.cc
@@ -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;
diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc
index b0d6ed9347..6c0c48f50e 100644
--- a/libs/ardour/session_midi.cc
+++ b/libs/ardour/session_midi.cc
@@ -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;
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index eb192f6dc9..eb986a3d83 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -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) {
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 7d14035c93..c7cb3fc5a1 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -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")) {
diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc
index 264ce10c82..223c30bd1a 100644
--- a/libs/ardour/session_time.cc
+++ b/libs/ardour/session_time.cc
@@ -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;
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index 790d990bc2..ccdbbb3ef6 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -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 {
diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc
index 6002f95cb9..234f55f30b 100644
--- a/libs/ardour/sndfilesource.cc
+++ b/libs/ardour/sndfilesource.cc
@@ -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;
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc
index d6ce7ba033..544b04e1c7 100644
--- a/libs/ardour/source_factory.cc
+++ b/libs/ardour/source_factory.cc
@@ -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)
diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc
index fd9267ede4..fa3193cba3 100644
--- a/libs/ardour/track.cc
+++ b/libs/ardour/track.cc
@@ -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;
diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc
index 7320f3c7f3..052d583976 100644
--- a/libs/ardour/utils.cc
+++ b/libs/ardour/utils.cc
@@ -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)
{
diff --git a/libs/ardour/wscript b/libs/ardour/wscript
index 85187680d8..7079a64a08 100644
--- a/libs/ardour/wscript
+++ b/libs/ardour/wscript
@@ -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
diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc
index a0eeda5a96..2eda08acf7 100644
--- a/libs/surfaces/control_protocol/basic_ui.cc
+++ b/libs/surfaces/control_protocol/basic_ui.cc
@@ -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
diff --git a/libs/surfaces/control_protocol/control_protocol/smpte.h b/libs/surfaces/control_protocol/control_protocol/smpte.h
index b25a268aac..7493ccf85f 100644
--- a/libs/surfaces/control_protocol/control_protocol/smpte.h
+++ b/libs/surfaces/control_protocol/control_protocol/smpte.h
@@ -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 );
diff --git a/libs/surfaces/control_protocol/smpte.cc b/libs/surfaces/control_protocol/smpte.cc
index 5df159a52b..969c3385bc 100644
--- a/libs/surfaces/control_protocol/smpte.cc
+++ b/libs/surfaces/control_protocol/smpte.cc
@@ -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;