Add session preferences dialog.

git-svn-id: svn://localhost/ardour2/branches/3.0@5082 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-05-16 01:22:43 +00:00
parent f4e6f8fec5
commit 29e8fe1698
24 changed files with 436 additions and 155 deletions

View File

@ -29,8 +29,10 @@
<menuitem action='FlushWastebasket'/>
</menu>
<separator/>
<menuitem action='ToggleSessionOptionsEditor'/>
<separator/>
#ifdef GTKOSX
<menuitem action='ToggleOptionsEditor'/>
<menuitem action='ToggleRCOptionsEditor'/>
<menuitem action='About'/>
#endif
<menuitem action='Quit'/>
@ -220,7 +222,7 @@
</menu>
#ifndef GTKOSX
<separator/>
<menuitem action='ToggleOptionsEditor'/>
<menuitem action='ToggleRCOptionsEditor'/>
#endif
</menu>

View File

@ -199,6 +199,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
add_route_dialog = 0;
route_params = 0;
rc_option_editor = 0;
session_option_editor = 0;
location_ui = 0;
open_session_selector = 0;
have_configure_timeout = false;

View File

@ -71,6 +71,7 @@ class AudioClock;
class PublicEditor;
class Keyboard;
class RCOptionEditor;
class SessionOptionEditor;
class KeyEditor;
class Mixer_UI;
class ConnectionEditor;
@ -257,6 +258,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
void toggle_session_auto_loop ();
void toggle_rc_options_window ();
void toggle_session_options_window ();
private:
ArdourStartup* _startup;
@ -600,6 +602,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI
RCOptionEditor *rc_option_editor;
SessionOptionEditor *session_option_editor;
/* route dialog */
AddRouteDialog *add_route_dialog;
@ -726,7 +730,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
void map_input_auto_connect ();
void map_output_auto_connect ();
void map_only_copy_imported_files ();
void parameter_changed (const char*);
void parameter_changed (std::string);
void set_meter_hold (ARDOUR::MeterHold);
void set_meter_falloff (ARDOUR::MeterFalloff);

View File

@ -30,6 +30,7 @@
#include "location_ui.h"
#include "mixer_ui.h"
#include "rc_option_editor.h"
#include "session_option_editor.h"
#include "public_editor.h"
#include "route_params_ui.h"
#include "sfdb_ui.h"
@ -227,11 +228,11 @@ ARDOUR_UI::toggle_rc_options_window ()
{
if (rc_option_editor == 0) {
rc_option_editor = new RCOptionEditor;
rc_option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleOptionsEditor")));
rc_option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleRCOptionsEditor")));
rc_option_editor->set_session (session);
}
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleOptionsEditor"));
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleRCOptionsEditor"));
if (act) {
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
@ -244,6 +245,27 @@ ARDOUR_UI::toggle_rc_options_window ()
}
}
void
ARDOUR_UI::toggle_session_options_window ()
{
if (session_option_editor == 0) {
session_option_editor = new SessionOptionEditor (session);
session_option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleSessionOptionsEditor")));
}
RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleSessionOptionsEditor"));
if (act) {
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act);
if (tact->get_active()) {
session_option_editor->show_all ();
session_option_editor->present ();
} else {
session_option_editor->hide ();
}
}
}
int
ARDOUR_UI::create_location_ui ()
{

View File

@ -202,7 +202,8 @@ 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_rc_options_window));
ActionManager::register_toggle_action (common_actions, X_("ToggleRCOptionsEditor"), _("Preferences"), mem_fun(*this, &ARDOUR_UI::toggle_rc_options_window));
ActionManager::register_toggle_action (common_actions, X_("ToggleSessionOptionsEditor"), _("Preferences"), mem_fun(*this, &ARDOUR_UI::toggle_session_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);

View File

@ -1075,13 +1075,11 @@ ARDOUR_UI::set_meter_falloff (MeterFalloff val)
}
void
ARDOUR_UI::parameter_changed (const char* parameter_name)
ARDOUR_UI::parameter_changed (std::string p)
{
ENSURE_GUI_THREAD (bind (mem_fun (*this, &ARDOUR_UI::parameter_changed), parameter_name));
ENSURE_GUI_THREAD (bind (mem_fun (*this, &ARDOUR_UI::parameter_changed), p));
#define PARAM_IS(x) (!strcmp (parameter_name, (x)))
if (PARAM_IS ("slave-source")) {
if (p == "slave-source") {
sync_option_combo.set_active_text (slave_source_to_string (Config->get_slave_source()));
@ -1098,15 +1096,15 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
break;
}
} else if (PARAM_IS ("send-mtc")) {
} else if (p == "send-mtc") {
ActionManager::map_some_state ("options", "SendMTC", &RCConfiguration::get_send_mtc);
} else if (PARAM_IS ("send-mmc")) {
} else if (p == "send-mmc") {
ActionManager::map_some_state ("options", "SendMMC", &RCConfiguration::get_send_mmc);
} else if (PARAM_IS ("use-osc")) {
} else if (p == "use-osc") {
#ifdef HAVE_LIBLO
if (Config->get_use_osc()) {
@ -1118,75 +1116,75 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
ActionManager::map_some_state ("options", "UseOSC", &RCConfiguration::get_use_osc);
} else if (PARAM_IS ("mmc-control")) {
} else if (p == "mmc-control") {
ActionManager::map_some_state ("options", "UseMMC", &RCConfiguration::get_mmc_control);
} else if (PARAM_IS ("midi-feedback")) {
} else if (p == "midi-feedback") {
ActionManager::map_some_state ("options", "SendMIDIfeedback", &RCConfiguration::get_midi_feedback);
} else if (PARAM_IS ("do-not-record-plugins")) {
} else if (p == "do-not-record-plugins") {
ActionManager::map_some_state ("options", "DoNotRunPluginsWhileRecording", &RCConfiguration::get_do_not_record_plugins);
} else if (PARAM_IS ("latched-record-enable")) {
} else if (p == "latched-record-enable") {
ActionManager::map_some_state ("options", "LatchedRecordEnable", &RCConfiguration::get_latched_record_enable);
} else if (PARAM_IS ("solo-latched")) {
} else if (p == "solo-latched") {
ActionManager::map_some_state ("options", "LatchedSolo", &RCConfiguration::get_solo_latched);
} else if (PARAM_IS ("show-solo-mutes")) {
} else if (p == "show-solo-mutes") {
ActionManager::map_some_state ("options", "ShowSoloMutes", &RCConfiguration::get_show_solo_mutes);
} else if (PARAM_IS ("solo-mute-override")) {
} else if (p == "solo-mute-override") {
ActionManager::map_some_state ("options", "SoloMuteOverride", &RCConfiguration::get_solo_mute_override);
} else if (PARAM_IS ("solo-model")) {
} else if (p == "solo-model") {
map_solo_model ();
} else if (PARAM_IS ("auto-play")) {
} else if (p == "auto-play") {
ActionManager::map_some_state ("Transport", "ToggleAutoPlay", mem_fun (session->config, &SessionConfiguration::get_auto_play));
} else if (PARAM_IS ("auto-return")) {
} else if (p == "auto-return") {
ActionManager::map_some_state ("Transport", "ToggleAutoReturn", mem_fun (session->config, &SessionConfiguration::get_auto_return));
} else if (PARAM_IS ("auto-input")) {
} else if (p == "auto-input") {
ActionManager::map_some_state ("Transport", "ToggleAutoInput", mem_fun (session->config, &SessionConfiguration::get_auto_input));
} else if (PARAM_IS ("tape-machine-mode")) {
} else if (p == "tape-machine-mode") {
ActionManager::map_some_state ("options", "ToggleTapeMachineMode", &RCConfiguration::get_tape_machine_mode);
} else if (PARAM_IS ("punch-out")) {
} else if (p == "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")) {
} else if (p == "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")) {
} else if (p == "clicking") {
ActionManager::map_some_state ("Transport", "ToggleClick", &RCConfiguration::get_clicking);
} else if (PARAM_IS ("jack-time-master")) {
} else if (p == "jack-time-master") {
ActionManager::map_some_state ("Transport", "ToggleTimeMaster", &RCConfiguration::get_jack_time_master);
} else if (PARAM_IS ("plugins-stop-with-transport")) {
} else if (p == "plugins-stop-with-transport") {
ActionManager::map_some_state ("options", "StopPluginsWithTransport", &RCConfiguration::get_plugins_stop_with_transport);
} else if (PARAM_IS ("new-plugins-active")) {
} else if (p == "new-plugins-active") {
ActionManager::map_some_state ("options", "NewPluginsActive", &RCConfiguration::get_new_plugins_active);
} else if (PARAM_IS ("latched-record-enable")) {
} else if (p == "latched-record-enable") {
ActionManager::map_some_state ("options", "LatchedRecordEnable", &RCConfiguration::get_latched_record_enable);
} else if (PARAM_IS ("verify-remove-last-capture")) {
} else if (p == "verify-remove-last-capture") {
ActionManager::map_some_state ("options", "VerifyRemoveLastCapture", &RCConfiguration::get_verify_remove_last_capture);
} else if (PARAM_IS ("periodic-safety-backups")) {
} else if (p == "periodic-safety-backups") {
ActionManager::map_some_state ("options", "PeriodicSafetyBackups", &RCConfiguration::get_periodic_safety_backups);
} else if (PARAM_IS ("stop-recording-on-xrun")) {
} else if (p == "stop-recording-on-xrun") {
ActionManager::map_some_state ("options", "StopRecordingOnXrun", &RCConfiguration::get_stop_recording_on_xrun);
} else if (PARAM_IS ("create-xrun-marker")) {
} else if (p == "create-xrun-marker") {
ActionManager::map_some_state ("options", "CreateXrunMarker", &RCConfiguration::get_create_xrun_marker);
} else if (PARAM_IS ("sync-all-route-ordering")) {
} else if (p == "sync-all-route-ordering") {
ActionManager::map_some_state ("options", "SyncEditorAndMixerTrackOrder", &RCConfiguration::get_sync_all_route_ordering);
} else if (PARAM_IS ("stop-at-session-end")) {
} else if (p == "stop-at-session-end") {
ActionManager::map_some_state ("options", "StopTransportAtEndOfSession", &RCConfiguration::get_stop_at_session_end);
} else if (PARAM_IS ("monitoring-model")) {
} else if (p == "monitoring-model") {
map_monitor_model ();
} else if (PARAM_IS ("denormal-model")) {
} else if (p == "denormal-model") {
map_denormal_model ();
} else if (PARAM_IS ("denormal-protection")) {
} else if (p == "denormal-protection") {
map_denormal_protection ();
} else if (PARAM_IS ("remote-model")) {
} else if (p == "remote-model") {
map_remote_model ();
} else if (PARAM_IS ("use-video-sync")) {
} else if (p == "use-video-sync") {
ActionManager::map_some_state ("Transport", "ToggleVideoSync", &RCConfiguration::get_use_video_sync);
} else if (PARAM_IS ("quieten-at-speed")) {
} else if (p == "quieten-at-speed") {
ActionManager::map_some_state ("options", "GainReduceFastTransport", &RCConfiguration::get_quieten_at_speed);
} else if (PARAM_IS ("shuttle-behaviour")) {
} else if (p == "shuttle-behaviour") {
switch (Config->get_shuttle_behaviour ()) {
case Sprung:
@ -1205,7 +1203,7 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
break;
}
} else if (PARAM_IS ("shuttle-units")) {
} else if (p == "shuttle-units") {
switch (Config->get_shuttle_units()) {
case Percentage:
@ -1215,19 +1213,19 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
shuttle_units_button.set_label(_("ST"));
break;
}
} else if (PARAM_IS ("input-auto-connect")) {
} else if (p == "input-auto-connect") {
map_input_auto_connect ();
} else if (PARAM_IS ("output-auto-connect")) {
} else if (p == "output-auto-connect") {
map_output_auto_connect ();
} else if (PARAM_IS ("native-file-header-format")) {
} else if (p == "native-file-header-format") {
map_file_header_format ();
} else if (PARAM_IS ("native-file-data-format")) {
} else if (p == "native-file-data-format") {
map_file_data_format ();
} else if (PARAM_IS ("meter-hold")) {
} else if (p == "meter-hold") {
map_meter_hold ();
} else if (PARAM_IS ("meter-falloff")) {
} else if (p == "meter-falloff") {
map_meter_falloff ();
} else if (PARAM_IS ("video-pullup") || PARAM_IS ("smpte-format")) {
} else if (p == "video-pullup" || p == "smpte-format") {
if (session) {
primary_clock.set (session->audible_frame(), true);
secondary_clock.set (session->audible_frame(), true);
@ -1235,24 +1233,20 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
primary_clock.set (0, true);
secondary_clock.set (0, true);
}
} else if (PARAM_IS ("use-overlap-equivalency")) {
} else if (p == "use-overlap-equivalency") {
ActionManager::map_some_state ("options", "RegionEquivalentsOverlap", &RCConfiguration::get_use_overlap_equivalency);
} else if (PARAM_IS ("primary-clock-delta-edit-cursor")) {
} else if (p == "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")) {
} else if (p == "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")) {
} else if (p == "only-copy-imported-files") {
map_only_copy_imported_files ();
} else if (PARAM_IS ("show-track-meters")) {
} else if (p == "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")) {
} else if (p == "default-narrow_ms") {
ActionManager::map_some_state ("options", "DefaultNarrowMS", &RCConfiguration::get_default_narrow_ms);
} else if (PARAM_IS ("rubberbanding-snaps-to-grid")) {
} else if (p =="rubberbanding-snaps-to-grid") {
ActionManager::map_some_state ("options", "RubberbandingSnapsToGrid", &RCConfiguration::get_rubberbanding_snaps_to_grid);
}
#undef PARAM_IS
}

View File

@ -1289,6 +1289,7 @@ Editor::connect_to_session (Session *t)
session_connections.push_back (session->tempo_map().StateChanged.connect (mem_fun(*this, &Editor::tempo_map_changed)));
session_connections.push_back (session->Located.connect (mem_fun (*this, &Editor::located)));
session_connections.push_back (session->config.ParameterChanged.connect (mem_fun (*this, &Editor::parameter_changed)));
edit_groups_changed ();

View File

@ -620,7 +620,7 @@ class Editor : public PublicEditor
ArdourCanvas::Text* verbose_canvas_cursor;
bool verbose_cursor_visible;
void parameter_changed (const char *);
void parameter_changed (std::string);
bool track_canvas_motion (GdkEvent*);

View File

@ -1774,53 +1774,49 @@ Editor::toggle_automation_follows_regions ()
* @param parameter_name Name of the changed parameter.
*/
void
Editor::parameter_changed (const char* parameter_name)
Editor::parameter_changed (std::string p)
{
#define PARAM_IS(x) (!strcmp (parameter_name, (x)))
//cerr << "Editor::parameter_changed: " << parameter_name << endl;
ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::parameter_changed), parameter_name));
ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::parameter_changed), p));
if (PARAM_IS ("auto-loop")) {
if (p == "auto-loop") {
update_loop_range_view (true);
} else if (PARAM_IS ("punch-in")) {
} else if (p == "punch-in") {
update_punch_range_view (true);
} else if (PARAM_IS ("punch-out")) {
} else if (p == "punch-out") {
update_punch_range_view (true);
} else if (PARAM_IS ("layer-model")) {
} else if (p == "layer-model") {
update_layering_model ();
} else if (PARAM_IS ("smpte-format")) {
} else if (p == "smpte-format") {
update_smpte_mode ();
update_just_smpte ();
} else if (PARAM_IS ("video-pullup")) {
} else if (p == "video-pullup") {
update_video_pullup ();
} else if (PARAM_IS ("xfades-active")) {
} else if (p == "xfades-active") {
ActionManager::map_some_state ("Editor", "toggle-xfades-active", mem_fun (session->config, &SessionConfiguration::get_xfades_active));
} else if (PARAM_IS ("xfades-visible")) {
} else if (p == "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")) {
} else if (p == "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")) {
} else if (p == "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")) {
} else if (p == "auto-xfade") {
ActionManager::map_some_state ("Editor", "toggle-auto-xfades", mem_fun (session->config, &SessionConfiguration::get_auto_xfade));
} else if (PARAM_IS ("xfade-model")) {
} else if (p == "xfade-model") {
update_crossfade_model ();
} else if (PARAM_IS ("edit-mode")) {
} else if (p == "edit-mode") {
edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode()));
} else if (PARAM_IS ("subframes-per-frame")) {
} else if (p == "subframes-per-frame") {
update_subframes_per_frame ();
update_just_smpte ();
} else if (PARAM_IS ("show-track-meters")) {
} else if (p == "show-track-meters") {
toggle_meter_updating();
} else if (PARAM_IS ("link-region-and-track-selection")) {
} else if (p == "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")) {
} else if (p == "automation-follows-regions") {
ActionManager::map_some_state ("Editor", "automation-follows-regions", &RCConfiguration::get_automation_follows_regions);
}
#undef PARAM_IS
}
void

View File

@ -112,13 +112,11 @@ LevelMeter::update_meters ()
}
void
LevelMeter::parameter_changed(const char* parameter_name)
LevelMeter::parameter_changed (string p)
{
#define PARAM_IS(x) (!strcmp (parameter_name, (x)))
ENSURE_GUI_THREAD (bind (mem_fun(*this, &LevelMeter::parameter_changed), p));
ENSURE_GUI_THREAD (bind (mem_fun(*this, &LevelMeter::parameter_changed), parameter_name));
if (PARAM_IS ("meter-hold")) {
if (p == "meter-hold") {
vector<MeterInfo>::iterator i;
uint32_t n;
@ -128,8 +126,6 @@ LevelMeter::parameter_changed(const char* parameter_name)
(*i).meter->set_hold_count ((uint32_t) floor(Config->get_meter_hold()));
}
}
#undef PARAM_IS
}
void

View File

@ -96,7 +96,7 @@ class LevelMeter : public Gtk::HBox
void hide_all_meters ();
gint meter_button_release (GdkEventButton*, uint32_t);
void parameter_changed (const char*);
void parameter_changed (std::string);
void configuration_changed (ARDOUR::ChanCount in, ARDOUR::ChanCount out);
void on_theme_changed ();

View File

@ -99,6 +99,35 @@ BoolOption::toggled ()
_set (_button->get_active ());
}
EntryOption::EntryOption (string const & i, string const & n, slot<string> g, slot<bool, string> s)
: Option (i, n),
_get (g),
_set (s)
{
_label = manage (new Label (n + ":"));
_label->set_alignment (1, 0.5);
_entry = manage (new Entry);
_entry->signal_activate().connect (mem_fun (*this, &EntryOption::activated));
}
void
EntryOption::add_to_page (OptionEditorPage* p)
{
add_widgets_to_page (p, _label, _entry);
}
void
EntryOption::set_state_from_config ()
{
_entry->set_text (_get ());
}
void
EntryOption::activated ()
{
_set (_entry->get_text ());
}
OptionEditorPage::OptionEditorPage (Gtk::Notebook& n, std::string const & t)
: table (1, 3)
{

View File

@ -145,16 +145,37 @@ public:
BoolOption (std::string const &, std::string const &, sigc::slot<bool>, sigc::slot<bool, bool>);
void set_state_from_config ();
void toggled ();
void add_to_page (OptionEditorPage*);
private:
void toggled ();
sigc::slot<bool> _get; ///< slot to get the configuration variable's value
sigc::slot<bool, bool> _set; ///< slot to set the configuration variable's value
Gtk::CheckButton* _button; ///< UI button
};
/** Component which provides the UI to handle a string option using a GTK Entry */
class EntryOption : public Option {
public:
EntryOption (std::string const &, std::string const &, sigc::slot<std::string>, sigc::slot<bool, std::string>);
void set_state_from_config ();
void add_to_page (OptionEditorPage*);
private:
void activated ();
sigc::slot<std::string> _get; ///< slot to get the configuration variable's value
sigc::slot<bool, std::string> _set; ///< slot to set the configuration variable's value
Gtk::Label* _label; ///< UI label
Gtk::Entry* _entry; ///< UI entry
};
/** Component which provides the UI to handle an enumerated option using a GTK CheckButton.
* The template parameter is the enumeration.
*/
@ -241,6 +262,8 @@ public:
* @param max Variable maximum value.
* @param step Step for the spin button.
* @param page Page step for the spin button.
* @param unit Unit name.
* @param scale Scaling factor (such that for a value x in the spinbutton, x * scale is written to the config)
*/
SpinOption (
std::string const & i,
@ -250,39 +273,53 @@ public:
T min,
T max,
T step,
T page
T page,
std::string const & unit = "",
float scale = 1
)
: Option (i, n),
_get (g),
_set (s)
_set (s),
_scale (scale)
{
_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);
_box = manage (new Gtk::HBox);
_box->pack_start (*_spin, true, true);
_box->set_spacing (4);
if (unit.length()) {
_box->pack_start (*manage (new Gtk::Label (unit)), false, false);
}
_spin->signal_value_changed().connect (sigc::mem_fun (*this, &SpinOption::changed));
}
void set_state_from_config ()
{
_spin->set_value (_get ());
_spin->set_value (_get () / _scale);
}
void add_to_page (OptionEditorPage* p)
{
add_widgets_to_page (p, _label, _spin);
add_widgets_to_page (p, _label, _box);
}
void changed ()
{
_set (static_cast<T> (_spin->get_value ()));
_set (static_cast<T> (_spin->get_value ()) * _scale);
}
private:
sigc::slot<T> _get;
sigc::slot<bool, T> _set;
float _scale;
Gtk::Label* _label;
Gtk::HBox* _box;
Gtk::SpinButton* _spin;
};
@ -314,6 +351,7 @@ protected:
ARDOUR::Configuration* _config;
private:
void parameter_changed (std::string const &);
Gtk::Notebook _notebook;

View File

@ -0,0 +1,181 @@
#include "ardour/session.h"
#include "session_option_editor.h"
#include "i18n.h"
using namespace sigc;
using namespace ARDOUR;
SessionOptionEditor::SessionOptionEditor (Session* s)
: OptionEditor (&(s->config), _("Session Preferences")),
_session_config (&(s->config))
{
/* FADES */
ComboOption<CrossfadeModel>* cfm = new ComboOption<CrossfadeModel> (
"xfade-model",
_("Crossfades are created"),
mem_fun (*_session_config, &SessionConfiguration::get_xfade_model),
mem_fun (*_session_config, &SessionConfiguration::set_xfade_model)
);
cfm->add (FullCrossfade, _("to span entire overlap"));
cfm->add (ShortCrossfade, _("short"));
add_option (_("Fades"), cfm);
add_option (_("Fades"), new SpinOption<float> (
_("short-xfade-seconds"),
_("Short crossfade length"),
mem_fun (*_session_config, &SessionConfiguration::get_short_xfade_seconds),
mem_fun (*_session_config, &SessionConfiguration::set_short_xfade_seconds),
0, 1000, 1, 10,
_("ms"), 0.001
));
add_option (_("Fades"), new SpinOption<float> (
_("destructive-xfade-seconds"),
_("Destructive crossfade length"),
mem_fun (*_session_config, &SessionConfiguration::get_destructive_xfade_msecs),
mem_fun (*_session_config, &SessionConfiguration::set_destructive_xfade_msecs),
0, 1000, 1, 10,
_("ms")
));
add_option (_("Fades"), new BoolOption (
"auto-xfade",
_("Create crossfades automatically"),
mem_fun (*_session_config, &SessionConfiguration::get_auto_xfade),
mem_fun (*_session_config, &SessionConfiguration::set_auto_xfade)
));
add_option (_("Fades"), new BoolOption (
"xfades-active",
_("Crossfades active"),
mem_fun (*_session_config, &SessionConfiguration::get_xfades_active),
mem_fun (*_session_config, &SessionConfiguration::set_xfades_active)
));
add_option (_("Fades"), new BoolOption (
"xfades-visible",
_("Crossfades visible"),
mem_fun (*_session_config, &SessionConfiguration::get_xfades_visible),
mem_fun (*_session_config, &SessionConfiguration::set_xfades_visible)
));
add_option (_("Fades"), new BoolOption (
"use-region-fades",
_("Region fades active"),
mem_fun (*_session_config, &SessionConfiguration::get_use_region_fades),
mem_fun (*_session_config, &SessionConfiguration::set_use_region_fades)
));
add_option (_("Fades"), new BoolOption (
"show-region-fades",
_("Region fades visible"),
mem_fun (*_session_config, &SessionConfiguration::get_show_region_fades),
mem_fun (*_session_config, &SessionConfiguration::set_show_region_fades)
));
/* SYNC */
ComboOption<uint32_t>* spf = new ComboOption<uint32_t> (
"subframes-per-frame",
_("Subframes per frame"),
mem_fun (*_session_config, &SessionConfiguration::get_subframes_per_frame),
mem_fun (*_session_config, &SessionConfiguration::set_subframes_per_frame)
);
spf->add (80, _("80"));
spf->add (100, _("100"));
add_option (_("Sync"), spf);
ComboOption<SmpteFormat>* smf = new ComboOption<SmpteFormat> (
"smpte-format",
_("Timecode frames-per-second"),
mem_fun (*_session_config, &SessionConfiguration::get_smpte_format),
mem_fun (*_session_config, &SessionConfiguration::set_smpte_format)
);
smf->add (smpte_23976, _("23.976"));
smf->add (smpte_24, _("24"));
smf->add (smpte_24976, _("24.976"));
smf->add (smpte_25, _("25"));
smf->add (smpte_2997, _("29.97"));
smf->add (smpte_2997drop, _("29.97 drop"));
smf->add (smpte_30, _("30"));
smf->add (smpte_30drop, _("30 drop"));
smf->add (smpte_5994, _("59.94"));
smf->add (smpte_60, _("60"));
add_option (_("Sync"), smf);
add_option (_("Sync"), new BoolOption (
"timecode-source-is-synced",
_("Timecode source is synced"),
mem_fun (*_session_config, &SessionConfiguration::get_timecode_source_is_synced),
mem_fun (*_session_config, &SessionConfiguration::set_timecode_source_is_synced)
));
/* MISC */
add_option (_("Misc"), new OptionEditorHeading (_("Audio file format")));
ComboOption<SampleFormat>* sf = new ComboOption<SampleFormat> (
"native-file-data-format",
_("Sample format"),
mem_fun (*_session_config, &SessionConfiguration::get_native_file_data_format),
mem_fun (*_session_config, &SessionConfiguration::set_native_file_data_format)
);
sf->add (FormatFloat, _("32-bit floating point"));
sf->add (FormatInt24, _("24-bit integer"));
sf->add (FormatInt16, _("16-bit integer"));
add_option (_("Misc"), sf);
ComboOption<HeaderFormat>* hf = new ComboOption<HeaderFormat> (
"native-file-header-format",
_("File type"),
mem_fun (*_session_config, &SessionConfiguration::get_native_file_header_format),
mem_fun (*_session_config, &SessionConfiguration::set_native_file_header_format)
);
hf->add (BWF, _("Broadcast WAVE"));
hf->add (WAVE, _("WAVE"));
hf->add (WAVE64, _("WAVE-64"));
hf->add (CAF, _("CAF"));
add_option (_("Misc"), hf);
add_option (_("Misc"), new OptionEditorHeading (_("Layering")));
ComboOption<LayerModel>* lm = new ComboOption<LayerModel> (
"layer-model",
_("Layering model"),
mem_fun (*_session_config, &SessionConfiguration::get_layer_model),
mem_fun (*_session_config, &SessionConfiguration::set_layer_model)
);
lm->add (LaterHigher, _("later is higher"));
lm->add (MoveAddHigher, _("most recently moved or added is higher"));
lm->add (AddHigher, _("most recently added is higher"));
add_option (_("Misc"), lm);
add_option (_("Misc"), new OptionEditorHeading (_("Broadcast WAVE metadata")));
add_option (_("Misc"), new EntryOption (
"bwf-country-code",
_("Country code"),
mem_fun (*_session_config, &SessionConfiguration::get_bwf_country_code),
mem_fun (*_session_config, &SessionConfiguration::set_bwf_country_code)
));
add_option (_("Misc"), new EntryOption (
"bwf-organization-code",
_("Organization code"),
mem_fun (*_session_config, &SessionConfiguration::get_bwf_organization_code),
mem_fun (*_session_config, &SessionConfiguration::set_bwf_organization_code)
));
}

View File

@ -0,0 +1,15 @@
#include "option_editor.h"
namespace ARDOUR {
class Session;
class SessionConfiguration;
}
class SessionOptionEditor : public OptionEditor
{
public:
SessionOptionEditor (ARDOUR::Session* s);
private:
ARDOUR::SessionConfiguration* _session_config;
};

View File

@ -193,6 +193,7 @@ def build(bld):
send_ui.cc
session_import_dialog.cc
session_metadata_dialog.cc
session_option_editor.cc
sfdb_ui.cc
simpleline.cc
simplerect.cc

View File

@ -33,13 +33,13 @@ class Configuration : public PBD::Stateful
Configuration();
virtual ~Configuration();
virtual void map_parameters (sigc::slot<void, const char *> s) = 0;
virtual void map_parameters (sigc::slot<void, std::string> s) = 0;
virtual int set_state (XMLNode const &) = 0;
virtual XMLNode & get_state () = 0;
virtual XMLNode & get_variables () = 0;
virtual void set_variables (XMLNode const &) = 0;
sigc::signal<void,const char*> ParameterChanged;
sigc::signal<void, std::string> ParameterChanged;
};
} // namespace ARDOUR

View File

@ -36,7 +36,7 @@ class RCConfiguration : public Configuration
public:
RCConfiguration();
void map_parameters (sigc::slot<void,const char*>);
void map_parameters (sigc::slot<void, std::string>);
int set_state (XMLNode const &);
XMLNode& get_state ();
XMLNode& get_variables ();

View File

@ -1733,7 +1733,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
bool first_file_data_format_reset;
bool first_file_header_format_reset;
void config_changed (const char*);
void config_changed (std::string, bool);
XMLNode& get_control_protocol_state ();

View File

@ -29,7 +29,7 @@ class SessionConfiguration : public Configuration
public:
SessionConfiguration ();
void map_parameters (sigc::slot<void, const char*>);
void map_parameters (sigc::slot<void, std::string>);
int set_state (XMLNode const &);
XMLNode& get_state ();
XMLNode& get_variables ();

View File

@ -307,7 +307,7 @@ RCConfiguration::set_variables (const XMLNode& node)
}
void
RCConfiguration::map_parameters (sigc::slot<void,const char*> theSlot)
RCConfiguration::map_parameters (sigc::slot<void, std::string> theSlot)
{
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL

View File

@ -180,7 +180,8 @@ Session::Session (AudioEngine &eng,
_state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty);
Config->ParameterChanged.connect (mem_fun (*this, &Session::config_changed));
Config->ParameterChanged.connect (bind (mem_fun (*this, &Session::config_changed), false));
config.ParameterChanged.connect (bind (mem_fun (*this, &Session::config_changed), true));
if (was_dirty) {
DirtyChanged (); /* EMIT SIGNAL */
@ -308,7 +309,7 @@ Session::Session (AudioEngine &eng,
_state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty);
Config->ParameterChanged.connect (mem_fun (*this, &Session::config_changed));
Config->ParameterChanged.connect (bind (mem_fun (*this, &Session::config_changed), false));
}
Session::~Session ()
@ -532,7 +533,7 @@ Session::when_engine_running ()
BootMessage (_("Using configuration"));
Config->map_parameters (mem_fun (*this, &Session::config_changed));
Config->map_parameters (bind (mem_fun (*this, &Session::config_changed), false));
/* every time we reconnect, recompute worst case output latencies */

View File

@ -111,7 +111,7 @@ SessionConfiguration::set_variables (const XMLNode& node)
}
void
SessionConfiguration::map_parameters (sigc::slot<void,const char*> theSlot)
SessionConfiguration::map_parameters (sigc::slot<void, std::string> theSlot)
{
#undef CONFIG_VARIABLE
#undef CONFIG_VARIABLE_SPECIAL

View File

@ -3000,18 +3000,20 @@ Session::restore_history (string snapshot_name)
}
void
Session::config_changed (const char* parameter_name)
Session::config_changed (std::string p, bool ours)
{
#define PARAM_IS(x) (!strcmp (parameter_name, (x)))
if (PARAM_IS ("seamless-loop")) {
if (ours) {
set_dirty ();
}
if (p == "seamless-loop") {
} else if (PARAM_IS ("rf-speed")) {
} else if (p == "rf-speed") {
} else if (PARAM_IS ("auto-loop")) {
} else if (p == "auto-loop") {
} else if (p == "auto-input") {
} else if (PARAM_IS ("auto-input")) {
if (Config->get_monitoring_model() == HardwareMonitoring && transport_rolling()) {
/* auto-input only makes a difference if we're rolling */
@ -3024,7 +3026,7 @@ Session::config_changed (const char* parameter_name)
}
}
} else if (PARAM_IS ("punch-in")) {
} else if (p == "punch-in") {
Location* location;
@ -3037,7 +3039,7 @@ Session::config_changed (const char* parameter_name)
}
}
} else if (PARAM_IS ("punch-out")) {
} else if (p == "punch-out") {
Location* location;
@ -3050,7 +3052,7 @@ Session::config_changed (const char* parameter_name)
}
}
} else if (PARAM_IS ("edit-mode")) {
} else if (p == "edit-mode") {
Glib::Mutex::Lock lm (playlist_lock);
@ -3058,63 +3060,63 @@ Session::config_changed (const char* parameter_name)
(*i)->set_edit_mode (Config->get_edit_mode ());
}
} else if (PARAM_IS ("use-video-sync")) {
} else if (p == "use-video-sync") {
waiting_for_sync_offset = Config->get_use_video_sync();
} else if (PARAM_IS ("mmc-control")) {
} else if (p == "mmc-control") {
//poke_midi_thread ();
} else if (PARAM_IS ("mmc-device-id") || PARAM_IS ("mmc-receive-id")) {
} else if (p == "mmc-device-id" || p == "mmc-receive-id") {
if (mmc) {
mmc->set_receive_device_id (Config->get_mmc_receive_device_id());
}
} else if (PARAM_IS ("mmc-send-id")) {
} else if (p == "mmc-send-id") {
if (mmc) {
mmc->set_send_device_id (Config->get_mmc_send_device_id());
}
} else if (PARAM_IS ("midi-control")) {
} else if (p == "midi-control") {
//poke_midi_thread ();
} else if (PARAM_IS ("raid-path")) {
} else if (p == "raid-path") {
setup_raid_path (config.get_raid_path());
} else if (PARAM_IS ("smpte-format")) {
} else if (p == "smpte-format") {
sync_time_vars ();
} else if (PARAM_IS ("video-pullup")) {
} else if (p == "video-pullup") {
sync_time_vars ();
} else if (PARAM_IS ("seamless-loop")) {
} else if (p == "seamless-loop") {
if (play_loop && transport_rolling()) {
// to reset diskstreams etc
request_play_loop (true);
}
} else if (PARAM_IS ("rf-speed")) {
} else if (p == "rf-speed") {
cumulative_rf_motion = 0;
reset_rf_scale (0);
} else if (PARAM_IS ("click-sound")) {
} else if (p == "click-sound") {
setup_click_sounds (1);
} else if (PARAM_IS ("click-emphasis-sound")) {
} else if (p == "click-emphasis-sound") {
setup_click_sounds (-1);
} else if (PARAM_IS ("clicking")) {
} else if (p == "clicking") {
if (Config->get_clicking()) {
if (_click_io && click_data) { // don't require emphasis data
@ -3124,7 +3126,7 @@ Session::config_changed (const char* parameter_name)
_clicking = false;
}
} else if (PARAM_IS ("send-mtc")) {
} else if (p == "send-mtc") {
/* only set the internal flag if we have
a port.
@ -3140,7 +3142,7 @@ Session::config_changed (const char* parameter_name)
session_send_mtc = false;
}
} else if (PARAM_IS ("send-mmc")) {
} else if (p == "send-mmc") {
/* only set the internal flag if we have
a port.
@ -3153,7 +3155,7 @@ Session::config_changed (const char* parameter_name)
session_send_mmc = false;
}
} else if (PARAM_IS ("midi-feedback")) {
} else if (p == "midi-feedback") {
/* only set the internal flag if we have
a port.
@ -3163,11 +3165,11 @@ Session::config_changed (const char* parameter_name)
session_midi_feedback = Config->get_midi_feedback();
}
} else if (PARAM_IS ("jack-time-master")) {
} else if (p == "jack-time-master") {
engine().reset_timebase ();
} else if (PARAM_IS ("native-file-header-format")) {
} else if (p == "native-file-header-format") {
if (!first_file_header_format_reset) {
reset_native_file_format ();
@ -3175,7 +3177,7 @@ Session::config_changed (const char* parameter_name)
first_file_header_format_reset = false;
} else if (PARAM_IS ("native-file-data-format")) {
} else if (p == "native-file-data-format") {
if (!first_file_data_format_reset) {
reset_native_file_format ();
@ -3183,17 +3185,17 @@ Session::config_changed (const char* parameter_name)
first_file_data_format_reset = false;
} else if (PARAM_IS ("slave-source")) {
set_slave_source (Config->get_slave_source());
} else if (PARAM_IS ("remote-model")) {
} else if (p == "slave-source") {
set_slave_source (Config->get_slave_source());
} else if (p == "remote-model") {
set_remote_control_ids ();
} else if (PARAM_IS ("denormal-model")) {
} else if (p == "denormal-model") {
setup_fpu ();
} else if (PARAM_IS ("history-depth")) {
} else if (p == "history-depth") {
set_history_depth (Config->get_history_depth());
} else if (PARAM_IS ("sync-all-route-ordering")) {
} else if (p == "sync-all-route-ordering") {
sync_order_keys ("session");
} else if (PARAM_IS ("initial-program-change")) {
} else if (p == "initial-program-change") {
if (_mmc_port && Config->get_initial_program_change() >= 0) {
MIDI::byte buf[2];
@ -3203,7 +3205,7 @@ Session::config_changed (const char* parameter_name)
_mmc_port->midimsg (buf, sizeof (buf), 0);
}
} else if (PARAM_IS ("initial-program-change")) {
} else if (p == "initial-program-change") {
if (_mmc_port && Config->get_initial_program_change() >= 0) {
MIDI::byte* buf = new MIDI::byte[2];
@ -3212,14 +3214,11 @@ Session::config_changed (const char* parameter_name)
buf[1] = (Config->get_initial_program_change() & 0x7f);
// deliver_midi (_mmc_port, buf, 2);
}
} else if (PARAM_IS ("solo-mute-override")) {
} else if (p == "solo-mute-override") {
catch_up_on_solo_mute_override ();
}
set_dirty ();
#undef PARAM_IS
}
void