fix verbose plugin scan
[ardour.git] / gtk2_ardour / rc_option_editor.cc
index d9a71a783e9e82782cbe88396d2f847638291e30..0450948f57dc3c3b97ac51b4088775bd5d103276 100644 (file)
@@ -21,6 +21,8 @@
 #include "gtk2ardour-config.h"
 #endif
 
+#include <cairo/cairo.h>
+
 #include <boost/algorithm/string.hpp>    
 
 #include <gtkmm/liststore.h>
@@ -48,6 +50,7 @@
 #include "ardour_window.h"
 #include "ardour_dialog.h"
 #include "gui_thread.h"
+#include "meter_patterns.h"
 #include "midi_tracer.h"
 #include "rc_option_editor.h"
 #include "utils.h"
@@ -65,6 +68,121 @@ using namespace PBD;
 using namespace ARDOUR;
 using namespace ARDOUR_UI_UTILS;
 
+class AutoReturnTargetOptions : public OptionEditorBox
+{
+    public:
+       AutoReturnTargetOptions (RCConfiguration* c, Gtk::Window* p)
+               : _rc_config (c)
+               , range_selection_button (_("Play Range Selection"))
+               , last_roll_button (_("Play from Last Roll"))
+               , loop_button (_("Play Loop"))
+               , region_selection_button (_("Play Region Selection"))
+               , toggle_button (_("Enable/Disable all options"))
+       {
+               _box->pack_start (range_selection_button, false, false);
+               range_selection_button.signal_toggled().connect (sigc::mem_fun (*this, &AutoReturnTargetOptions::range_selection_toggled));
+
+               _box->pack_start (loop_button, false, false);
+               loop_button.signal_toggled().connect (sigc::mem_fun (*this, &AutoReturnTargetOptions::loop_toggled));
+
+               _box->pack_start (region_selection_button, false, false);
+               region_selection_button.signal_toggled().connect (sigc::mem_fun (*this, &AutoReturnTargetOptions::region_selection_toggled));
+
+               _box->pack_start (last_roll_button, false, false);
+               last_roll_button.signal_toggled().connect (sigc::mem_fun (*this, &AutoReturnTargetOptions::last_roll_toggled));
+
+               HBox* hbox = manage (new HBox);
+               /* keep the toggle button small */
+               hbox->pack_start (toggle_button, false, false);
+               _box->pack_start (*hbox, false, false);
+
+               toggle_button.signal_clicked().connect (sigc::mem_fun (*this, &AutoReturnTargetOptions::toggle));
+
+               Gtkmm2ext::UI::instance()->set_tip (range_selection_button,
+                                                   _("If enabled, playhead will always start from the beginning of the current range selection.\n\nIf disabled or no range selection, see the next choice in this list"));
+               Gtkmm2ext::UI::instance()->set_tip (loop_button,
+                                                   _("If enabled, playhead will always start from the beginning of the loop range.\n\nIf disabled or no loop range, see the next choice in this list"));
+               Gtkmm2ext::UI::instance()->set_tip (region_selection_button,
+                                                   _("If enabled, playhead will always start from the beginning of the first selected region.\n\nIf disabled or no region selection, see the next choice in this list"));
+               Gtkmm2ext::UI::instance()->set_tip (last_roll_button,
+                                                   _("If enabled, playhead will always start from the last position where it was started.\n\nIf disabled it will start from wherever it is currently located"));
+
+               Gtkmm2ext::UI::instance()->set_tip (toggle_button,
+                                                   _("Change status of all buttons above to all enabled or all disabled"));
+       }
+                       
+       void parameter_changed (string const & p)
+       {
+               if (p == "auto-return-target-list") {
+                       AutoReturnTarget art = _rc_config->get_auto_return_target_list();
+                       range_selection_button.set_active (art & RangeSelectionStart);
+                       loop_button.set_active (art & Loop);
+                       region_selection_button.set_active (art & RegionSelectionStart);
+                       last_roll_button.set_active (art & LastLocate);
+               }
+       }
+                                
+       void set_state_from_config ()
+       {
+               parameter_changed ("auto-return-target-list");
+       }
+
+    private:
+
+       void range_selection_toggled () {
+               AutoReturnTarget art = _rc_config->get_auto_return_target_list ();
+               if (range_selection_button.get_active ()) {
+                       _rc_config->set_auto_return_target_list (AutoReturnTarget (art | RangeSelectionStart));
+               } else {
+                       _rc_config->set_auto_return_target_list (AutoReturnTarget (art & ~RangeSelectionStart));
+               }
+       }
+       void last_roll_toggled () {
+               AutoReturnTarget art = _rc_config->get_auto_return_target_list ();
+               if (last_roll_button.get_active ()) {
+                       _rc_config->set_auto_return_target_list (AutoReturnTarget (art | LastLocate));
+               } else {
+                       _rc_config->set_auto_return_target_list (AutoReturnTarget (art & ~LastLocate));
+               }
+       }
+       void region_selection_toggled () {
+               AutoReturnTarget art = _rc_config->get_auto_return_target_list ();
+               if (region_selection_button.get_active ()) {
+                       _rc_config->set_auto_return_target_list (AutoReturnTarget (art | RegionSelectionStart));
+               } else {
+                       _rc_config->set_auto_return_target_list (AutoReturnTarget (art & ~RegionSelectionStart));
+               }
+       }
+       void loop_toggled () {
+               AutoReturnTarget art = _rc_config->get_auto_return_target_list ();
+               if (loop_button.get_active ()) {
+                       _rc_config->set_auto_return_target_list (AutoReturnTarget (art | Loop));
+               } else {
+                       _rc_config->set_auto_return_target_list (AutoReturnTarget (art & ~Loop));
+               }
+       }
+
+       void toggle () {
+               AutoReturnTarget art = _rc_config->get_auto_return_target_list ();
+               if (art) {
+                       _rc_config->set_auto_return_target_list (AutoReturnTarget (0));
+               } else {
+                       _rc_config->set_auto_return_target_list (AutoReturnTarget (RangeSelectionStart|
+                                                                                  RegionSelectionStart|
+                                                                                  Loop|
+                                                                                  LastLocate));
+               }
+       }
+       
+       RCConfiguration* _rc_config;
+
+       Gtk::CheckButton range_selection_button;
+       Gtk::CheckButton last_roll_button;
+       Gtk::CheckButton loop_button;
+       Gtk::CheckButton region_selection_button;
+       Gtk::Button      toggle_button;
+};
+
 class ClickOptions : public OptionEditorBox
 {
 public:
@@ -603,7 +721,7 @@ public:
                        }
                }
 
-               l = manage (left_aligned_label (_("Snap to absolute using:")));
+               l = manage (left_aligned_label (_("Snap relatively using:")));
                l->set_name ("OptionsLabel");
 
                t->attach (*l, col, col + 1, row, row + 1, FILL | EXPAND, FILL);
@@ -1397,6 +1515,7 @@ public:
                , _display_plugin_scan_progress (_("Always Display Plugin Scan Progress"))
                , _discover_vst_on_start (_("Scan for [new] VST Plugins on Application Start"))
                , _discover_au_on_start (_("Scan for AudioUnit Plugins on Application Start"))
+               , _verbose_plugin_scan (_("Verbose Plugin Scan"))
                , _timeout_adjustment (0, 0, 3000, 50, 50)
                , _timeout_slider (_timeout_adjustment)
        {
@@ -1469,6 +1588,12 @@ public:
                b = manage (new Button (_("Edit")));
                b->signal_clicked().connect (sigc::mem_fun (*this, &PluginOptions::edit_vst_path_clicked));
                t->attach (*b, 1, 2, n, n+1, FILL); ++n;
+
+               // currently verbose logging is only implemented for Windows VST.
+               t->attach (_verbose_plugin_scan, 0, 2, n, n+1); ++n;
+               _verbose_plugin_scan.signal_toggled().connect (sigc::mem_fun (*this, &PluginOptions::verbose_plugin_scan_toggled));
+               Gtkmm2ext::UI::instance()->set_tip (_verbose_plugin_scan,
+                                           _("<b>When enabled</b> additional information for every plugin is added to the Log Window."));
 #endif
 #endif // any VST
 
@@ -1516,6 +1641,10 @@ public:
                        bool const x = _rc_config->get_discover_audio_units();
                        _discover_au_on_start.set_active (x);
                }
+               else if (p == "verbose-plugin-scan") {
+                       bool const x = _rc_config->get_verbose_plugin_scan();
+                       _verbose_plugin_scan.set_active (x);
+               }
        }
 
        void set_state_from_config () {
@@ -1523,6 +1652,7 @@ public:
                parameter_changed ("discover-vst-on-start");
                parameter_changed ("vst-scan-timeout");
                parameter_changed ("discover-audio-units");
+               parameter_changed ("verbose-plugin-scan");
        }
 
 private:
@@ -1531,6 +1661,7 @@ private:
        CheckButton _display_plugin_scan_progress;
        CheckButton _discover_vst_on_start;
        CheckButton _discover_au_on_start;
+       CheckButton _verbose_plugin_scan;
        Adjustment _timeout_adjustment;
        HScale _timeout_slider;
 
@@ -1549,6 +1680,11 @@ private:
                _rc_config->set_discover_audio_units(x);
        }
 
+       void verbose_plugin_scan_toggled () {
+               bool const x = _verbose_plugin_scan.get_active();
+               _rc_config->set_verbose_plugin_scan(x);
+       }
+
        void timeout_changed () {
                int x = floor(_timeout_adjustment.get_value());
                _rc_config->set_vst_scan_timeout(x);
@@ -1782,6 +1918,10 @@ RCOptionEditor::RCOptionEditor ()
 
        /* TRANSPORT */
 
+       add_option (_("Transport"), new OptionEditorHeading (S_("Playhead Behaviour")));
+       add_option (_("Transport"), new AutoReturnTargetOptions (_rc_config, this));
+       add_option (_("Transport"), new OptionEditorHeading (S_("Transport Options")));
+
        BoolOption* tsf;
 
        tsf = new BoolOption (
@@ -2644,6 +2784,18 @@ RCOptionEditor::RCOptionEditor ()
 
        /* INTERFACE */
 
+#ifdef CAIRO_SUPPORTS_FORCE_BUGGY_GRADIENTS_ENVIRONMENT_VARIABLE
+       BoolOption* bgo = new BoolOption (
+               "buggy-gradients",
+               _("Possibly improve slow graphical performance"),
+               sigc::mem_fun (*_ui_config, &UIConfiguration::get_buggy_gradients),
+               sigc::mem_fun (*_ui_config, &UIConfiguration::set_buggy_gradients)
+               );
+
+       Gtkmm2ext::UI::instance()->set_tip (bgo->tip_widget(), string_compose (_("This requires restarting %1 before having an effect"), PROGRAM_NAME));
+       add_option (S_("Preferences|GUI"), bgo);
+#endif
+       
        add_option (S_("Preferences|GUI"),
             new BoolOption (
                     "widget-prelight",
@@ -2683,6 +2835,22 @@ RCOptionEditor::RCOptionEditor ()
                            sigc::mem_fun (*_ui_config, &UIConfiguration::set_super_rapid_clock_update)
                            ));
 
+
+       /* Image cache size */
+
+       Gtk::Adjustment *ics = manage (new Gtk::Adjustment(0, 1, 1024, 10)); /* 1 MB to 1GB in steps of 10MB */
+       HSliderOption *sics = new HSliderOption("waveform-cache-size",
+                                               _("Waveform image cache size (megabytes)"),
+                                               ics,
+                                               sigc::mem_fun (*ARDOUR_UI::config(), &UIConfiguration::get_waveform_cache_size),
+                                               sigc::mem_fun (*ARDOUR_UI::config(), &UIConfiguration::set_waveform_cache_size)
+                       );
+       sics->scale().set_digits (0);
+       Gtkmm2ext::UI::instance()->set_tip
+               (sics->tip_widget(),
+                _("Increasing the cache size uses more memory to store waveform images, which can improve graphical performance."));
+       add_option (S_("Preferences|GUI"), sics);
+       
        /* Lock GUI timeout */
 
        Gtk::Adjustment *lts = manage (new Gtk::Adjustment(0, 0, 1000, 1, 10));
@@ -2815,6 +2983,54 @@ RCOptionEditor::RCOptionEditor ()
                        sigc::mem_fun (*_ui_config, &UIConfiguration::set_meter_peak)
                        );
 
+
+       ComboOption<MeterType>* mtm = new ComboOption<MeterType> (
+               "meter-type-master",
+               _("Default Meter Type for Master Bus"),
+               sigc::mem_fun (*_rc_config, &RCConfiguration::get_meter_type_master),
+               sigc::mem_fun (*_rc_config, &RCConfiguration::set_meter_type_master)
+               );
+       mtm->add (MeterPeak,    ArdourMeter::meter_type_string(MeterPeak));
+       mtm->add (MeterK20,     ArdourMeter::meter_type_string(MeterK20));
+       mtm->add (MeterK14,     ArdourMeter::meter_type_string(MeterK14));
+       mtm->add (MeterK12,     ArdourMeter::meter_type_string(MeterK12));
+       mtm->add (MeterIEC1DIN, ArdourMeter::meter_type_string(MeterIEC1DIN));
+       mtm->add (MeterIEC1NOR, ArdourMeter::meter_type_string(MeterIEC1NOR));
+       mtm->add (MeterIEC2BBC, ArdourMeter::meter_type_string(MeterIEC2BBC));
+       mtm->add (MeterIEC2EBU, ArdourMeter::meter_type_string(MeterIEC2EBU));
+
+       add_option (S_("Preferences|Metering"), mtm);
+
+
+       ComboOption<MeterType>* mtb = new ComboOption<MeterType> (
+               "meter-type-bus",
+               _("Default Meter Type for Busses"),
+               sigc::mem_fun (*_rc_config, &RCConfiguration::get_meter_type_bus),
+               sigc::mem_fun (*_rc_config, &RCConfiguration::set_meter_type_bus)
+               );
+       mtb->add (MeterPeak,    ArdourMeter::meter_type_string(MeterPeak));
+       mtb->add (MeterK20,     ArdourMeter::meter_type_string(MeterK20));
+       mtb->add (MeterK14,     ArdourMeter::meter_type_string(MeterK14));
+       mtb->add (MeterK12,     ArdourMeter::meter_type_string(MeterK12));
+       mtb->add (MeterIEC1DIN, ArdourMeter::meter_type_string(MeterIEC1DIN));
+       mtb->add (MeterIEC1NOR, ArdourMeter::meter_type_string(MeterIEC1NOR));
+       mtb->add (MeterIEC2BBC, ArdourMeter::meter_type_string(MeterIEC2BBC));
+       mtb->add (MeterIEC2EBU, ArdourMeter::meter_type_string(MeterIEC2EBU));
+
+       add_option (S_("Preferences|Metering"), mtb);
+
+       ComboOption<MeterType>* mtt = new ComboOption<MeterType> (
+               "meter-type-track",
+               _("Default Meter Type for Tracks"),
+               sigc::mem_fun (*_rc_config, &RCConfiguration::get_meter_type_track),
+               sigc::mem_fun (*_rc_config, &RCConfiguration::set_meter_type_track)
+               );
+       mtt->add (MeterPeak,    ArdourMeter::meter_type_string(MeterPeak));
+       mtt->add (MeterPeak0dB, ArdourMeter::meter_type_string(MeterPeak0dB));
+
+       add_option (S_("Preferences|Metering"), mtt);
+
+
        Gtkmm2ext::UI::instance()->set_tip
                (mpks->tip_widget(),
                 _("Specify the audio signal level in dbFS at and above which the meter-peak indicator will flash red."));