From 015fc7b39fab97cee1875231694adce43155ceb5 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 14 May 2009 00:13:27 +0000 Subject: First stage of options rework. - Split Configuration into RCConfiguration and SessionConfiguration; the first for options which are saved to .rc files and the second for options which are saved in a session file. - Move some options from the old `master' Configuration object into SessionConfiguration; this needs more refinement. - Reflect many RCConfiguration options in an expanded Edit->Preferences dialog; my intention is to remove the corresponding menu items eventually. git-svn-id: svn://localhost/ardour2/branches/3.0@5075 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/actions.cc | 30 +- gtk2_ardour/actions.h | 9 +- gtk2_ardour/ardour_ui.cc | 17 +- gtk2_ardour/ardour_ui.h | 9 +- gtk2_ardour/ardour_ui2.cc | 2 +- gtk2_ardour/ardour_ui_dialogs.cc | 26 +- gtk2_ardour/ardour_ui_ed.cc | 6 +- gtk2_ardour/ardour_ui_options.cc | 166 ++--- gtk2_ardour/audio_region_view.cc | 8 +- gtk2_ardour/audio_streamview.cc | 2 +- gtk2_ardour/editor_actions.cc | 48 +- gtk2_ardour/editor_markers.cc | 8 +- gtk2_ardour/editor_ops.cc | 4 +- gtk2_ardour/editor_rulers.cc | 12 +- gtk2_ardour/ghostregion.h | 1 - gtk2_ardour/midi_port_dialog.cc | 2 +- gtk2_ardour/option_editor.cc | 1430 +++----------------------------------- gtk2_ardour/option_editor.h | 468 ++++++++----- gtk2_ardour/selection.cc | 1 + gtk2_ardour/sfdb_ui.cc | 3 +- gtk2_ardour/sfdb_ui.h | 2 + gtk2_ardour/ui_config.h | 54 +- gtk2_ardour/wscript | 1 + 23 files changed, 570 insertions(+), 1739 deletions(-) (limited to 'gtk2_ardour') 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 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 theSlot) +ActionManager::toggle_config_state_foo (const char* group, const char* action, sigc::slot set, sigc::slot get) { Glib::RefPtr act = ActionManager::get_action (group, action); if (act) { Glib::RefPtr tact = Glib::RefPtr::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 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 get) +{ + Glib::RefPtr act = ActionManager::get_action (group, action); + if (act) { + Glib::RefPtr tact = Glib::RefPtr::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 #include -#include "ardour/configuration.h" +#include "ardour/rc_configuration.h" namespace Gtk { class UIManager; @@ -59,9 +59,10 @@ class ActionManager static std::vector > jack_opposite_sensitive_actions; static std::vector > 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 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); + 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, sigc::slot); static void set_sensitive (std::vector >& 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 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 #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_("/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_("/Common/ToggleOptionsEditor"))); + rc_option_editor->set_session (session); } RefPtr act = ActionManager::get_action (X_("Common"), X_("ToggleOptionsEditor")); @@ -244,10 +236,10 @@ ARDOUR_UI::toggle_options_window () RefPtr tact = RefPtr::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 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 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 ract = Glib::RefPtr::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 ract = Glib::RefPtr::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) 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 ract = RefPtr::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 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 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 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 act; switch (model) { @@ -1204,8 +1208,8 @@ Editor::set_layer_model (LayerModel model) if (act) { RefPtr ract = RefPtr::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 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 ract = RefPtr::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(*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(*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 #include #include -#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 // for fontmap resolution control for GnomeCanvas -#include // for fontmap resolution control for GnomeCanvas -#include "pbd/whitespace.h" - -#include "ardour/ardour.h" -#include "ardour/session.h" -#include "ardour/audioengine.h" +#include +#include #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 -#include -#include - -#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 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 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::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 << "" << h << ""; + _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 g, slot 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 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 strs; + set_border_width (4); - for (std::map::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::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::iterator i = _pages.begin(); i != _pages.end(); ++i) { + for (std::list::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::iterator i = _pages.begin(); i != _pages.end(); ++i) { + for (std::list::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 +#ifndef __gtk_ardour_option_editor_h__ +#define __gtk_ardour_option_editor_h__ #include #include -#include -#include -#include -#include -#include -#include -#include -#include #include - -#include "ardour/session.h" - +#include +#include #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 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, sigc::slot); + void set_state_from_config (); + void toggled (); + void add_to_page (OptionEditorPage*); + +private: + + sigc::slot _get; ///< slot to get the configuration variable's value + sigc::slot _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 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 g, + sigc::slot 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 _get; + sigc::slot _set; + Gtk::Label* _label; + Gtk::ComboBoxText* _combo; + std::vector _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 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 g, + sigc::slot 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 (_spin->get_value ())); + } + +private: + sigc::slot _get; + sigc::slot _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 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 > 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 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 _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 #include #include +#include #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 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 -- cgit v1.2.3