From 0cde999d87ea4623d118f562e58305c7a97da8b8 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 19 Apr 2010 01:40:42 +0000 Subject: [PATCH] Move toggle-waveforms-while-recording into RC options. git-svn-id: svn://localhost/ardour2/branches/3.0@6935 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour.menus.in | 1 - gtk2_ardour/audio_streamview.cc | 8 +++----- gtk2_ardour/audio_streamview.h | 1 - gtk2_ardour/audio_time_axis.cc | 10 ---------- gtk2_ardour/automation_streamview.cc | 17 ----------------- gtk2_ardour/automation_streamview.h | 2 -- gtk2_ardour/editor.cc | 14 -------------- gtk2_ardour/editor.h | 8 -------- gtk2_ardour/editor_actions.cc | 12 ------------ gtk2_ardour/editor_audiotrack.cc | 15 --------------- gtk2_ardour/midi_streamview.cc | 8 +++----- gtk2_ardour/public_editor.h | 7 ------- gtk2_ardour/rc_option_editor.cc | 9 ++++++++- gtk2_ardour/streamview.cc | 1 - gtk2_ardour/streamview.h | 1 - libs/ardour/ardour/rc_configuration_vars.h | 1 + 16 files changed, 15 insertions(+), 100 deletions(-) diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index b25a8a5bce..f52152416e 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -397,7 +397,6 @@ - diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index d687e208d5..80498f5a7e 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -66,8 +66,6 @@ AudioStreamView::AudioStreamView (AudioTimeAxisView& tv) color_handler (); _amplitude_above_axis = 1.0; - use_rec_regions = tv.editor().show_waveforms_recording (); - Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind (&AudioStreamView::parameter_changed, this, _1), gui_context()); } @@ -448,9 +446,9 @@ AudioStreamView::setup_rec_box () if (!rec_active && _trackview.session()->record_status() == Session::Recording && _trackview.get_diskstream()->record_enabled()) { - if (_trackview.audio_track()->mode() == Normal && use_rec_regions && rec_regions.size() == rec_rects.size()) { + if (_trackview.audio_track()->mode() == Normal && Config->get_show_waveforms_while_recording() && rec_regions.size() == rec_rects.size()) { - /* add a new region, but don't bother if they set use_rec_regions mid-record */ + /* add a new region, but don't bother if they set show-waveforms-while-recording mid-record */ SourceList sources; @@ -628,7 +626,7 @@ AudioStreamView::rec_peak_range_ready (nframes_t start, nframes_t cnt, boost::we void AudioStreamView::update_rec_regions () { - if (use_rec_regions) { + if (Config->get_show_waveforms_while_recording ()) { uint32_t n = 0; for (list,RegionView*> >::iterator iter = rec_regions.begin(); diff --git a/gtk2_ardour/audio_streamview.h b/gtk2_ardour/audio_streamview.h index ce21c7dacb..1443bd5b8f 100644 --- a/gtk2_ardour/audio_streamview.h +++ b/gtk2_ardour/audio_streamview.h @@ -63,7 +63,6 @@ class AudioStreamView : public StreamView gdouble get_amplitude_above_axis () { return _amplitude_above_axis; } void set_show_waveforms (bool yn); - void set_show_waveforms_recording (bool yn) { use_rec_regions = yn; } void foreach_crossfadeview (void (CrossfadeView::*pmf)(void)); diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index f245553b5e..192c9ffdcb 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -186,16 +186,6 @@ AudioTimeAxisView::append_extra_display_menu_items () } } -void -AudioTimeAxisView::set_show_waveforms_recording (bool yn) -{ - AudioStreamView* asv = audio_view(); - - if (asv) { - asv->set_show_waveforms_recording (yn); - } -} - void AudioTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool show) { diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc index 0c596d2a31..90cc96414f 100644 --- a/gtk2_ardour/automation_streamview.cc +++ b/gtk2_ardour/automation_streamview.cc @@ -60,8 +60,6 @@ AutomationStreamView::AutomationStreamView (AutomationTimeAxisView& tv) { //canvas_rect->property_fill_color_rgba() = stream_base_color; canvas_rect->property_outline_color_rgba() = RGBA_BLACK; - - use_rec_regions = tv.editor().show_waveforms_recording (); } AutomationStreamView::~AutomationStreamView () @@ -181,21 +179,6 @@ AutomationStreamView::setup_rec_box () { } -void -AutomationStreamView::update_rec_regions (nframes_t /*start*/, nframes_t /*dur*/) -{ -} - -void -AutomationStreamView::rec_data_range_ready (jack_nframes_t start, jack_nframes_t dur) -{ - // this is called from the butler thread for now - - ENSURE_GUI_THREAD (*this, &AutomationStreamView::rec_data_range_ready, start, dur) - - this->update_rec_regions (start, dur); -} - void AutomationStreamView::color_handler () { diff --git a/gtk2_ardour/automation_streamview.h b/gtk2_ardour/automation_streamview.h index 0ab0086315..de54ea58a9 100644 --- a/gtk2_ardour/automation_streamview.h +++ b/gtk2_ardour/automation_streamview.h @@ -55,8 +55,6 @@ class AutomationStreamView : public StreamView private: void setup_rec_box (); - void rec_data_range_ready (jack_nframes_t start, jack_nframes_t dur); - void update_rec_regions (jack_nframes_t start, jack_nframes_t dur); RegionView* add_region_view_internal (boost::shared_ptr, bool wait_for_data, bool recording = false); void display_region(AutomationRegionView* region_view); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 69f7cb9287..d9ca85b939 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -331,7 +331,6 @@ Editor::Editor () current_interthread_info = 0; _show_measures = true; - _show_waveforms_recording = true; show_gain_after_trim = false; verbose_cursor_on = true; last_item_entered = 0; @@ -2332,18 +2331,6 @@ Editor::set_state (const XMLNode& node, int /*version*/) set_edit_point_preference ((EditPoint) string_2_enum (prop->value(), _edit_point), true); } - if ((prop = node.property ("show-waveforms-recording"))) { - bool yn = string_is_affirmative (prop->value()); - _show_waveforms_recording = !yn; - RefPtr act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformsWhileRecording")); - if (act) { - RefPtr tact = RefPtr::cast_dynamic(act); - /* do it twice to force the change */ - tact->set_active (!yn); - tact->set_active (yn); - } - } - if ((prop = node.property ("show-measures"))) { bool yn = string_is_affirmative (prop->value()); _show_measures = !yn; @@ -2490,7 +2477,6 @@ Editor::get_state () snprintf (buf, sizeof (buf), "%f", vertical_adjustment.get_value ()); node->add_property ("y-origin", buf); - node->add_property ("show-waveforms-recording", _show_waveforms_recording ? "yes" : "no"); node->add_property ("show-measures", _show_measures ? "yes" : "no"); node->add_property ("follow-playhead", _follow_playhead ? "yes" : "no"); node->add_property ("stationary-playhead", _stationary_playhead ? "yes" : "no"); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 0b8275e03b..ca12393b3e 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -223,11 +223,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD std::vector rb_opt_strings; #endif - /* option editor-access */ - - void set_show_waveforms_recording (bool yn); - bool show_waveforms_recording() const { return _show_waveforms_recording; } - /* things that need to be public to be used in the main menubar */ void new_region_from_selection (); @@ -367,7 +362,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD bool dragging_playhead () const { return _dragging_playhead; } void toggle_zero_line_visibility (); - void toggle_waveforms_while_recording (); void set_summary (); void set_group_tabs (); void toggle_measure_visibility (); @@ -1414,8 +1408,6 @@ public: bool _follow_playhead; /// true if we scroll the tracks rather than the playhead bool _stationary_playhead; - /// true if waveforms should be shown while recording audio tracks, otherwise false - bool _show_waveforms_recording; ARDOUR::TempoMap::BBTPointList *current_bbt_points; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index ed32b113d1..61be412e85 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -820,8 +820,6 @@ Editor::register_actions () act = ActionManager::register_action (editor_actions, X_("importFromSession"), _("Import From Session"), sigc::mem_fun(*this, &Editor::session_import_dialog)); ActionManager::write_sensitive_actions.push_back (act); - ActionManager::register_toggle_action (editor_actions, X_("ToggleWaveformsWhileRecording"), _("Show Waveforms While Recording"), sigc::mem_fun (*this, &Editor::toggle_waveforms_while_recording)); - ActionManager::register_toggle_action (editor_actions, X_("ToggleSummary"), _("Show Summary"), sigc::mem_fun (*this, &Editor::set_summary)); ActionManager::register_toggle_action (editor_actions, X_("ToggleGroupTabs"), _("Show Group Tabs"), sigc::mem_fun (*this, &Editor::set_group_tabs)); @@ -898,16 +896,6 @@ Editor::toggle_ruler_visibility (RulerType rt) } } -void -Editor::toggle_waveforms_while_recording () -{ - Glib::RefPtr act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformsWhileRecording")); - if (act) { - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); - set_show_waveforms_recording (tact->get_active()); - } -} - void Editor::set_summary () { diff --git a/gtk2_ardour/editor_audiotrack.cc b/gtk2_ardour/editor_audiotrack.cc index 143da8aa08..df0b50cbbd 100644 --- a/gtk2_ardour/editor_audiotrack.cc +++ b/gtk2_ardour/editor_audiotrack.cc @@ -34,21 +34,6 @@ using namespace ARDOUR; using namespace PBD; -void -Editor::set_show_waveforms_recording (bool yn) -{ - AudioTimeAxisView* atv; - - if (_show_waveforms_recording != yn) { - _show_waveforms_recording = yn; - for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { - if ((atv = dynamic_cast(*i)) != 0) { - atv->set_show_waveforms_recording (yn); - } - } - } -} - void Editor::start_updating_meters () { diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index ba6d1b999c..430a92503d 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -70,8 +70,6 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv) stream_base_color = ARDOUR_UI::config()->canvasvar_MidiBusBase.get(); } - use_rec_regions = tv.editor().show_waveforms_recording (); - /* use a group dedicated to MIDI underlays. Audio underlays are not in this group. */ midi_underlay_group = new ArdourCanvas::Group (*canvas_group); midi_underlay_group->lower_to_bottom(); @@ -389,9 +387,9 @@ MidiStreamView::setup_rec_box () _trackview.session()->record_status() == Session::Recording && _trackview.get_diskstream()->record_enabled()) { - if (use_rec_regions && rec_regions.size() == rec_rects.size()) { + if (Config->get_show_waveforms_while_recording() && rec_regions.size() == rec_rects.size()) { - /* add a new region, but don't bother if they set use_rec_regions mid-record */ + /* add a new region, but don't bother if they set show-waveforms-while-recording mid-record */ MidiRegion::SourceList sources; @@ -526,7 +524,7 @@ MidiStreamView::update_rec_regions (boost::shared_ptr data, nframes_t { ENSURE_GUI_THREAD (*this, &MidiStreamView::update_rec_regions, data, start, dur) - if (use_rec_regions) { + if (Config->get_show_waveforms_while_recording ()) { uint32_t n = 0; bool update_range = false; diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index fe20729b34..68d5c0d577 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -180,13 +180,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible { */ virtual void consider_auditioning (boost::shared_ptr r) = 0; - /** Set whether waveforms should be shown while recording audio tracks. - * @param yn true to show waveforms, otherwise false. - */ - virtual void set_show_waveforms_recording (bool yn) = 0; - - /** @return true if waveforms are being shown while recording, otherwise false */ - virtual bool show_waveforms_recording () const = 0; virtual void new_region_from_selection () = 0; virtual void separate_region_from_selection () = 0; diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index e9fb88a6de..76111e60b0 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -1153,11 +1153,18 @@ RCOptionEditor::RCOptionEditor () add_option (_("Editor"), wfsh); + add_option (_("Editor"), + new BoolOption ( + "show-waveforms-while-recording", + _("Show waveforms for audio while it is being recorded"), + sigc::mem_fun (*_rc_config, &RCConfiguration::get_show_waveforms_while_recording), + sigc::mem_fun (*_rc_config, &RCConfiguration::set_show_waveforms_while_recording) + )); + /* AUDIO */ add_option (_("Audio"), new OptionEditorHeading (_("Solo"))); - add_option (_("Audio"), new BoolOption ( "solo-control-is-listen-control", diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index ddb8dc8a84..83dd9fc4b8 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -55,7 +55,6 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* group) , _samples_per_unit (_trackview.editor().get_current_zoom ()) , rec_updating(false) , rec_active(false) - , use_rec_regions (tv.editor().show_waveforms_recording ()) , region_color(_trackview.color()) , stream_base_color(0xFFFFFFFF) , _layers (1) diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h index a1ebe2cc2a..17a1c4182b 100644 --- a/gtk2_ardour/streamview.h +++ b/gtk2_ardour/streamview.h @@ -155,7 +155,6 @@ protected: std::list< std::pair,RegionView* > > rec_regions; bool rec_updating; bool rec_active; - bool use_rec_regions; Gdk::Color region_color; ///< Contained region color uint32_t stream_base_color; ///< Background color diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index 31f4b96620..1cc7c9490c 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -147,6 +147,7 @@ CONFIG_VARIABLE (bool, rubberbanding_snaps_to_grid, "rubberbanding-snaps-to-grid CONFIG_VARIABLE (long, font_scale, "font-scale", 102400) CONFIG_VARIABLE (std::string, default_session_parent_dir, "default-session-parent-dir", "~") CONFIG_VARIABLE (bool, show_waveforms, "show-waveforms", true) +CONFIG_VARIABLE (bool, show_waveforms_while_recording, "show-waveforms-while-recording", true) CONFIG_VARIABLE (WaveformScale, waveform_scale, "waveform-scale", Linear) CONFIG_VARIABLE (WaveformShape, waveform_shape, "waveform-shape", Traditional)