X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Faudio_streamview.cc;h=c7adcfce7ee259b9f60c8ed49964b967f705db1d;hb=d3bb4e8b08ac3bc80013bce1a82eeae2ea53eea1;hp=6880c8be5b9212205dd75b24425699ba081ca9af;hpb=5399425f534e2d96d07cf29f427bfa0f39d904b7;p=ardour.git diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index 6880c8be5b..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,14 +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 "utils.h" +#include "ui_config.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using namespace ARDOUR; @@ -110,15 +111,15 @@ AudioStreamView::create_region_view (boost::shared_ptr r, bool wait_for_ break; case Destructive: region_view = new TapeAudioRegionView (_canvas_group, _trackview, region, - _samples_per_pixel, region_color); + _samples_per_pixel, region_color); break; default: - fatal << string_compose (_("programming error: %1"), "illegal track mode in ::add_region_view_internal") << endmsg; - /*NOTREACHED*/ + fatal << string_compose (_("programming error: %1"), "illegal track mode in ::create_region_view()") << endmsg; + abort(); /*NOTREACHED*/ } - region_view->init (region_color, wait_for_waves); + region_view->init (wait_for_waves); region_view->set_amplitude_above_axis(_amplitude_above_axis); region_view->set_height (child_height ()); @@ -142,35 +143,8 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr r, bool wai return 0; } -// if(!recording){ -// for (list::iterator i = region_views.begin(); i != region_views.end(); ++i) { -// if ((*i)->region() == r) { -// cerr << "audio_streamview in add_region_view_internal region found" << endl; - /* great. we already have a AudioRegionView for this Region. use it again. */ - -// (*i)->set_valid (true); - - // this might not be necessary -// AudioRegionView* const arv = dynamic_cast(*i); - -// if (arv) { -// arv->set_waveform_scale (_waveform_scale); -// arv->set_waveform_shape (_waveform_shape); -// } - -// return NULL; -// } -// } -// } - 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()); @@ -213,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 */ @@ -259,57 +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_canvasvar_RecordingRect(); - break; - - case Destructive: - xend = xstart + 2; - fill_color = ARDOUR_UI::config()->get_canvasvar_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; - } - - ArdourCanvas::Rectangle * rec_rect = new ArdourCanvas::Rectangle (_canvas_group); - rec_rect->set_x0 (xstart); - rec_rect->set_y0 (1); - 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_canvasvar_TimeAxisFrame()); - rec_rect->set_fill_color (fill_color); - rec_rect->lower_to_bottom(); + double const width = ((at->mode() == Destructive) ? 2 : 0); - RecBoxInfo recbox; - recbox.rectangle = rec_rect; - recbox.start = _trackview.session()->transport_frame(); - recbox.length = 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; @@ -384,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; } @@ -421,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) { @@ -449,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) { @@ -501,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) { @@ -529,15 +462,22 @@ AudioStreamView::color_handler () { //case cAudioTrackBase: if (_trackview.is_track()) { - canvas_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_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_canvasvar_AudioMasterBusBase()); - } else { - canvas_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_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); } } }