X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Faudio_streamview.cc;h=c7adcfce7ee259b9f60c8ed49964b967f705db1d;hb=d3bb4e8b08ac3bc80013bce1a82eeae2ea53eea1;hp=84fe0d3a82e50abb4a24410948328a3535f0a0dd;hpb=76334847c58a04fdc9d5fd8c25e6dcdfbcbd44da;p=ardour.git diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index 84fe0d3a82..c7adcfce7e 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -29,6 +29,7 @@ #include "ardour/audioregion.h" #include "ardour/audiofilesource.h" #include "ardour/audio_track.h" +#include "ardour/record_enable_control.h" #include "ardour/region_factory.h" #include "ardour/profile.h" #include "ardour/rc_configuration.h" @@ -41,13 +42,14 @@ #include "tape_region_view.h" #include "audio_time_axis.h" #include "region_selection.h" +#include "region_gain_line.h" #include "selection.h" #include "public_editor.h" -#include "ardour_ui.h" #include "rgb_macros.h" #include "gui_thread.h" +#include "ui_config.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using namespace ARDOUR; @@ -143,12 +145,6 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr r, bool wai region_views.push_front (region_view); - if (_trackview.editor().internal_editing()) { - region_view->hide_rect (); - } else { - region_view->show_rect (); - } - /* catch region going away */ r->DropReferences.connect (*this, invalidator (*this), boost::bind (&AudioStreamView::remove_region_view, this, boost::weak_ptr (r)), gui_context()); @@ -191,8 +187,8 @@ AudioStreamView::setup_rec_box () if (!rec_active && _trackview.session()->record_status() == Session::Recording && - _trackview.track()->record_enabled()) { - if (_trackview.audio_track()->mode() == Normal && Config->get_show_waveforms_while_recording() && rec_regions.size() == rec_rects.size()) { + _trackview.track()->rec_enable_control()->get_value()) { + if (_trackview.audio_track()->mode() == Normal && UIConfiguration::instance().get_show_waveforms_while_recording() && rec_regions.size() == rec_rects.size()) { /* add a new region, but don't bother if they set show-waveforms-while-recording mid-record */ @@ -237,66 +233,15 @@ AudioStreamView::setup_rec_box () /* start a new rec box */ - boost::shared_ptr at; - - at = _trackview.audio_track(); /* we know what it is already */ + boost::shared_ptr at = _trackview.audio_track(); framepos_t const frame_pos = at->current_capture_start (); - gdouble xstart = _trackview.editor().sample_to_pixel (frame_pos); - gdouble xend = xstart; /* keeps gcc optimized happy, really set in switch() below */ - uint32_t fill_color; - - switch (_trackview.audio_track()->mode()) { - case Normal: - case NonLayered: - xend = xstart; - fill_color = ARDOUR_UI::config()->get_RecordingRect(); - break; - - case Destructive: - xend = xstart + 2; - fill_color = ARDOUR_UI::config()->get_RecordingRect(); - /* make the recording rect translucent to allow - the user to see the peak data coming in, etc. - */ - fill_color = UINT_RGBA_CHANGE_A (fill_color, 120); - break; - default: - fatal << string_compose (_("programming error: %1: %2"), - "AudioStreamView: impossible track mode", - (int) _trackview.audio_track()->mode()) << endmsg; - abort(); /*NOTREACHED*/ - } - - ArdourCanvas::Rectangle * rec_rect = new ArdourCanvas::TimeRectangle (_canvas_group); - rec_rect->set_x0 (xstart); - rec_rect->set_y0 (0); - rec_rect->set_x1 (xend); - rec_rect->set_y1 (child_height ()); - rec_rect->set_outline_what (ArdourCanvas::Rectangle::What (0)); - rec_rect->set_outline_color (ARDOUR_UI::config()->get_TimeAxisFrame()); - rec_rect->set_fill_color (fill_color); - - RecBoxInfo recbox; - recbox.rectangle = rec_rect; - - if (rec_rects.empty()) { - recbox.start = _trackview.session()->record_location (); - } else { - recbox.start = _trackview.session()->transport_frame (); - } - recbox.length = 0; + double const width = ((at->mode() == Destructive) ? 2 : 0); - rec_rects.push_back (recbox); - - screen_update_connection.disconnect(); - screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect ( - sigc::mem_fun (*this, &AudioStreamView::update_rec_box)); - rec_updating = true; - rec_active = true; + create_rec_box(frame_pos, width); } else if (rec_active && (_trackview.session()->record_status() != Session::Recording || - !_trackview.track()->record_enabled())) { + !_trackview.track()->rec_enable_control()->get_value())) { screen_update_connection.disconnect(); rec_active = false; rec_updating = false; @@ -371,7 +316,7 @@ AudioStreamView::rec_peak_range_ready (framepos_t start, framecnt_t cnt, boost:: void AudioStreamView::update_rec_regions (framepos_t start, framecnt_t cnt) { - if (!Config->get_show_waveforms_while_recording ()) { + if (!UIConfiguration::instance().get_show_waveforms_while_recording ()) { return; } @@ -408,8 +353,9 @@ AudioStreamView::update_rec_regions (framepos_t start, framecnt_t cnt) if (nlen != region->length()) { region->suspend_property_changes (); + /* set non-musical position / length */ region->set_position (_trackview.track()->get_capture_start_frame(n)); - region->set_length (nlen); + region->set_length (nlen, 0); region->resume_property_changes (); if (origlen == 1) { @@ -436,7 +382,7 @@ AudioStreamView::update_rec_regions (framepos_t start, framecnt_t cnt) region->suspend_property_changes (); region->set_position (_trackview.track()->get_capture_start_frame(n)); - region->set_length (nlen); + region->set_length (nlen, 0); region->resume_property_changes (); if (origlen == 1) { @@ -488,7 +434,7 @@ AudioStreamView::hide_xfades_with (boost::shared_ptr ar) { list start_hidden; list end_hidden; - + for (list::iterator i = region_views.begin(); i != region_views.end(); ++i) { AudioRegionView* const arv = dynamic_cast(*i); if (arv) { @@ -516,15 +462,22 @@ AudioStreamView::color_handler () { //case cAudioTrackBase: if (_trackview.is_track()) { - canvas_rect->set_fill_color (ARDOUR_UI::config()->get_AudioTrackBase()); + canvas_rect->set_fill_color (UIConfiguration::instance().color_mod ("audio track base", "audio track base")); } //case cAudioBusBase: if (!_trackview.is_track()) { - if (Profile->get_sae() && _trackview.route()->is_master()) { - canvas_rect->set_fill_color (ARDOUR_UI::config()->get_AudioMasterBusBase()); - } else { - canvas_rect->set_fill_color (ARDOUR_UI::config()->get_AudioBusBase()); + canvas_rect->set_fill_color (UIConfiguration::instance().color_mod ("audio bus base", "audio bus base")); + } +} + +void +AudioStreamView::set_selected_points (PointSelection& points) +{ + for (list::iterator i = region_views.begin(); i != region_views.end(); ++i) { + AudioRegionView* const arv = dynamic_cast(*i); + if (arv && arv->get_gain_line ()) { + arv->get_gain_line ()->set_selected_points (points); } } }