enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h
[ardour.git] / gtk2_ardour / session_option_editor.cc
index dd95b7f057bbc65a242f8599065839c809d9150c..baadcef795ff625c66f48bf26898358f3361e70c 100644 (file)
 #include "gui_thread.h"
 #include "session_option_editor.h"
 #include "search_path_option.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
 using namespace Timecode;
 
 SessionOptionEditor::SessionOptionEditor (Session* s)
-       : OptionEditor (&(s->config), _("Session Properties"))
+       : OptionEditorWindow (&(s->config), _("Session Properties"))
        , _session_config (&(s->config))
 {
        set_session (s);
@@ -60,18 +60,6 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
 
        add_option (_("Timecode"), smf);
 
-       ComboOption<uint32_t>* spf = new ComboOption<uint32_t> (
-               "subframes-per-frame",
-               _("Subframes per frame"),
-               sigc::mem_fun (*_session_config, &SessionConfiguration::get_subframes_per_frame),
-               sigc::mem_fun (*_session_config, &SessionConfiguration::set_subframes_per_frame)
-               );
-
-       spf->add (80, _("80"));
-       spf->add (100, _("100"));
-
-       add_option (_("Timecode"), spf);
-
        _vpu = new ComboOption<float> (
                "video-pullup",
                _("Pull-up / pull-down"),
@@ -91,24 +79,47 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
 
        add_option (_("Timecode"), _vpu);
 
-       ClockOption* co = new ClockOption (
-               "timecode-offset",
-               _("Timecode offset"),
-               sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_offset),
-               sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_offset)
+       add_option (_("Sync"), new BoolOption (
+                           "use-video-file-fps",
+                           _("Use Video File's FPS Instead of Timecode Value for Timeline and Video Monitor."),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_video_file_fps),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_video_file_fps)
+                           ));
+
+       add_option (_("Sync"), new BoolOption (
+                           "videotimeline-pullup",
+                           _("Apply Pull-Up/Down to Video Timeline and Video Monitor (Unless using JACK-sync)."),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_videotimeline_pullup),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_videotimeline_pullup)
+                           ));
+
+       add_option (_("Timecode"), new OptionEditorHeading (_("Ext Timecode Offsets")));
+
+       ClockOption* sco = new ClockOption (
+               "slave-timecode-offset",
+               _("Slave Timecode offset"),
+               sigc::mem_fun (*_session_config, &SessionConfiguration::get_slave_timecode_offset),
+               sigc::mem_fun (*_session_config, &SessionConfiguration::set_slave_timecode_offset)
                );
 
-       co->set_session (_session);
-       co->clock().set_negative_allowed (true);
+       sco->set_session (_session);
+       sco->clock().set_negative_allowed (true);
+       Gtkmm2ext::UI::instance()->set_tip (sco->tip_widget(), _("The specified offset is added to the received timecode (MTC or LTC)."));
 
-       add_option (_("Timecode"), co);
+       add_option (_("Timecode"), sco);
 
-       add_option (_("Timecode"), new BoolOption (
-                           "timecode-offset-negative",
-                           _("Timecode Offset Negative"),
-                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_offset_negative),
-                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_offset_negative)
-                           ));
+       ClockOption* gco = new ClockOption (
+               "timecode-generator-offset",
+               _("Timecode Generator offset"),
+               sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_generator_offset),
+               sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_generator_offset)
+               );
+
+       gco->set_session (_session);
+       gco->clock().set_negative_allowed (true);
+       Gtkmm2ext::UI::instance()->set_tip (gco->tip_widget(), _("Specify an offset which is added to the generated timecode (so far only LTC)."));
+
+       add_option (_("Timecode"), gco);
 
        add_option (_("Timecode"), new OptionEditorHeading (_("JACK Transport/Time Settings")));
 
@@ -121,40 +132,6 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
 
        /* FADES */
 
-       ComboOption<CrossfadeModel>* cfm = new ComboOption<CrossfadeModel> (
-               "xfade-model",
-               _("Crossfades are created"),
-               sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfade_model),
-               sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfade_model)
-               );
-
-       cfm->add (FullCrossfade, _("to span entire overlap"));
-       cfm->add (ShortCrossfade, _("short"));
-
-       add_option (_("Fades"), cfm);
-
-       ComboOption<CrossfadeChoice>* cfc = new ComboOption<CrossfadeChoice> (
-               "xfade-choice",
-               _("Crossfade type"),
-               sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfade_choice),
-               sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfade_choice)
-               );
-
-       cfc->add (ConstantPowerMinus3dB, _("constant power (-3dB)"));
-       cfc->add (ConstantPowerMinus6dB, _("constant power (-6dB)"));
-       cfc->add (RegionFades, _("use existing region fade shape"));
-
-       add_option (_("Fades"), cfc);
-
-       add_option (_("Fades"), new SpinOption<float> (
-               _("short-xfade-seconds"),
-               _("Short crossfade length"),
-               sigc::mem_fun (*_session_config, &SessionConfiguration::get_short_xfade_seconds),
-               sigc::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"),
@@ -165,10 +142,17 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
                            ));
 
        add_option (_("Fades"), new BoolOption (
-                           "auto-xfade",
-                           _("Create crossfades automatically"),
-                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_auto_xfade),
-                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_xfade)
+                           "use-transport-fades",
+                           _("Declick when transport starts and stops"),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_transport_fades),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_transport_fades)
+                           ));
+
+       add_option (_("Fades"), new BoolOption (
+                           "use-monitor-fades",
+                           _("Declick when monitor state changes"),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_monitor_fades),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_monitor_fades)
                            ));
 
        add_option (_("Fades"), new BoolOption (
@@ -209,31 +193,77 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
                sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_header_format)
                );
 
-       hf->add (BWF, _("Broadcast WAVE"));
-       hf->add (WAVE, _("WAVE"));
+       hf->add (BWF, _("Broadcast WAVE (4GB size limit)"));
+#ifdef HAVE_RF64_RIFF
+       hf->add (MBWF, _("Broadcast RF64"));
+#endif
+       hf->add (WAVE, _("WAVE (4GB size limit)"));
        hf->add (WAVE64, _("WAVE-64"));
        hf->add (CAF, _("CAF"));
+       hf->add (RF64, _("RF64"));
+#ifdef HAVE_RF64_RIFF
+       hf->add (RF64_WAV, _("RF64 (WAV compatible)"));
+#endif
 
        add_option (_("Media"), hf);
 
-       add_option (_("Media"), new OptionEditorHeading (_("File locations")));
+       add_option (S_("Files|Locations"), new OptionEditorHeading (_("File locations")));
 
         SearchPathOption* spo = new SearchPathOption ("audio-search-path", _("Search for audio files in:"),
+                                                     _session->path(),
                                                       sigc::mem_fun (*_session_config, &SessionConfiguration::get_audio_search_path),
                                                       sigc::mem_fun (*_session_config, &SessionConfiguration::set_audio_search_path));
-        add_option (_("Media"), spo);
+        add_option (S_("Files|Locations"), spo);
 
         spo = new SearchPathOption ("midi-search-path", _("Search for MIDI files in:"),
+                                   _session->path(),
                                     sigc::mem_fun (*_session_config, &SessionConfiguration::get_midi_search_path),
                                     sigc::mem_fun (*_session_config, &SessionConfiguration::set_midi_search_path));
 
-        add_option (_("Media"), spo);
+        add_option (S_("Files|Locations"), spo);
+
+       /* File Naming  */
+
+       add_option (_("Filenames"), new OptionEditorHeading (_("File Naming")));
+
+       BoolOption *bo;
+
+       bo = new RouteDisplayBoolOption (
+                       "track-name-number",
+                       _("Prefix Track number"),
+                       sigc::mem_fun (*_session_config, &SessionConfiguration::get_track_name_number),
+                       sigc::mem_fun (*_session_config, &SessionConfiguration::set_track_name_number)
+                       );
+       Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget(),
+                       _("Adds the current track number to the beginning of the recorded file name."));
+       add_option (_("Filenames"), bo);
+
+       bo = new BoolOption (
+                       "track-name-take",
+                       _("Prefix Take Name"),
+                       sigc::mem_fun (*_session_config, &SessionConfiguration::get_track_name_take),
+                       sigc::mem_fun (*_session_config, &SessionConfiguration::set_track_name_take)
+                       );
+       Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget(),
+                       _("Adds the Take Name to the beginning of the recorded file name."));
+       add_option (_("Filenames"), bo);
+
+       _take_name = new EntryOption (
+               "take-name",
+               _("Take Name"),
+               sigc::mem_fun (*_session_config, &SessionConfiguration::get_take_name),
+               sigc::mem_fun (*_session_config, &SessionConfiguration::set_take_name)
+               );
+       _take_name->set_invalid_chars(".");
+       _take_name->set_sensitive(_session_config->get_track_name_take());
+
+       add_option (_("Filenames"), _take_name);
 
        /* Monitoring */
 
         add_option (_("Monitoring"), new BoolOption (
                            "auto-input",
-                           _("Monitoring automatically follows transport state (\"auto-input\")"),
+                           _("Track Input Monitoring automatically follows transport state (\"auto-input\")"),
                            sigc::mem_fun (*_session_config, &SessionConfiguration::get_auto_input),
                            sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_input)
                            ));
@@ -244,49 +274,118 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
                            sigc::mem_fun (*this, &SessionOptionEditor::get_use_monitor_section),
                            sigc::mem_fun (*this, &SessionOptionEditor::set_use_monitor_section)
                            ));
+       /* Meterbridge */
+       add_option (_("Meterbridge"), new OptionEditorHeading (_("Route Display")));
+
+       add_option (_("Meterbridge"), new BoolOption (
+                           "show-midi-on-meterbridge",
+                           _("Show Midi Tracks"),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_midi_on_meterbridge),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_midi_on_meterbridge)
+                           ));
+
+       add_option (_("Meterbridge"), new BoolOption (
+                           "show-busses-on-meterbridge",
+                           _("Show Busses"),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_busses_on_meterbridge),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_busses_on_meterbridge)
+                           ));
 
-        /* Misc */
+       add_option (_("Meterbridge"), new BoolOption (
+                           "show-master-on-meterbridge",
+                           _("Include Master Bus"),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_master_on_meterbridge),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_master_on_meterbridge)
+                           ));
 
-       add_option (_("Misc"), new OptionEditorHeading (_("MIDI Options")));
+       add_option (_("Meterbridge"), new OptionEditorHeading (_("Button Area")));
 
-        add_option (_("Misc"), new BoolOption (
-                           "midi-copy-is-fork",
-                           _("MIDI region copies are independent"),
-                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_midi_copy_is_fork),
-                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_midi_copy_is_fork)
+       add_option (_("Meterbridge"), new BoolOption (
+                           "show-rec-on-meterbridge",
+                           _("Rec-enable Button"),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_rec_on_meterbridge),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_rec_on_meterbridge)
                            ));
 
-       ComboOption<InsertMergePolicy>* li = new ComboOption<InsertMergePolicy> (
-               "insert-merge-policy",
-               _("Policy for handling overlapping notes\n on the same MIDI channel"),
-               sigc::mem_fun (*_session_config, &SessionConfiguration::get_insert_merge_policy),
-               sigc::mem_fun (*_session_config, &SessionConfiguration::set_insert_merge_policy)
-               );
+       add_option (_("Meterbridge"), new BoolOption (
+                           "show-mute-on-meterbridge",
+                           _("Mute Button"),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_mute_on_meterbridge),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_mute_on_meterbridge)
+                           ));
+
+       add_option (_("Meterbridge"), new BoolOption (
+                           "show-solo-on-meterbridge",
+                           _("Solo Button"),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_solo_on_meterbridge),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_solo_on_meterbridge)
+                           ));
 
-        li->add (InsertMergeReject, _("never allow them"));
-        li->add (InsertMergeRelax, _("don't do anything in particular"));
-        li->add (InsertMergeReplace, _("replace any overlapped existing note"));
-        li->add (InsertMergeTruncateExisting, _("shorten the overlapped existing note"));
-        li->add (InsertMergeTruncateAddition, _("shorten the overlapping new note"));
-        li->add (InsertMergeExtend, _("replace both overlapping notes with a single note"));
+       add_option (_("Meterbridge"), new BoolOption (
+                           "show-monitor-on-meterbridge",
+                           _("Monitor Buttons"),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_monitor_on_meterbridge),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_monitor_on_meterbridge)
+                           ));
+
+       add_option (_("Meterbridge"), new OptionEditorHeading (_("Name Labels")));
+
+       add_option (_("Meterbridge"), new BoolOption (
+                           "show-name-on-meterbridge",
+                           _("Track Name"),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_name_on_meterbridge),
+                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_name_on_meterbridge)
+                           ));
+
+       /* Misc */
+
+       add_option (_("Misc"), new OptionEditorHeading (_("MIDI Options")));
+
+       add_option (_("Misc"), new BoolOption (
+                               "midi-copy-is-fork",
+                               _("MIDI region copies are independent"),
+                               sigc::mem_fun (*_session_config, &SessionConfiguration::get_midi_copy_is_fork),
+                               sigc::mem_fun (*_session_config, &SessionConfiguration::set_midi_copy_is_fork)
+                               ));
+
+       ComboOption<InsertMergePolicy>* li = new ComboOption<InsertMergePolicy> (
+                       "insert-merge-policy",
+                       _("Policy for handling overlapping notes\n on the same MIDI channel"),
+                       sigc::mem_fun (*_session_config, &SessionConfiguration::get_insert_merge_policy),
+                       sigc::mem_fun (*_session_config, &SessionConfiguration::set_insert_merge_policy)
+                       );
+
+       li->add (InsertMergeReject, _("never allow them"));
+       li->add (InsertMergeRelax, _("don't do anything in particular"));
+       li->add (InsertMergeReplace, _("replace any overlapped existing note"));
+       li->add (InsertMergeTruncateExisting, _("shorten the overlapped existing note"));
+       li->add (InsertMergeTruncateAddition, _("shorten the overlapping new note"));
+       li->add (InsertMergeExtend, _("replace both overlapping notes with a single note"));
 
        add_option (_("Misc"), li);
 
        add_option (_("Misc"), new OptionEditorHeading (_("Glue to bars and beats")));
 
        add_option (_("Misc"), new BoolOption (
-                           "glue-new-markers-to-bars-and-beats",
-                           _("Glue new markers to bars and beats"),
-                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_glue_new_markers_to_bars_and_beats),
-                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_glue_new_markers_to_bars_and_beats)
-                           ));
+                               "glue-new-markers-to-bars-and-beats",
+                               _("Glue new markers to bars and beats"),
+                               sigc::mem_fun (*_session_config, &SessionConfiguration::get_glue_new_markers_to_bars_and_beats),
+                               sigc::mem_fun (*_session_config, &SessionConfiguration::set_glue_new_markers_to_bars_and_beats)
+                               ));
 
        add_option (_("Misc"), new BoolOption (
-                           "glue-new-regions-to-bars-and-beats",
-                           _("Glue new regions to bars and beats"),
-                           sigc::mem_fun (*_session_config, &SessionConfiguration::get_glue_new_regions_to_bars_and_beats),
-                           sigc::mem_fun (*_session_config, &SessionConfiguration::set_glue_new_regions_to_bars_and_beats)
-                           ));
+                               "glue-new-regions-to-bars-and-beats",
+                               _("Glue new regions to bars and beats"),
+                               sigc::mem_fun (*_session_config, &SessionConfiguration::get_glue_new_regions_to_bars_and_beats),
+                               sigc::mem_fun (*_session_config, &SessionConfiguration::set_glue_new_regions_to_bars_and_beats)
+                               ));
+
+       add_option (_("Misc"), new OptionEditorHeading (_("Defaults")));
+
+       Gtk::Button* btn = Gtk::manage (new Gtk::Button (_("Use these settings as defaults")));
+       btn->signal_clicked().connect (sigc::mem_fun (*this, &SessionOptionEditor::save_defaults));
+       add_option (_("Misc"), new FooOption (btn));
+
 }
 
 void
@@ -294,13 +393,20 @@ SessionOptionEditor::parameter_changed (std::string const & p)
 {
        OptionEditor::parameter_changed (p);
        if (p == "external-sync") {
-               if (Config->get_sync_source() == JACK) {
+               if (Config->get_sync_source() == Engine) {
                        _vpu->set_sensitive(!_session_config->get_external_sync());
                } else {
                        _vpu->set_sensitive(true);
                }
        }
-
+       else if (p == "timecode-format") {
+               /* update offset clocks */
+               parameter_changed("timecode-generator-offset");
+               parameter_changed("slave-timecode-offset");
+       }
+       else if (p == "track-name-take") {
+               _take_name->set_sensitive(_session_config->get_track_name_take());
+       }
 }
 
 /* the presence of absence of a monitor section is not really a regular session
@@ -310,7 +416,7 @@ SessionOptionEditor::parameter_changed (std::string const & p)
 bool
 SessionOptionEditor::set_use_monitor_section (bool yn)
 {
-       bool had_monitor_section = _session->monitor_out();
+       bool had_monitor_section = _session->monitor_out() != 0;
 
        if (yn) {
                _session->add_monitor_section ();
@@ -318,7 +424,11 @@ SessionOptionEditor::set_use_monitor_section (bool yn)
                _session->remove_monitor_section ();
        }
 
-       return had_monitor_section != yn;
+       /* store this choice for any new sessions */
+
+       Config->set_use_monitor_bus (yn);
+
+       return had_monitor_section != (_session->monitor_out() != 0);
 }
 
 bool
@@ -326,3 +436,9 @@ SessionOptionEditor::get_use_monitor_section ()
 {
        return _session->monitor_out() != 0;
 }
+
+void
+SessionOptionEditor::save_defaults ()
+{
+       _session->save_default_options();
+}