remove UUIDs as implemention of PBD::ID, use static counter (not finished - counter...
[ardour.git] / gtk2_ardour / streamview.cc
index 862efdb4c574c2b435de613bf8f09663c5091965..a60e0d59e78fd9c474b49c7d19f4621052981ed4 100644 (file)
@@ -6,7 +6,8 @@
 
 #include <ardour/audioplaylist.h>
 #include <ardour/audioregion.h>
-#include <ardour/diskstream.h>
+#include <ardour/audiosource.h>
+#include <ardour/audio_diskstream.h>
 #include <ardour/audio_track.h>
 #include <ardour/playlist_templates.h>
 #include <ardour/source.h>
@@ -28,6 +29,7 @@
 #include "color.h"
 
 using namespace ARDOUR;
+using namespace PBD;
 using namespace Editing;
 
 StreamView::StreamView (AudioTimeAxisView& tv)
@@ -275,7 +277,7 @@ StreamView::remove_rec_region (Region *r)
 {
        ENSURE_GUI_THREAD(bind (mem_fun (*this, &StreamView::remove_rec_region), r));
        
-       if (!Gtkmm2ext::UI::instance()->caller_is_gui_thread()) {
+       if (!Gtkmm2ext::UI::instance()->caller_is_ui_thread()) {
                fatal << "region deleted from non-GUI thread!" << endmsg;
                /*NOTREACHED*/
        } 
@@ -311,7 +313,7 @@ StreamView::undisplay_diskstream ()
 }
 
 void
-StreamView::display_diskstream (DiskStream *ds)
+StreamView::display_diskstream (AudioDiskstream *ds)
 {
        playlist_change_connection.disconnect();
        playlist_changed (ds);
@@ -337,7 +339,7 @@ StreamView::playlist_modified ()
 }
 
 void
-StreamView::playlist_changed (DiskStream *ds)
+StreamView::playlist_changed (AudioDiskstream *ds)
 {
        ENSURE_GUI_THREAD (bind (mem_fun (*this, &StreamView::playlist_changed), ds));
 
@@ -491,7 +493,7 @@ StreamView::diskstream_changed (void *src_ignored)
        AudioTrack *at;
 
        if ((at = _trackview.audio_track()) != 0) {
-               DiskStream& ds = at->disk_stream();
+               AudioDiskstream& ds = at->disk_stream();
                /* XXX grrr: when will SigC++ allow me to bind references? */
                Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun (*this, &StreamView::display_diskstream), &ds));
        } else {
@@ -547,7 +549,7 @@ StreamView::set_selected_regionviews (AudioRegionSelection& regions)
                }
                
                // cerr << "\tregion " << (*i)->region.name() << " selected = " << selected << endl;
-               (*i)->set_selected (selected, this);
+               (*i)->set_selected (selected);
        }
 }
 
@@ -634,7 +636,7 @@ StreamView::setup_rec_box ()
                                peak_ready_connections.clear();
                                        
                                for (uint32_t n=0; n < _trackview.get_diskstream()->n_channels(); ++n) {
-                                       Source *src = (Source *) _trackview.get_diskstream()->write_source (n);
+                                       AudioSource *src = (AudioSource *) _trackview.get_diskstream()->write_source (n);
                                        if (src) {
                                                sources.push_back (src);
                                                peak_ready_connections.push_back (src->PeakRangeReady.connect (bind (mem_fun (*this, &StreamView::rec_peak_range_ready), src))); 
@@ -662,18 +664,25 @@ StreamView::setup_rec_box ()
                        AudioTrack* at;
 
                        at = _trackview.audio_track(); /* we know what it is already */
-                       DiskStream& ds = at->disk_stream();
+                       AudioDiskstream& ds = at->disk_stream();
                        jack_nframes_t frame_pos = ds.current_capture_start ();
                        gdouble xstart = _trackview.editor.frame_to_pixel (frame_pos);
                        gdouble xend;
+                       uint32_t fill_color;
 
                        switch (_trackview.audio_track()->mode()) {
                        case Normal:
                                xend = xstart;
+                               fill_color = color_map[cRecordingRectFill];
                                break;
 
                        case Destructive:
                                xend = xstart + 2;
+                               fill_color = color_map[cRecordingRectFill];
+                               /* 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;
                        }
                        
@@ -683,7 +692,7 @@ StreamView::setup_rec_box ()
                        rec_rect->property_x2() = xend;
                        rec_rect->property_y2() = (double) _trackview.height - 1;
                        rec_rect->property_outline_color_rgba() = color_map[cRecordingRectOutline];
-                       rec_rect->property_fill_color_rgba() =  color_map[cRecordingRectFill];
+                       rec_rect->property_fill_color_rgba() = fill_color;
                        
                        RecBoxInfo recbox;
                        recbox.rectangle = rec_rect;
@@ -776,8 +785,8 @@ StreamView::update_rec_box ()
                        
                case Destructive:
                        rect.length = 2;
-                       xstart = _trackview.editor.frame_to_pixel (at);
-                       xend = xstart + 2;
+                       xstart = _trackview.editor.frame_to_pixel (_trackview.get_diskstream()->current_capture_start());
+                       xend = _trackview.editor.frame_to_pixel (at);
                        break;
                }