From 9b75cdb26d6abaf9c7c28858fdd0d350a32adc01 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 23 Jun 2015 08:18:11 -0400 Subject: provide control over waveform image cache size from GUI --- gtk2_ardour/ardour_ui_options.cc | 3 +++ gtk2_ardour/rc_option_editor.cc | 16 ++++++++++++++++ gtk2_ardour/ui_config_vars.h | 1 + 3 files changed, 20 insertions(+) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index f63dd46401..0c59a66213 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -425,6 +425,9 @@ ARDOUR_UI::parameter_changed (std::string p) ArdourCanvas::WaveView::set_global_show_waveform_clipping (ARDOUR_UI::config()->get_show_waveform_clipping()); } else if (p == "font-scale") { ui_scale = config()->get_font_scale () / 102400.; + } else if (p == "waveform-cache-size") { + /* GUI option has units of megabytes; image cache uses units of bytes */ + ArdourCanvas::WaveView::set_image_cache_size (ARDOUR_UI::config()->get_waveform_cache_size() * 1048576); } } diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index bb0042cf79..0fdaaae902 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -2697,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)); diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index 7cf96ce7b0..ae6648ab96 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -72,3 +72,4 @@ UI_CONFIG_VARIABLE (double, waveform_clip_level, "waveform-clip-level", -0.09339 UI_CONFIG_VARIABLE (bool, hiding_groups_deactivates_groups, "hiding-groups-deactivates-groups", true) UI_CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false) UI_CONFIG_VARIABLE (bool, buggy_gradients, "buggy-gradients", false) +UI_CONFIG_VARIABLE (uint64_t, waveform_cache_size, "waveform-cache-size", 100) /* units of megagbytes */ -- cgit v1.2.3