provide control over waveform image cache size from GUI
[ardour.git] / gtk2_ardour / rc_option_editor.cc
index a5f4b6e6f1d9bc4b8a702f63bf60d6d3c54c5fdb..0fdaaae902a60a0660be12ee3002ba7e33650a2d 100644 (file)
@@ -21,6 +21,8 @@
 #include "gtk2ardour-config.h"
 #endif
 
+#include <cairo/cairo.h>
+
 #include <boost/algorithm/string.hpp>    
 
 #include <gtkmm/liststore.h>
@@ -453,6 +455,26 @@ public:
                t->attach (*l, col, col + 1, row, row + 1, FILL | EXPAND, FILL);
                t->attach (_copy_modifier_combo, col + 1, col + 2, row, row + 1, FILL | EXPAND, FILL);
 
+                               ++row;
+               col = 1;
+
+               /* constraint modifier */
+               set_popdown_strings (_constraint_modifier_combo, dumb);
+               _constraint_modifier_combo.signal_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::constraint_modifier_chosen));
+
+               for (int x = 0; modifiers[x].name; ++x) {
+                       if (modifiers[x].modifier == (guint) ArdourKeyboard::constraint_modifier ()) {
+                               _constraint_modifier_combo.set_active_text (S_(modifiers[x].name));
+                               break;
+                       }
+               }
+
+               l = manage (left_aligned_label (_("Constrain drag using:")));
+               l->set_name ("OptionsLabel");
+
+               t->attach (*l, col, col + 1, row, row + 1, FILL | EXPAND, FILL);
+               t->attach (_constraint_modifier_combo, col + 1, col + 2, row, row + 1, FILL | EXPAND, FILL);
+
                ++row;
 
                l = manage (left_aligned_label (_("When Beginning a Trim:")));
@@ -583,7 +605,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);
@@ -763,6 +785,18 @@ private:
                }
        }
 
+       void constraint_modifier_chosen ()
+       {
+               string const txt = _constraint_modifier_combo.get_active_text();
+
+               for (int i = 0; modifiers[i].name; ++i) {
+                       if (txt == _(modifiers[i].name)) {
+                               ArdourKeyboard::set_constraint_modifier (modifiers[i].modifier);
+                               break;
+                       }
+               }
+       }
+
        void trim_contents_modifier_chosen ()
        {
                string const txt = _trim_contents_combo.get_active_text();
@@ -857,6 +891,7 @@ private:
        ComboBoxText _insert_note_modifier_combo;
        ComboBoxText _snap_modifier_combo;
        ComboBoxText _snap_delta_combo;
+       ComboBoxText _constraint_modifier_combo;
        ComboBoxText _trim_contents_combo;
        ComboBoxText _trim_overlap_combo;
        ComboBoxText _trim_anchored_combo;
@@ -2052,7 +2087,7 @@ RCOptionEditor::RCOptionEditor ()
                     "show-region-gain-envelopes",
                     _("Show gain envelopes in audio regions"),
                     _("in all modes"),
-                    _("only in region gain mode"),
+                    _("only in Draw and Internal Edit modes"),
                     sigc::mem_fun (*_ui_config, &UIConfiguration::get_show_region_gain),
                     sigc::mem_fun (*_ui_config, &UIConfiguration::set_show_region_gain)
                     ));
@@ -2611,6 +2646,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",
@@ -2650,6 +2697,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(),
+                _("Larger values lead to using more memory to store images of waveforms, 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));