new logic for enabling translation in bundled releases of ardour
[ardour.git] / gtk2_ardour / rc_option_editor.cc
index c8899621585ab55a35fb1f787a26d1dfd8f4780f..859eedb822989a9a8145f7d5577daef255b558e9 100644 (file)
@@ -105,10 +105,7 @@ private:
 
        void click_browse_clicked ()
        {
-               SoundFileChooser sfdb (*_parent, _("Choose Click"));
-
-               sfdb.show_all ();
-               sfdb.present ();
+               SoundFileChooser sfdb (_("Choose Click"));
 
                if (sfdb.run () == RESPONSE_OK) {
                        click_chosen (sfdb.get_filename());
@@ -128,7 +125,7 @@ private:
        
        void click_emphasis_browse_clicked ()
        {
-               SoundFileChooser sfdb (*_parent, _("Choose Click Emphasis"));
+               SoundFileChooser sfdb (_("Choose Click Emphasis"));
 
                sfdb.show_all ();
                sfdb.present ();
@@ -395,7 +392,7 @@ public:
                        }
                }
 
-               l = manage (left_aligned_label (_("Toggle snap using:")));
+               l = manage (left_aligned_label (_("Ignore snap using:")));
                l->set_name ("OptionsLabel");
 
                t->attach (*l, 0, 1, 3, 4, FILL | EXPAND, FILL);
@@ -532,7 +529,7 @@ public:
                _dpi_adjustment (50, 50, 250, 1, 10),
                _dpi_slider (_dpi_adjustment)
        {
-               _dpi_adjustment.set_value (_rc_config->get_font_scale () / 1024);
+               _dpi_adjustment.set_value (floor (_rc_config->get_font_scale () / 1024));
 
                Label* l = manage (new Label (_("Font scaling:")));
                l->set_name ("OptionsLabel");
@@ -551,7 +548,7 @@ public:
        void parameter_changed (string const & p)
        {
                if (p == "font-scale") {
-                       _dpi_adjustment.set_value (_rc_config->get_font_scale() / 1024);
+                       _dpi_adjustment.set_value (floor (_rc_config->get_font_scale() / 1024));
                }
        }
 
@@ -670,7 +667,11 @@ public:
                _box->pack_start (*label, false, false);
                label->show ();
 
-               _store->signal_row_changed().connect (sigc::mem_fun (*this, &ControlSurfacesOptions::model_changed));
+               ControlProtocolManager& m = ControlProtocolManager::instance ();
+               m.ProtocolStatusChange.connect (protocol_status_connection, MISSING_INVALIDATOR,
+                                               boost::bind (&ControlSurfacesOptions::protocol_status_changed, this, _1), gui_context());
+
+               _store->signal_row_changed().connect (sigc::mem_fun (*this, &ControlSurfacesOptions::view_changed));
                _view.signal_button_press_event().connect_notify (sigc::mem_fun(*this, &ControlSurfacesOptions::edit_clicked));
        }
 
@@ -698,7 +699,18 @@ public:
 
 private:
 
-       void model_changed (TreeModel::Path const &, TreeModel::iterator const & i)
+        void protocol_status_changed (ControlProtocolInfo* cpi) {
+               /* find the row */
+               TreeModel::Children rows = _store->children();
+               for (TreeModel::Children::iterator x = rows.begin(); x != rows.end(); ++x) {
+                       if ((*x)[_model.protocol_info] == cpi) {
+                               (*x)[_model.enabled] = (cpi->protocol || cpi->requested);
+                               break;
+                       }
+               }
+       }
+
+       void view_changed (TreeModel::Path const &, TreeModel::iterator const & i)
        {
                TreeModel::Row r = *i;
 
@@ -794,6 +806,7 @@ private:
        ControlSurfacesModelColumns _model;
        TreeView _view;
         Gtk::Window& _parent;
+        PBD::ScopedConnection protocol_status_connection;
 };
 
 /** A class which allows control of visibility of some editor components usign
@@ -865,6 +878,7 @@ RCOptionEditor::RCOptionEditor ()
        /* MISC */
 
         uint32_t hwcpus = hardware_concurrency ();
+       BoolOption* bo;
 
         if (hwcpus > 1) {
                 add_option (_("Misc"), new OptionEditorHeading (_("DSP CPU Utilization")));
@@ -957,6 +971,15 @@ RCOptionEditor::RCOptionEditor ()
                     0, 1000, 1, 20
                     ));
 
+       add_option (_("Misc"),
+            new SpinOption<double> (
+                    "automation-interval-msecs",
+                    _("Automation sampling interval (milliseconds)"),
+                    sigc::mem_fun (*_rc_config, &RCConfiguration::get_automation_interval_msecs),
+                    sigc::mem_fun (*_rc_config, &RCConfiguration::set_automation_interval_msecs),
+                    1, 1000, 1, 20
+                    ));
+
        /* TRANSPORT */
 
        BoolOption* tsf;
@@ -1054,7 +1077,7 @@ RCOptionEditor::RCOptionEditor ()
                   "<b>When enabled</b> the session video frame rate will be changed to match that of the selected external timecode source.\n\n"
                   "<b>When disabled</b> the session video frame rate will not be changed to match that of the selected external timecode source."
                   "Instead the frame rate indication in the main clock will flash red and Ardour will convert between the external "
-                  "timecode standard and the session standard"));
+                  "timecode standard and the session standard."));
 
        add_option (_("Transport"), _sync_framerate);
 
@@ -1066,11 +1089,31 @@ RCOptionEditor::RCOptionEditor ()
                );
        Gtkmm2ext::UI::instance()->set_tip 
                (_sync_genlock->tip_widget(), 
-                _("<b>When enabled</b> indicates that the selected external timecode source shares sync (Black &amp; Burst, Wordclock, etc) with the audio interface"));
+                _("<b>When enabled</b> indicates that the selected external timecode source shares sync (Black &amp; Burst, Wordclock, etc) with the audio interface."));
 
 
        add_option (_("Transport"), _sync_genlock);
 
+       _sync_source_2997 = new BoolOption (
+               "timecode-source-2997",
+               _("Lock to 29.9700 fps instead of 30000/1001"),
+               sigc::mem_fun (*_rc_config, &RCConfiguration::get_timecode_source_2997),
+               sigc::mem_fun (*_rc_config, &RCConfiguration::set_timecode_source_2997)
+               );
+       Gtkmm2ext::UI::instance()->set_tip
+               (_sync_source_2997->tip_widget(),
+                _("<b>When enabled</b> the external timecode source is assumed to use 29.97 fps instead of 30000/1001.\n"
+                        "SMPTE 12M-1999 specifies 29.97df as 30000/1001. The spec further mentions that "
+                        "drop-frame timecode has an accumulated error of -86ms over a 24-hour period.\n"
+                        "Drop-frame timecode would compensate exactly for a NTSC color frame rate of 30 * 0.9990 (ie 29.970000). "
+                        "That is not the actual rate. However, some vendors use that rate - despite it being against the specs - "
+                        "because the variant of using exactly 29.97 fps has zero timecode drift.\n"
+                        ));
+
+       add_option (_("Transport"), _sync_source_2997);
+
+       add_option (_("Transport"), new OptionEditorHeading (S_("LTC Reader")));
+
        _ltc_port = new ComboStringOption (
                "ltc-source-port",
                _("LTC incoming port"),
@@ -1085,6 +1128,40 @@ RCOptionEditor::RCOptionEditor ()
 
        add_option (_("Transport"), _ltc_port);
 
+       // TODO; rather disable this button than not compile it..
+       add_option (_("Transport"), new OptionEditorHeading (S_("LTC Generator")));
+
+       add_option (_("Transport"),
+                   new BoolOption (
+                           "send-ltc",
+                           _("Enable LTC generator"),
+                           sigc::mem_fun (*_rc_config, &RCConfiguration::get_send_ltc),
+                           sigc::mem_fun (*_rc_config, &RCConfiguration::set_send_ltc)
+                           ));
+
+       _ltc_send_continuously = new BoolOption (
+                           "ltc-send-continuously",
+                           _("send LTC while stopped"),
+                           sigc::mem_fun (*_rc_config, &RCConfiguration::get_ltc_send_continuously),
+                           sigc::mem_fun (*_rc_config, &RCConfiguration::set_ltc_send_continuously)
+                           );
+       Gtkmm2ext::UI::instance()->set_tip
+               (_ltc_send_continuously->tip_widget(),
+                _("<b>When enabled</b> Ardour will continue to send LTC information even when the transport (playhead) is not moving"));
+       add_option (_("Transport"), _ltc_send_continuously);
+
+  _ltc_volume_adjustment = new Gtk::Adjustment(-18, -50, 0, .5, 5);
+       _ltc_volume_adjustment->set_value (20 * log10(_rc_config->get_ltc_output_volume()));
+       _ltc_volume_adjustment->signal_value_changed().connect (sigc::mem_fun (*this, &RCOptionEditor::ltc_generator_volume_changed));
+       _ltc_volume_slider = new HSliderOption("ltcvol", _("LTC generator level"), *_ltc_volume_adjustment);
+
+       Gtkmm2ext::UI::instance()->set_tip
+               (_ltc_volume_slider->tip_widget(),
+                _("Specify the Peak Volume of the generated LTC signal in dbFS. A good value is  0dBu ^= -18dbFS in an EBU calibrated system"));
+
+       add_option (_("Transport"), _ltc_volume_slider);
+       parameter_changed ("send-ltc");
+
        parameter_changed ("sync-source");
 
        /* EDITOR */
@@ -1113,13 +1190,19 @@ RCOptionEditor::RCOptionEditor ()
                     sigc::mem_fun (*_rc_config, &RCConfiguration::set_show_track_meters)
                     ));
 
-       add_option (_("Editor"),
-            new BoolOption (
+       bo = new BoolOption (
                     "use-overlap-equivalency",
                     _("Use overlap equivalency for regions"),
                     sigc::mem_fun (*_rc_config, &RCConfiguration::get_use_overlap_equivalency),
                     sigc::mem_fun (*_rc_config, &RCConfiguration::set_use_overlap_equivalency)
-                    ));
+                    );
+
+       add_option (_("Editor"), bo);
+       Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget(), 
+                                           string_compose (_("When extending region selection across a group, %1 must decide which regions are equivalent"
+                                                             "\n\nIf enabled, regions are considered \"equivalent\" if they overlap on the timeline."
+                                                             "\n\nIf disabled, regions are considered \"equivalent\" only if have the same start time, length and position"),
+                                                           PROGRAM_NAME));
 
        add_option (_("Editor"),
             new BoolOption (
@@ -1219,13 +1302,16 @@ RCOptionEditor::RCOptionEditor ()
                     sigc::mem_fun (*_rc_config, &RCConfiguration::set_link_editor_and_mixer_selection)
                     ));
 
-       add_option (_("Editor"),
-            new BoolOption (
+       bo = new BoolOption (
                     "name-new-markers",
                     _("Name new markers"),
                     sigc::mem_fun (*_rc_config, &RCConfiguration::get_name_new_markers),
                     sigc::mem_fun (*_rc_config, &RCConfiguration::set_name_new_markers)
-                    ));
+               );
+       
+       add_option (_("Editor"), bo);
+       Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget(), _("If enabled, popup a dialog when a new marker is created to allow its name to be set as it is created."
+                                                               "\n\nYou can always rename markers by right-clicking on them"));
 
        add_option (_("Editor"),
            new BoolOption (
@@ -1357,14 +1443,6 @@ RCOptionEditor::RCOptionEditor ()
                     sigc::mem_fun (*_rc_config, &RCConfiguration::set_plugins_stop_with_transport)
                     ));
 
-       add_option (_("Audio"),
-            new BoolOption (
-                    "do-not-record-plugins",
-                    _("Disable plugins during recording"),
-                    sigc::mem_fun (*_rc_config, &RCConfiguration::get_do_not_record_plugins),
-                    sigc::mem_fun (*_rc_config, &RCConfiguration::set_do_not_record_plugins)
-                    ));
-
        add_option (_("Audio"),
             new BoolOption (
                     "new-plugins-active",
@@ -1606,6 +1684,17 @@ RCOptionEditor::RCOptionEditor ()
 
        /* USER INTERACTION */
 
+       if (getenv ("ARDOUR_BUNDLED")) {
+               add_option (_("User interaction"), 
+                           new BoolOption (
+                                   "enable-translation",
+                                   string_compose (_("Use translations of %1 messages\n"
+                                                     "   <i>(requires a restart of %1 to take effect)</i>\n"
+                                                     "   <i>(if available for your language preferences)</i>"), PROGRAM_NAME),
+                                   sigc::ptr_fun (ARDOUR::translations_are_enabled),
+                                   sigc::ptr_fun (ARDOUR::set_translations_enabled)));
+       }
+
        add_option (_("User interaction"), new OptionEditorHeading (_("Keyboard")));
 
        add_option (_("User interaction"), new KeyboardOptions);
@@ -1637,6 +1726,14 @@ RCOptionEditor::RCOptionEditor ()
                     sigc::mem_fun (*_rc_config, &RCConfiguration::set_widget_prelight)
                     ));
 
+       add_option (S_("GUI"),
+            new BoolOption (
+                    "use-tooltips",
+                    _("Show tooltips if mouse hovers over a control"),
+                    sigc::mem_fun (*_rc_config, &RCConfiguration::get_use_tooltips),
+                    sigc::mem_fun (*_rc_config, &RCConfiguration::set_use_tooltips)
+                    ));
+
 #ifndef GTKOSX
        /* font scaling does nothing with GDK/Quartz */
        add_option (S_("GUI"), new FontScalingOptions (_rc_config));
@@ -1656,7 +1753,6 @@ RCOptionEditor::RCOptionEditor ()
        _mixer_strip_visibility.add (0, X_("SoloSafe"), _("Solo Safe"));
        _mixer_strip_visibility.add (0, X_("SoloIsolated"), _("Solo Isolated"));
        _mixer_strip_visibility.add (0, X_("Comments"), _("Comments"));
-       _mixer_strip_visibility.add (0, X_("Group"), _("Group"));
        _mixer_strip_visibility.add (0, X_("MeterPoint"), _("Meter Point"));
        
        add_option (
@@ -1725,16 +1821,34 @@ RCOptionEditor::parameter_changed (string const & p)
                _solo_control_is_listen_control->set_sensitive (s);
                _listen_position->set_sensitive (s);
        } else if (p == "sync-source") {
-               if (Config->get_sync_source() != ARDOUR::MTC) {
-                       _sync_genlock->set_sensitive (false);
-                       _sync_framerate->set_sensitive (false);
-               } else {
+               _sync_source->set_sensitive (true);
+               if (_session) {
+                       _sync_source->set_sensitive (!_session->config.get_external_sync());
+               }
+               switch(Config->get_sync_source()) {
+               case ARDOUR::MTC:
+               case ARDOUR::LTC:
                        _sync_genlock->set_sensitive (true);
                        _sync_framerate->set_sensitive (true);
+                       _sync_source_2997->set_sensitive (true);
+                       break;
+               default:
+                       _sync_genlock->set_sensitive (false);
+                       _sync_framerate->set_sensitive (false);
+                       _sync_source_2997->set_sensitive (false);
+                       break;
                }
+       } else if (p == "send-ltc") {
+               bool const s = Config->get_send_ltc ();
+               _ltc_send_continuously->set_sensitive (s);
+               _ltc_volume_slider->set_sensitive (s);
        }
 }
 
+void RCOptionEditor::ltc_generator_volume_changed () {
+       _rc_config->set_ltc_output_volume (pow(10, _ltc_volume_adjustment->get_value() / 20));
+}
+
 void
 RCOptionEditor::populate_sync_options ()
 {